From c66cb8dc0514b5c8c6adcab31aaf86b8acd22244 Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Tue, 11 Jun 2024 16:42:20 +0100 Subject: [PATCH] [TD] Add handling of cell coords to BaseClass::Read_INI. --- tiberiandawn/base.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tiberiandawn/base.cpp b/tiberiandawn/base.cpp index 568c20e7..36f2c257 100644 --- a/tiberiandawn/base.cpp +++ b/tiberiandawn/base.cpp @@ -169,6 +169,18 @@ void BaseClass::Read_INI(CCINIClass& ini) ** Read & set the node's coordinate */ node.Coord = atol(strtok(NULL, ",")); + +#ifdef MEGAMAPS + if (Map.MapBinaryVersion != MAP_VERSION_MEGA) { + int x = Coord_X(node.Coord); + int y = Coord_Y(node.Coord); + x >>= 8; + y >>= 8; + CELL cell = XY_Cell(x, y); + cell = Confine_Old_Cell(cell); + node.Coord = Cell_Coord(cell); + } +#endif /* ** Add this node to the Base's list