File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
GeneralsMD/Code/GameEngine/Source/GameLogic/System
Generals/Code/GameEngine/Source/GameLogic/System Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -784,6 +784,8 @@ static void populateRandomSideAndColor( GameInfo *game )
784
784
785
785
// ------------------------------------------------------------------------------------------------
786
786
// ------------------------------------------------------------------------------------------------
787
+ static const WaypointMap s_emptyWaypoints = WaypointMap();
788
+
787
789
static void populateRandomStartPosition ( GameInfo *game )
788
790
{
789
791
if (!game)
@@ -804,12 +806,13 @@ static void populateRandomStartPosition( GameInfo *game )
804
806
{
805
807
if (i != j && (i<numPlayers && j<numPlayers))
806
808
{
809
+ const WaypointMap& waypoints = md ? md->m_waypoints : s_emptyWaypoints;
807
810
AsciiString w1, w2;
808
811
w1.format (" Player_%d_Start" , i+1 );
809
812
w2.format (" Player_%d_Start" , j+1 );
810
- WaypointMap::const_iterator c1 = md-> m_waypoints .find (w1);
811
- WaypointMap::const_iterator c2 = md-> m_waypoints .find (w2);
812
- if (c1 == md-> m_waypoints .end () || c2 == md-> m_waypoints .end ())
813
+ WaypointMap::const_iterator c1 = waypoints .find (w1);
814
+ WaypointMap::const_iterator c2 = waypoints .find (w2);
815
+ if (c1 == waypoints .end () || c2 == waypoints .end ())
813
816
{
814
817
// couldn't find a waypoint. must be kinda far away.
815
818
startSpotDistance[i][j] = 1000000 .0f ;
Original file line number Diff line number Diff line change @@ -829,6 +829,8 @@ static void populateRandomSideAndColor( GameInfo *game )
829
829
830
830
// ------------------------------------------------------------------------------------------------
831
831
// ------------------------------------------------------------------------------------------------
832
+ static const WaypointMap s_emptyWaypoints = WaypointMap();
833
+
832
834
static void populateRandomStartPosition ( GameInfo *game )
833
835
{
834
836
if (!game)
@@ -849,12 +851,13 @@ static void populateRandomStartPosition( GameInfo *game )
849
851
{
850
852
if (i != j && (i<numPlayers && j<numPlayers))
851
853
{
854
+ const WaypointMap& waypoints = md ? md->m_waypoints : s_emptyWaypoints;
852
855
AsciiString w1, w2;
853
856
w1.format (" Player_%d_Start" , i+1 );
854
857
w2.format (" Player_%d_Start" , j+1 );
855
- WaypointMap::const_iterator c1 = md-> m_waypoints .find (w1);
856
- WaypointMap::const_iterator c2 = md-> m_waypoints .find (w2);
857
- if (c1 == md-> m_waypoints .end () || c2 == md-> m_waypoints .end ())
858
+ WaypointMap::const_iterator c1 = waypoints .find (w1);
859
+ WaypointMap::const_iterator c2 = waypoints .find (w2);
860
+ if (c1 == waypoints .end () || c2 == waypoints .end ())
858
861
{
859
862
// couldn't find a waypoint. must be kinda far away.
860
863
startSpotDistance[i][j] = 1000000 .0f ;
You can’t perform that action at this time.
0 commit comments