From ca2a1c3671274e4d22949d2b6ec042df992e312c Mon Sep 17 00:00:00 2001 From: deveee Date: Wed, 16 Oct 2013 12:48:31 +0000 Subject: [PATCH] Replace a kart in saved grand prix only if this kart exist. We should avoid situation when for example add-on kart was uninstalled. Now when not exist, these karts are random. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14272 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/config/saved_grand_prix.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config/saved_grand_prix.cpp b/src/config/saved_grand_prix.cpp index 06ed1a188..21d581b0c 100644 --- a/src/config/saved_grand_prix.cpp +++ b/src/config/saved_grand_prix.cpp @@ -19,6 +19,7 @@ #include "config/saved_grand_prix.hpp" +#include "karts/kart_properties_manager.hpp" #include "utils/ptr_vector.hpp" #include "utils/string_utils.hpp" @@ -145,10 +146,12 @@ void SavedGrandPrix::loadKarts(std::vector & kart_list) int aikarts = 0; for(int i = 0; i < m_karts.size(); i++) { + const KartProperties *kp = kart_properties_manager->getKart(m_karts[i].m_ident); + if(m_karts[i].m_local_player_id == -1) { //AI kart found - kart_list[aikarts].m_ident = m_karts[i].m_ident; + if(kp) kart_list[aikarts].m_ident = m_karts[i].m_ident; kart_list[aikarts].m_score = m_karts[i].m_score; kart_list[aikarts].m_overall_time = m_karts[i].m_overall_time; aikarts++;