3434#include < algorithm>
3535
3636#ifndef GAME_DLL
37- WaypointMap *g_waypoints;
38- MapCache *g_theMapCache;
37+ WaypointMap *g_waypoints = nullptr ;
38+ MapCache *g_theMapCache = nullptr ;
3939#endif
4040
4141static std::vector<ICoord2D> s_boundaries;
@@ -45,7 +45,6 @@ static std::list<Coord3D> s_techPositions;
4545static unsigned int s_width = 0 ;
4646static unsigned int s_height = 0 ;
4747static int s_borderSize = 0 ;
48- static WaypointMap *s_waypoints = nullptr ;
4948static int s_mapDX = 0 ;
5049static int s_mapDY = 0 ;
5150
@@ -114,7 +113,7 @@ void WaypointMap::Update()
114113 key_name.Format (" Player_%d_Start" , i);
115114 it = g_waypoints->find (key_name);
116115
117- if (it ! = g_waypoints->end ()) {
116+ if (it = = g_waypoints->end ()) {
118117 break ;
119118 }
120119
@@ -431,7 +430,7 @@ bool Parse_Object_Data_Chunk(DataChunkInput &input, DataChunkInfo *info, void *d
431430
432431 if (object->Get_Properties ()->Get_Type (g_waypointIDKey) == Dict::DICT_INT) {
433432 object->Set_Is_Waypoint ();
434- (*s_waypoints )[object->Get_Waypoint_Name ()] = loc;
433+ (*g_waypoints )[object->Get_Waypoint_Name ()] = loc;
435434 } else if (object->Get_Thing_Template () != nullptr && object->Get_Thing_Template ()->Is_KindOf (KINDOF_TECH_BUILDING)) {
436435 s_techPositions.push_back (loc);
437436 } else if (object->Get_Thing_Template () != nullptr ) {
@@ -470,7 +469,7 @@ bool Load_Map(Utf8String name)
470469
471470 if (stream.Open (name_copy2)) {
472471 DataChunkInput input (&stream);
473- s_waypoints = new WaypointMap ();
472+ g_waypoints = new WaypointMap ();
474473 input.Register_Parser (" HeightMapData" , Utf8String::s_emptyString, Parse_Size_Only_In_Chunk, nullptr );
475474 input.Register_Parser (" WorldInfo" , Utf8String::s_emptyString, Parse_World_Dict_Data_Chunk, nullptr );
476475 input.Register_Parser (" ObjectsList" , Utf8String::s_emptyString, Parse_Objects_Data_Chunk, nullptr );
@@ -528,9 +527,9 @@ unsigned int Calc_CRC(Utf8String dir, Utf8String name)
528527
529528void Reset_Map ()
530529{
531- if (s_waypoints != nullptr ) {
532- delete s_waypoints ;
533- s_waypoints = nullptr ;
530+ if (g_waypoints != nullptr ) {
531+ delete g_waypoints ;
532+ g_waypoints = nullptr ;
534533 }
535534
536535 s_techPositions.clear ();
0 commit comments