From 31eebdb70e093ac6b6671423dd824c41780a9f41 Mon Sep 17 00:00:00 2001 From: 6emmes <27066734+6emmes@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:31:09 +0100 Subject: [PATCH 1/2] Fix map waypoint loading Fixes #1053 --- src/game/client/maputil.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/client/maputil.cpp b/src/game/client/maputil.cpp index 90bbefd4e..822ff43c7 100644 --- a/src/game/client/maputil.cpp +++ b/src/game/client/maputil.cpp @@ -114,7 +114,7 @@ void WaypointMap::Update() key_name.Format("Player_%d_Start", i); it = g_waypoints->find(key_name); - if (it != g_waypoints->end()) { + if (it == g_waypoints->end()) { break; } @@ -431,7 +431,7 @@ bool Parse_Object_Data_Chunk(DataChunkInput &input, DataChunkInfo *info, void *d if (object->Get_Properties()->Get_Type(g_waypointIDKey) == Dict::DICT_INT) { object->Set_Is_Waypoint(); - (*s_waypoints)[object->Get_Waypoint_Name()] = loc; + (*g_waypoints)[object->Get_Waypoint_Name()] = loc; } else if (object->Get_Thing_Template() != nullptr && object->Get_Thing_Template()->Is_KindOf(KINDOF_TECH_BUILDING)) { s_techPositions.push_back(loc); } else if (object->Get_Thing_Template() != nullptr) { @@ -470,7 +470,7 @@ bool Load_Map(Utf8String name) if (stream.Open(name_copy2)) { DataChunkInput input(&stream); - s_waypoints = new WaypointMap(); + g_waypoints = new WaypointMap(); input.Register_Parser("HeightMapData", Utf8String::s_emptyString, Parse_Size_Only_In_Chunk, nullptr); input.Register_Parser("WorldInfo", Utf8String::s_emptyString, Parse_World_Dict_Data_Chunk, nullptr); input.Register_Parser("ObjectsList", Utf8String::s_emptyString, Parse_Objects_Data_Chunk, nullptr); @@ -528,9 +528,9 @@ unsigned int Calc_CRC(Utf8String dir, Utf8String name) void Reset_Map() { - if (s_waypoints != nullptr) { - delete s_waypoints; - s_waypoints = nullptr; + if (g_waypoints != nullptr) { + delete g_waypoints; + g_waypoints = nullptr; } s_techPositions.clear(); From 05d879b1de6d09762cad67029d7f2ff00d6aefe8 Mon Sep 17 00:00:00 2001 From: 6emmes <27066734+6emmes@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:35:19 +0100 Subject: [PATCH 2/2] removed s_waypoints --- src/game/client/maputil.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/game/client/maputil.cpp b/src/game/client/maputil.cpp index 822ff43c7..d9a67671f 100644 --- a/src/game/client/maputil.cpp +++ b/src/game/client/maputil.cpp @@ -34,8 +34,8 @@ #include #ifndef GAME_DLL -WaypointMap *g_waypoints; -MapCache *g_theMapCache; +WaypointMap *g_waypoints = nullptr; +MapCache *g_theMapCache = nullptr; #endif static std::vector s_boundaries; @@ -45,7 +45,6 @@ static std::list s_techPositions; static unsigned int s_width = 0; static unsigned int s_height = 0; static int s_borderSize = 0; -static WaypointMap *s_waypoints = nullptr; static int s_mapDX = 0; static int s_mapDY = 0;