Correct track choosing logic in demoworld
* Overworld could be picked * If user gave one arena track as choice, things would crash Also fix some comments. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11383 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -397,11 +397,14 @@ const std::vector<int> KartPropertiesManager::getKartsInGroup(
|
||||
* of 'existing karts'. If not enough karts are available in the current
|
||||
* group, karts from all other groups are used to fill up the list.
|
||||
* This is used by the race manager to select the AI karts.
|
||||
* \param count Number of karts to select randomly.
|
||||
* \param existing_karst List of karts that should not be used. This is the
|
||||
* \param count Number of karts to select randomly.
|
||||
* \param existing_karts List of karts that should not be used. This is the
|
||||
* list of karts selected by the players.
|
||||
* \param ai_list List of AI karts already selected (eg through the
|
||||
* command line). The random AIs will also be added
|
||||
* to this list.
|
||||
*/
|
||||
void KartPropertiesManager::getRandomKartList(int count,
|
||||
void KartPropertiesManager::getRandomKartList(int count,
|
||||
RemoteKartInfoList& existing_karts,
|
||||
std::vector<std::string> *ai_list)
|
||||
{
|
||||
|
||||
@@ -108,9 +108,11 @@ bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
|
||||
if(m_demo_tracks.size()==0)
|
||||
m_demo_tracks = track_manager->getAllTrackIdentifiers();
|
||||
Track *track = track_manager->getTrack(m_demo_tracks[0]);
|
||||
// Remove arena tracks (outside the if statement above in case that
|
||||
// a user requests a arena track ;) )
|
||||
while((!track || track->isArena()) && m_demo_tracks.size()>1)
|
||||
// Remove arena tracks and internal tracks like the overworld
|
||||
// (outside the if statement above in case that
|
||||
// a user requests one of those ;) )
|
||||
while((!track || track->isArena() || track->isInternal())
|
||||
&& m_demo_tracks.size() > 0)
|
||||
{
|
||||
if(!track)
|
||||
printf("Invalid demo track identifier '%s'.\n",
|
||||
@@ -118,6 +120,9 @@ bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
|
||||
m_demo_tracks.erase(m_demo_tracks.begin());
|
||||
track = track_manager->getTrack(m_demo_tracks[0]);
|
||||
}
|
||||
// If all user request tracks are bad and get removed, this will
|
||||
// return false. When the next update triggers, the track list will
|
||||
// be filled up with all the tracks.
|
||||
if(m_demo_tracks.size()==0)
|
||||
{
|
||||
printf("No valid tracks found, no demo started.\n");
|
||||
@@ -145,4 +150,4 @@ bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
|
||||
m_demo_tracks.erase(m_demo_tracks.begin());
|
||||
|
||||
return true;
|
||||
} // updateIdleTime
|
||||
} // updateIdleTimeAndStartDemo
|
||||
|
||||
@@ -490,7 +490,7 @@ public:
|
||||
video::SColor getFogColor() const { return m_fog_color; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Whether this is an "internal" track. If so it won't be offered
|
||||
* in the track seelction screen. */
|
||||
* in the track selection screen. */
|
||||
bool isInternal() const { return m_internal; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the normals of this track can be smoothed. */
|
||||
|
||||
Reference in New Issue
Block a user