diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp index 3ff86320..d791ef15 100644 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp @@ -592,10 +592,15 @@ void ServerArmorTemplate::_SpecialProtection::load(Iff &file) { for (int i = 0; i < paramCount; ++i) { file.enterChunk(); file.read_string(paramName, MAX_NAME_SIZE); - case constcrc("type"): - m_type.loadFromIff(file); - case constcrc("effectiveness"): - m_effectiveness.loadFromIff(file); + + switch(runtimeCrc(paramName)) { + case constcrc("type"): + m_type.loadFromIff(file); + break; + case constcrc("effectiveness"): + m_effectiveness.loadFromIff(file); + break; + } file.exitChunk(true); } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp index 60505528..e10613ab 100644 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp @@ -860,32 +860,41 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { for (int i = 0; i < paramCount; ++i) { file.enterChunk(); file.read_string(paramName, MAX_NAME_SIZE); - if (strcmp(paramName, "optional") == 0) - m_optional.loadFromIff(file); - case constcrc("name"): - m_name.loadFromIff(file); - case constcrc("options"): { - std::vector::iterator iter; - for (iter = m_options.begin(); iter != m_options.end(); ++iter) { - delete *iter; - *iter = nullptr; - } - m_options.clear(); - m_optionsAppend = file.read_bool8(); - int listCount = file.read_int32(); - for (int j = 0; j < listCount; ++j) { - StructParamOT *newData = new StructParamOT; - newData->loadFromIff(file); - m_options.push_back(newData); - } - m_optionsLoaded = true; - } - case constcrc("optionalSkillCommand"): - m_optionalSkillCommand.loadFromIff(file); - case constcrc("complexity"): - m_complexity.loadFromIff(file); - case constcrc("appearance"): - m_appearance.loadFromIff(file); + + switch(runtimeCrc(paramName)) { + case constcrc("optional"): + m_optional.loadFromIff(file); + break; + case constcrc("name"): + m_name.loadFromIff(file); + break; + case constcrc("options"): { + std::vector::iterator iter; + for (iter = m_options.begin(); iter != m_options.end(); ++iter) { + delete *iter; + *iter = nullptr; + } + m_options.clear(); + m_optionsAppend = file.read_bool8(); + int listCount = file.read_int32(); + for (int j = 0; j < listCount; ++j) { + StructParamOT *newData = new StructParamOT; + newData->loadFromIff(file); + m_options.push_back(newData); + } + m_optionsLoaded = true; + } + break; + case constcrc("optionalSkillCommand"): + m_optionalSkillCommand.loadFromIff(file); + break; + case constcrc("complexity"): + m_complexity.loadFromIff(file); + break; + case constcrc("appearance"): + m_appearance.loadFromIff(file); + break; + } file.exitChunk(true); } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp index b1268d44..5bdb7434 100644 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp @@ -640,10 +640,16 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::load(Iff &file) for (int i = 0; i < paramCount; ++i) { file.enterChunk(); file.read_string(paramName, MAX_NAME_SIZE); - if (strcmp(paramName, "name") == 0) - m_name.loadFromIff(file); - case constcrc("ingredient"): - m_ingredient.loadFromIff(file); + + switch(runtimeCrc(paramName)) { + case constcrc("name"): + m_name.loadFromIff(file); + break; + case constcrc("ingredient"): + m_ingredient.loadFromIff(file); + break; + } + file.exitChunk(true); } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp index ebb3fc71..19a339d8 100644 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp @@ -1100,16 +1100,24 @@ void ServerObjectTemplate::_AttribMod::load(Iff &file) { for (int i = 0; i < paramCount; ++i) { file.enterChunk(); file.read_string(paramName, MAX_NAME_SIZE); - if (strcmp(paramName, "target") == 0) - m_target.loadFromIff(file); - case constcrc("value"): - m_value.loadFromIff(file); - case constcrc("time"): - m_time.loadFromIff(file); - case constcrc("timeAtValue"): - m_timeAtValue.loadFromIff(file); - case constcrc("decay"): - m_decay.loadFromIff(file); + + switch(runtimeCrc(paramName)) { + case constcrc("target"): + m_target.loadFromIff(file); + break; + case constcrc("value"): + m_value.loadFromIff(file); + break; + case constcrc("time"): + m_time.loadFromIff(file); + break; + case constcrc("timeAtValue"): + m_timeAtValue.loadFromIff(file); + break; + case constcrc("decay"): + m_decay.loadFromIff(file); + break; + } file.exitChunk(true); } @@ -1334,12 +1342,18 @@ void ServerObjectTemplate::_Contents::load(Iff &file) { for (int i = 0; i < paramCount; ++i) { file.enterChunk(); file.read_string(paramName, MAX_NAME_SIZE); - if (strcmp(paramName, "slotName") == 0) - m_slotName.loadFromIff(file); - case constcrc("equipObject"): - m_equipObject.loadFromIff(file); - case constcrc("content"): - m_content.loadFromIff(file); + + switch(runtimeCrc(paramName)) { + case constcrc("slotName"): + m_slotName.loadFromIff(file); + break; + case constcrc("equipObject"): + m_equipObject.loadFromIff(file); + break; + case constcrc("content"): + m_content.loadFromIff(file); + break; + } file.exitChunk(true); } @@ -1576,16 +1590,24 @@ void ServerObjectTemplate::_MentalStateMod::load(Iff &file) { for (int i = 0; i < paramCount; ++i) { file.enterChunk(); file.read_string(paramName, MAX_NAME_SIZE); - if (strcmp(paramName, "target") == 0) - m_target.loadFromIff(file); - case constcrc("value"): - m_value.loadFromIff(file); - case constcrc("time"): - m_time.loadFromIff(file); - case constcrc("timeAtValue"): - m_timeAtValue.loadFromIff(file); - case constcrc("decay"): - m_decay.loadFromIff(file); + + switch(runtimeCrc(paramName)) { + case constcrc("target"): + m_target.loadFromIff(file); + break; + case constcrc("value"): + m_value.loadFromIff(file); + break; + case constcrc("time"): + m_time.loadFromIff(file); + break; + case constcrc("timeAtValue"): + m_timeAtValue.loadFromIff(file); + break; + case constcrc("decay"): + m_decay.loadFromIff(file); + break; + } file.exitChunk(true); } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp index b084b696..346dca91 100644 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp @@ -103,7 +103,7 @@ SharedCreatureObjectTemplate::getCompilerIntegerParam(const char *name, bool dee } fprintf(stderr, "trying to access single-parameter \"gender\" as an array\n"); } - name; + break; case constcrc("niche"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -115,7 +115,7 @@ SharedCreatureObjectTemplate::getCompilerIntegerParam(const char *name, bool dee } fprintf(stderr, "trying to access single-parameter \"niche\" as an array\n"); } - name; + break; case constcrc("species"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -127,7 +127,7 @@ SharedCreatureObjectTemplate::getCompilerIntegerParam(const char *name, bool dee } fprintf(stderr, "trying to access single-parameter \"species\" as an array\n"); } - name; + break; case constcrc("race"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -139,7 +139,7 @@ SharedCreatureObjectTemplate::getCompilerIntegerParam(const char *name, bool dee } fprintf(stderr, "trying to access single-parameter \"race\" as an array\n"); } - name; + break; default: return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); break; @@ -160,7 +160,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "index for parameter \"acceleration\" out of bounds\n"); } - name; + break; case constcrc("speed"): { if (index >= 0 && index < 2) { if (deepCheck && !isParamLoaded(name, false, index)) { @@ -172,7 +172,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "index for parameter \"speed\" out of bounds\n"); } - name; + break; case constcrc("turnRate"): { if (index >= 0 && index < 2) { if (deepCheck && !isParamLoaded(name, false, index)) { @@ -184,7 +184,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "index for parameter \"turnRate\" out of bounds\n"); } - name; + break; case constcrc("slopeModAngle"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -196,7 +196,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"slopeModAngle\" as an array\n"); } - name; + break; case constcrc("slopeModPercent"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -208,7 +208,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"slopeModPercent\" as an array\n"); } - name; + break; case constcrc("waterModPercent"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -220,7 +220,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"waterModPercent\" as an array\n"); } - name; + break; case constcrc("stepHeight"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -232,7 +232,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"stepHeight\" as an array\n"); } - name; + break; case constcrc("collisionHeight"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -244,7 +244,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"collisionHeight\" as an array\n"); } - name; + break; case constcrc("collisionRadius"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -256,7 +256,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"collisionRadius\" as an array\n"); } - name; + break; case constcrc("swimHeight"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -268,7 +268,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"swimHeight\" as an array\n"); } - name; + break; case constcrc("warpTolerance"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -280,7 +280,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"warpTolerance\" as an array\n"); } - name; + break; case constcrc("collisionOffsetX"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -292,7 +292,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"collisionOffsetX\" as an array\n"); } - name; + break; case constcrc("collisionOffsetZ"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -304,7 +304,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"collisionOffsetZ\" as an array\n"); } - name; + break; case constcrc("collisionLength"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -316,7 +316,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"collisionLength\" as an array\n"); } - name; + break; case constcrc("cameraHeight"): { if (index == 0) { if (deepCheck && !isParamLoaded(name, false, 0)) { @@ -328,7 +328,7 @@ FloatParam *SharedCreatureObjectTemplate::getFloatParam(const char *name, bool d } fprintf(stderr, "trying to access single-parameter \"cameraHeight\" as an array\n"); } - name; + break; default: return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); break; diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp index 6bd68f53..43eb635a 100644 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp @@ -234,7 +234,7 @@ void SharedDraftSchematicObjectTemplate::setAppend(const char *name) { bool SharedDraftSchematicObjectTemplate::isAppend(const char *name) const { switch (runtimeCrc(name)) { - case cosntcrc("slots"): + case constcrc("slots"): return m_slotsAppend; break; case constcrc("attributes"):