Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Core/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ set(GAMEENGINE_SRC
Include/Common/LocalFile.h
Include/Common/LocalFileSystem.h
Include/Common/MapObject.h
# Include/Common/MapReaderWriterInfo.h
Include/Common/MapReaderWriterInfo.h
Include/Common/MessageStream.h
Include/Common/MiniDumper.h
Include/Common/MiniLog.h
Expand Down Expand Up @@ -486,16 +486,16 @@ set(GAMEENGINE_SRC
# Include/GameLogic/ObjectScriptStatusBits.h
# Include/GameLogic/ObjectTypes.h
# Include/GameLogic/PartitionManager.h
# Include/GameLogic/PolygonTrigger.h
Include/GameLogic/PolygonTrigger.h
# Include/GameLogic/Powers.h
Include/GameLogic/RankInfo.h
# Include/GameLogic/ScriptActions.h
# Include/GameLogic/ScriptConditions.h
# Include/GameLogic/ScriptEngine.h
# Include/GameLogic/Scripts.h
# Include/GameLogic/SidesList.h
Include/GameLogic/SidesList.h
# Include/GameLogic/Squad.h
# Include/GameLogic/TerrainLogic.h
Include/GameLogic/TerrainLogic.h
# Include/GameLogic/TurretAI.h
# Include/GameLogic/VictoryConditions.h
# Include/GameLogic/Weapon.h
Expand Down Expand Up @@ -853,9 +853,9 @@ set(GAMEENGINE_SRC
# Source/GameLogic/AI/AITNGuard.cpp
# Source/GameLogic/AI/Squad.cpp
# Source/GameLogic/AI/TurretAI.cpp
# Source/GameLogic/Map/PolygonTrigger.cpp
# Source/GameLogic/Map/SidesList.cpp
# Source/GameLogic/Map/TerrainLogic.cpp
Source/GameLogic/Map/PolygonTrigger.cpp
Source/GameLogic/Map/SidesList.cpp
Source/GameLogic/Map/TerrainLogic.cpp
# Source/GameLogic/Object/Armor.cpp
# Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp
# Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,14 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu
loc.z = file.readInt();
pTrig->addPoint(loc);
}
#if !(RTS_GENERALS && RETAIL_COMPATIBLE_CRC)
if (numPoints<2) {
DEBUG_LOG(("Deleting polygon trigger '%s' with %d points.",
pTrig->getTriggerName().str(), numPoints));
deleteInstance(pTrig);
continue;
}
#endif
if (pPrevTrig) {
pPrevTrig->setNextPoly(pTrig);
} else {
Expand Down Expand Up @@ -239,7 +241,11 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu
*/
void PolygonTrigger::WritePolygonTriggersDataChunk(DataChunkOutput &chunkWriter)
{
#if RTS_GENERALS && RETAIL_COMPATIBLE_CRC

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need a new type of define here for Data upgrades.

RETAIL_COMPATIBLE_DATA perhaps.

Because this is more than just CRC relevant.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be, but the thing is that this field is used only in retail compatible generals, zh and non retail generals use version 4 of it.
I'm not in favor of adding new type of define for something so small.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are probably more data format differences sprinkled into Generals, no? Or is this the only one for maps, w3d, scb, etc?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likely there is other data format differences, so I cannot say this is the only one without auditing the map, SCB, W3D, and related readers and writers, as for as the idea of RETAIL_COMPATIBLE_DATA may make sense, but I think it should be introduced in a separate follow-up after those paths are inventoried rather than expanding this PR, this is my opinion, could be wrong though, your call, if needed i can add the guard to move this pr forward.

@OmarAglan OmarAglan Aug 29, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Looked upon map,SCB, and W3D readers and writers, and the PolygonTriggers is not the only data format difference, we have Gen WB writes BlendTile version 7 while zh writes version 8, and the embedded SCB script formats also differ in their condition, action, and player data versions.

also W3D currently uses a shared exporter and reader with no target specific format guards.

I agree that a separate data compatibility guard is justified. I would use it here only for the emitted PolygonTrigger version and layer field, while keeping malformed trigger removal under RETAIL_COMPATIBLE_CRC.

The other formats should be handled when their complete reader and writer pairs are synchronized.

i can open a pr that addes it if needed, tell what you think @xezon?

chunkWriter.openDataChunk("PolygonTriggers", K_TRIGGERS_VERSION_3);
#else
chunkWriter.openDataChunk("PolygonTriggers", K_TRIGGERS_VERSION_4);
#endif

PolygonTrigger *pTrig;
Int count = 0;
Expand All @@ -249,7 +255,9 @@ void PolygonTrigger::WritePolygonTriggersDataChunk(DataChunkOutput &chunkWriter)
chunkWriter.writeInt(count);
for (pTrig=PolygonTrigger::getFirstPolygonTrigger(); pTrig; pTrig = pTrig->getNext()) {
chunkWriter.writeAsciiString(pTrig->getTriggerName());
#if !(RTS_GENERALS && RETAIL_COMPATIBLE_CRC)
chunkWriter.writeAsciiString(pTrig->getLayerName());
#endif
chunkWriter.writeInt(pTrig->getID());
chunkWriter.writeByte(pTrig->isWaterArea());
chunkWriter.writeByte(pTrig->isRiver());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2866,8 +2866,6 @@ void TerrainLogic::flattenTerrain(Object *obj)

}



// ------------------------------------------------------------------------------------------------
/** Dig a deep circular gorge into the terrain beneath an object. */
// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -2917,12 +2915,6 @@ void TerrainLogic::createCraterInTerrain(Object *obj)

}







// ------------------------------------------------------------------------------------------------
/** CRC */
// ------------------------------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions Generals/Code/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ set(GAMEENGINE_SRC
# Include/Common/LocalFile.h
# Include/Common/LocalFileSystem.h
# Include/Common/MapObject.h
Include/Common/MapReaderWriterInfo.h
# Include/Common/MapReaderWriterInfo.h
# Include/Common/MessageStream.h
# Include/Common/MiniLog.h
# Include/Common/MiscAudio.h
Expand Down Expand Up @@ -437,16 +437,16 @@ set(GAMEENGINE_SRC
Include/GameLogic/ObjectScriptStatusBits.h
Include/GameLogic/ObjectTypes.h
Include/GameLogic/PartitionManager.h
Include/GameLogic/PolygonTrigger.h
# Include/GameLogic/PolygonTrigger.h
Include/GameLogic/Powers.h
# Include/GameLogic/RankInfo.h
Include/GameLogic/ScriptActions.h
Include/GameLogic/ScriptConditions.h
Include/GameLogic/ScriptEngine.h
Include/GameLogic/Scripts.h
Include/GameLogic/SidesList.h
# Include/GameLogic/SidesList.h
Include/GameLogic/Squad.h
Include/GameLogic/TerrainLogic.h
# Include/GameLogic/TerrainLogic.h
Include/GameLogic/TurretAI.h
Include/GameLogic/VictoryConditions.h
Include/GameLogic/Weapon.h
Expand Down Expand Up @@ -787,9 +787,9 @@ set(GAMEENGINE_SRC
Source/GameLogic/AI/AITNGuard.cpp
Source/GameLogic/AI/Squad.cpp
Source/GameLogic/AI/TurretAI.cpp
Source/GameLogic/Map/PolygonTrigger.cpp
Source/GameLogic/Map/SidesList.cpp
Source/GameLogic/Map/TerrainLogic.cpp
# Source/GameLogic/Map/PolygonTrigger.cpp
# Source/GameLogic/Map/SidesList.cpp
# Source/GameLogic/Map/TerrainLogic.cpp
Source/GameLogic/Object/Armor.cpp
Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp
Source/GameLogic/Object/Behavior/BehaviorModule.cpp
Expand Down
124 changes: 0 additions & 124 deletions Generals/Code/GameEngine/Include/Common/MapReaderWriterInfo.h

This file was deleted.

Loading