Remove lcf::Data from Actor::Setup
MODIFY
generator/csv/functions.csv
generator/csv/functions.csv
Structure,Method,Headers
-Actor,void Setup(),
+Actor,void Setup(bool is2k3),
Parameters,void Setup(int final_level),

MODIFY
src/generated/lcf/rpg/actor.h
src/generated/lcf/rpg/actor.h
Binary files a/src/generated/lcf/rpg/actor.h and b/src/generated/lcf/rpg/actor.h differ

MODIFY
src/ldb_reader.cpp
src/ldb_reader.cpp
@@ -79,9 +79,8 @@ bool LDB_Reader::Load(std::istream& filestream, const std::string& encoding) {
// Delayed initialization of some actor fields because they are engine
// dependent
- std::vector<rpg::Actor>::iterator it;
- for (it = Data::actors.begin(); it != Data::actors.end(); ++it) {
- (*it).Setup();
+ for (auto& actor: Data::actors) {
+ actor.Setup(Data::system.ldb_id == 2003);
}
return true;

MODIFY
src/reader_struct_impl.h
src/reader_struct_impl.h
@@ -41,20 +41,22 @@ void Struct<S>::MakeTagMap() {
template <typename T>
struct StructDefault {
- static T make() {
+ static T make(bool) {
return T();
}
};
template <>
struct StructDefault<rpg::Actor> {
- static rpg::Actor make() {
+ static rpg::Actor make(bool is2k3) {
auto actor = rpg::Actor();
- actor.Setup();
+ actor.Setup(is2k3);
return actor;
}
};
+
+
template <class S>
void Struct<S>::ReadLcf(S& obj, LcfReader& stream) {
MakeFieldMap();
@@ -106,7 +108,7 @@ template <class S>
void Struct<S>::WriteLcf(const S& obj, LcfWriter& stream) {
const bool db_is2k3 = (Data::system.ldb_id == 2003);
- auto ref = StructDefault<S>::make();
+ auto ref = StructDefault<S>::make(db_is2k3);
int last = -1;
for (int i = 0; fields[i] != NULL; i++) {
const Field<S>* field = fields[i];
@@ -136,7 +138,7 @@ template <class S>
int Struct<S>::LcfSize(const S& obj, LcfWriter& stream) {
const bool db_is2k3 = (Data::system.ldb_id == 2003);
int result = 0;
- auto ref = StructDefault<S>::make();
+ auto ref = StructDefault<S>::make(db_is2k3);
for (int i = 0; fields[i] != NULL; i++) {
const Field<S>* field = fields[i];
if (!db_is2k3 && field->is2k3) {

MODIFY
src/rpg_setup.cpp
src/rpg_setup.cpp
#include "lcf/rpg/save.h"
#include "lcf/rpg/chipset.h"
#include "lcf/rpg/parameters.h"
-#include "lcf/data.h"
namespace lcf {
-void rpg::Actor::Setup() {
+void rpg::Actor::Setup(bool is2k3) {
int max_final_level = 0;
- if (lcf::Data::system.ldb_id == 2003) {
+ if (is2k3) {
max_final_level = 99;
if (final_level == -1) {
final_level = max_final_level;

Remove lcf::Data from Actor::Setup