diff --git a/src/config/saved_grand_prix.cpp b/src/config/saved_grand_prix.cpp index e80714edd..9059ba5cf 100644 --- a/src/config/saved_grand_prix.cpp +++ b/src/config/saved_grand_prix.cpp @@ -140,9 +140,15 @@ void SavedGrandPrix::setKarts(const std::vector &kart_l } } // setKarts +/* compares two KartStatus-objects for std::sort in the next function */ +bool cmp__l(RaceManager::KartStatus first, RaceManager::KartStatus second) +{ + return (first.m_score > second.m_score); +} //------------------------------------------------------------------------------ void SavedGrandPrix::loadKarts(std::vector & kart_list) { + int aikarts = 0; for(unsigned int i = 0; i < m_karts.size(); i++) { @@ -169,4 +175,6 @@ void SavedGrandPrix::loadKarts(std::vector & kart_list) } // for x } // if m_local_player_id == -1 } // for i + + std::sort(kart_list.begin(), kart_list.end(), cmp__l); } // loadKarts diff --git a/src/config/saved_grand_prix.hpp b/src/config/saved_grand_prix.hpp index f06f0ff0c..746132fa2 100644 --- a/src/config/saved_grand_prix.hpp +++ b/src/config/saved_grand_prix.hpp @@ -19,11 +19,13 @@ #ifndef HEADER_SAVED_GRAND_PRIX_HPP #define HEADER_SAVED_GRAND_PRIX_HPP -#include #include "config/user_config.hpp" #include "race/race_manager.hpp" #include "utils/ptr_vector.hpp" +#include +#include + class RaceManager; // ============================================================================ @@ -151,7 +153,6 @@ public: return NULL; } // getSavedGP // ------------------------------------------------------------------------ - }; // class SavedGrandPrix #endif diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index 11bdfe29b..ee8e3d2ed 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -362,7 +362,7 @@ void RaceManager::startNew(bool from_overworld) init_gp_rank ++; } - if (MAJOR_MODE_GRAND_PRIX) + if (m_major_mode == MAJOR_MODE_GRAND_PRIX) { if (m_continue_saved_gp) {