From 1bb0be6a8cbadf424adda4cbadbddca437967e67 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 5 Oct 2018 00:58:46 +0800 Subject: [PATCH] Fix crash for deve's soccer arena without navmesh --- src/modes/soccer_world.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modes/soccer_world.cpp b/src/modes/soccer_world.cpp index 012f136fb..b1f590ea2 100644 --- a/src/modes/soccer_world.cpp +++ b/src/modes/soccer_world.cpp @@ -213,11 +213,11 @@ const std::string& SoccerWorld::getIdent() const void SoccerWorld::update(int ticks) { updateBallPosition(ticks); - updateSectorForKarts(); - if (Track::getCurrentTrack()->hasNavMesh() && - !NetworkConfig::get()->isNetworking()) + if (Track::getCurrentTrack()->hasNavMesh()) { - updateAIData(); + updateSectorForKarts(); + if (!NetworkConfig::get()->isNetworking()) + updateAIData(); } WorldWithRank::update(ticks); @@ -652,6 +652,9 @@ int SoccerWorld::getAttacker(KartTeam team) const //----------------------------------------------------------------------------- unsigned int SoccerWorld::getRescuePositionIndex(AbstractKart *kart) { + if (!Track::getCurrentTrack()->hasNavMesh()) + return m_kart_position_map.at(kart->getWorldKartId()); + int last_valid_node = getTrackSector(kart->getWorldKartId())->getLastValidGraphNode(); if (last_valid_node >= 0) @@ -663,6 +666,9 @@ unsigned int SoccerWorld::getRescuePositionIndex(AbstractKart *kart) //----------------------------------------------------------------------------- btTransform SoccerWorld::getRescueTransform(unsigned int rescue_pos) const { + if (!Track::getCurrentTrack()->hasNavMesh()) + return WorldWithRank::getRescueTransform(rescue_pos); + const Vec3 &xyz = Graph::get()->getQuad(rescue_pos)->getCenter(); const Vec3 &normal = Graph::get()->getQuad(rescue_pos)->getNormal(); btTransform pos;