Skip to content

Commit f36f0fa

Browse files
committed
fixed the upversion of if (info->version [=>] >= [<=] K_SCRIPT_GROUP_DATA_VERSION_2)
1 parent 4a2bcb2 commit f36f0fa

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class.
583583
TEAM_MEET_AT_KINDOF, ///< Set a team to meet at the center point of all units with <kindOf>.
584584
TEAM_MEET_AT_TYPE, ///< Set a team to meet at the center point of all units with <objectType>.
585585
TEAM_USE_COMMAND_BUTTON_ABILITY_WITH_TYPE, ///< Set all units with an object type in a team to use a command button ability.
586-
/*TODO*/TEAM_USE_COMMAND_BUTTON_ABILITY_ON_TEAM, ///< Set a team to use a command button ability on another team.
586+
TEAM_USE_COMMAND_BUTTON_ABILITY_ON_TEAM, ///< Set a team to use a command button ability on another team.
587587
TEAM_MERGE_KINDOF, ///< A team merges all units with <kindOf> into another team.
588588
TEAM_MERGE_TYPE, ///< A team merges all units with <objectType> into another team.
589589
TEAM_DISBAND_KINDOF, ///< A team disbands all units with <kindOf>.

GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ enum { K_SCRIPT_LIST_DATA_VERSION_1 = 1,
144144
K_SCRIPT_CONDITION_VERSION_3 = 3,
145145
K_SCRIPT_CONDITION_VERSION_4 = 4,
146146
K_SCRIPTS_DATA_VERSION_1,
147-
K_SCRIPT_GROUP_DATA_VERSION_3 = 3,
148147
K_SCRIPT_DATA_VERSION_3 = 3,
149148
end_of_the_enumeration
150149
};
@@ -858,7 +857,7 @@ void ScriptGroup::WriteGroupDataChunk(DataChunkOutput &chunkWriter, ScriptGroup
858857

859858
/**********SCRIPT GROUP DATA ***********************/
860859
while (pGroup) {
861-
chunkWriter.openDataChunk("ScriptGroup", K_SCRIPT_GROUP_DATA_VERSION_3);
860+
chunkWriter.openDataChunk("ScriptGroup", K_SCRIPT_GROUP_DATA_VERSION_2);
862861
chunkWriter.writeAsciiString(pGroup->m_groupName);
863862
chunkWriter.writeByte(pGroup->m_isGroupActive);
864863
chunkWriter.writeByte(pGroup->m_isGroupSubroutine);
@@ -883,7 +882,7 @@ Bool ScriptGroup::ParseGroupDataChunk(DataChunkInput &file, DataChunkInfo *info,
883882

884883
pGroup->m_groupName = file.readAsciiString();
885884
pGroup->m_isGroupActive = file.readByte();
886-
if (info->version == K_SCRIPT_GROUP_DATA_VERSION_2) {
885+
if (info->version >= K_SCRIPT_GROUP_DATA_VERSION_2) {
887886
pGroup->m_isGroupSubroutine= file.readByte();
888887
}
889888
pList->addGroup(pGroup, AT_END);
@@ -1227,9 +1226,11 @@ void Script::WriteScriptDataChunk(DataChunkOutput &chunkWriter, Script *pScript)
12271226
chunkWriter.writeByte(pScript->m_easy);
12281227
chunkWriter.writeByte(pScript->m_normal);
12291228
chunkWriter.writeByte(pScript->m_hard);
1229+
12301230
chunkWriter.writeByte(pScript->m_brutal); // NEW
12311231
chunkWriter.writeByte(pScript->m_absurd); // NEW
12321232
chunkWriter.writeByte(pScript->m_inhumane); // NEW
1233+
12331234
chunkWriter.writeByte(pScript->m_isSubroutine);
12341235
chunkWriter.writeInt(pScript->m_delayEvaluationSeconds);
12351236
if (pScript->m_condition) OrCondition::WriteOrConditionDataChunk(chunkWriter, pScript->m_condition);
@@ -1271,7 +1272,7 @@ Script *Script::ParseScript(DataChunkInput &file, unsigned short version)
12711272
pScript->m_inhumane = file.readByte();
12721273
}
12731274
else {
1274-
// Default: old maps shouldn't run scripts on new difficulties
1275+
// Default: old maps with old scripts shouldn't run scripts on new difficulties
12751276
pScript->m_brutal = false;
12761277
pScript->m_absurd = false;
12771278
pScript->m_inhumane = false;
@@ -1282,9 +1283,9 @@ Script *Script::ParseScript(DataChunkInput &file, unsigned short version)
12821283
//-------------------------------------------------------------------------------------------------
12831284

12841285
pScript->m_isSubroutine = file.readByte();
1285-
if (version>=K_SCRIPT_DATA_VERSION_2) {
1286-
pScript->m_delayEvaluationSeconds = file.readInt();
1287-
}
1286+
1287+
pScript->m_delayEvaluationSeconds = file.readInt();
1288+
12881289
file.registerParser( "OrCondition", "Script", OrCondition::ParseOrConditionDataChunk );
12891290
file.registerParser( "ScriptAction", "Script", ScriptAction::ParseActionDataChunk );
12901291
file.registerParser( "ScriptActionFalse", "Script", ScriptAction::ParseActionFalseDataChunk );

0 commit comments

Comments
 (0)