Fix crashes in arena profiling mode

Notice: you need to merge arena_ai_profiling into here to test
This commit is contained in:
Benau 2016-05-21 01:11:37 +08:00
parent 0f9438d824
commit 390f45a9d1

View File

@ -155,9 +155,6 @@ const std::string& SoccerWorld::getIdent() const
*/
void SoccerWorld::update(float dt)
{
WorldWithRank::update(dt);
WorldWithRank::updateTrack(dt);
updateBallPosition(dt);
if (m_track->hasNavMesh())
{
@ -165,6 +162,9 @@ void SoccerWorld::update(float dt)
updateAIData();
}
WorldWithRank::update(dt);
WorldWithRank::updateTrack(dt);
if (getPhase() == World::GOAL_PHASE)
{
if (m_goal_timer == 0.0f)
@ -589,7 +589,14 @@ void SoccerWorld::setAITeam()
for (int i = 0; i < total_player; i++)
{
SoccerTeam team = race_manager->getKartInfo(i).getSoccerTeam();
assert(team != SOCCER_TEAM_NONE);
// Happen in profiling mode
if (team == SOCCER_TEAM_NONE);
{
race_manager->setKartSoccerTeam(i, SOCCER_TEAM_BLUE);
team = SOCCER_TEAM_BLUE;
}
team == SOCCER_TEAM_BLUE ? blue_player++ : red_player++;
}