diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 3881db0cb62..dcc23721d5b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -784,6 +784,8 @@ static void populateRandomSideAndColor( GameInfo *game ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ +static const WaypointMap s_emptyWaypoints = WaypointMap(); + static void populateRandomStartPosition( GameInfo *game ) { if(!game) @@ -804,12 +806,13 @@ static void populateRandomStartPosition( GameInfo *game ) { if (i != j && (im_waypoints : s_emptyWaypoints; AsciiString w1, w2; w1.format("Player_%d_Start", i+1); w2.format("Player_%d_Start", j+1); - WaypointMap::const_iterator c1 = md->m_waypoints.find(w1); - WaypointMap::const_iterator c2 = md->m_waypoints.find(w2); - if (c1 == md->m_waypoints.end() || c2 == md->m_waypoints.end()) + WaypointMap::const_iterator c1 = waypoints.find(w1); + WaypointMap::const_iterator c2 = waypoints.find(w2); + if (c1 == waypoints.end() || c2 == waypoints.end()) { // couldn't find a waypoint. must be kinda far away. startSpotDistance[i][j] = 1000000.0f; @@ -1409,12 +1412,15 @@ void GameLogic::startNewGame( Bool saveGame ) if (count) { ScriptList *pSL = TheSidesList->getSideInfo(0)->getScriptList(); - Script *next = scripts[0]->getScript(); - while (next) + if (pSL != NULL) { - Script *dupe = next->duplicate(); - pSL->addScript(dupe, 0); - next = next->getNext(); + Script *next = scripts[0]->getScript(); + while (next) + { + Script *dupe = next->duplicate(); + pSL->addScript(dupe, 0); + next = next->getNext(); + } } } for (Int i=0; im_waypoints : s_emptyWaypoints; AsciiString w1, w2; w1.format("Player_%d_Start", i+1); w2.format("Player_%d_Start", j+1); - WaypointMap::const_iterator c1 = md->m_waypoints.find(w1); - WaypointMap::const_iterator c2 = md->m_waypoints.find(w2); - if (c1 == md->m_waypoints.end() || c2 == md->m_waypoints.end()) + WaypointMap::const_iterator c1 = waypoints.find(w1); + WaypointMap::const_iterator c2 = waypoints.find(w2); + if (c1 == waypoints.end() || c2 == waypoints.end()) { // couldn't find a waypoint. must be kinda far away. startSpotDistance[i][j] = 1000000.0f; @@ -1571,12 +1574,15 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if (count) { ScriptList *pSL = TheSidesList->getSideInfo(0)->getScriptList(); - Script *next = scripts[0]->getScript(); - while (next) + if (pSL != NULL) { - Script *dupe = next->duplicate(); - pSL->addScript(dupe, 0); - next = next->getNext(); + Script *next = scripts[0]->getScript(); + while (next) + { + Script *dupe = next->duplicate(); + pSL->addScript(dupe, 0); + next = next->getNext(); + } } } for (Int i=0; i