Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,8 @@ static void populateRandomSideAndColor( GameInfo *game )

// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
static const WaypointMap s_emptyWaypoints = WaypointMap();

static void populateRandomStartPosition( GameInfo *game )
{
if(!game)
Expand All @@ -804,12 +806,13 @@ static void populateRandomStartPosition( GameInfo *game )
{
if (i != j && (i<numPlayers && j<numPlayers))
{
const WaypointMap& waypoints = md ? md->m_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;
Expand Down Expand Up @@ -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; i<count; ++i)
Expand Down
22 changes: 14 additions & 8 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ static void populateRandomSideAndColor( GameInfo *game )

// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
static const WaypointMap s_emptyWaypoints = WaypointMap();

static void populateRandomStartPosition( GameInfo *game )
{
if(!game)
Expand All @@ -849,12 +851,13 @@ static void populateRandomStartPosition( GameInfo *game )
{
if (i != j && (i<numPlayers && j<numPlayers))
{
const WaypointMap& waypoints = md ? md->m_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;
Expand Down Expand Up @@ -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<count; ++i)
Expand Down
Loading