From bbbe0ddf8d74c3a3503c2eadb3e0d655e1117750 Mon Sep 17 00:00:00 2001 From: Marc Coll Carrillo Date: Fri, 19 Sep 2014 23:25:03 +0200 Subject: [PATCH 1/2] Fix issues with the new "reverse grand prix" feature and user defined GPs --- src/race/grand_prix_data.cpp | 10 ++++++++-- src/race/grand_prix_data.hpp | 3 ++- src/states_screens/gp_info_screen.cpp | 21 ++++++++++----------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/race/grand_prix_data.cpp b/src/race/grand_prix_data.cpp index 2c0f01ac6..f7fac4613 100644 --- a/src/race/grand_prix_data.cpp +++ b/src/race/grand_prix_data.cpp @@ -158,14 +158,20 @@ void GrandPrixData::changeReverse(const GrandPrixData::GPReverseType use_reverse for (unsigned int i = 0; i < m_tracks.size(); i++) { if (use_reverse == GP_NO_REVERSE) + { m_reversed[i] = false; + } + else if (use_reverse == GP_ALL_REVERSE) // all reversed + { + m_reversed[i] = track_manager->getTrack(m_tracks[i])->reverseAvailable(); + } else if (use_reverse == GP_RANDOM_REVERSE) + { if (track_manager->getTrack(m_tracks[i])->reverseAvailable()) m_reversed[i] = (rand() % 2 != 0); else m_reversed[i] = false; - else // all reversed - m_reversed[i] = track_manager->getTrack(m_tracks[i])->reverseAvailable(); + } } // for i < m_tracks.size() } // changeReverse diff --git a/src/race/grand_prix_data.hpp b/src/race/grand_prix_data.hpp index 47ceb268e..81f9d7726 100644 --- a/src/race/grand_prix_data.hpp +++ b/src/race/grand_prix_data.hpp @@ -90,7 +90,8 @@ public: { GP_NO_REVERSE = 0, GP_ALL_REVERSE = 1, - GP_RANDOM_REVERSE = 2 + GP_RANDOM_REVERSE = 2, + GP_DEFAULT_REVERSE = 3 }; // GPReverseType public: diff --git a/src/states_screens/gp_info_screen.cpp b/src/states_screens/gp_info_screen.cpp index 967d7f1e5..abef60921 100644 --- a/src/states_screens/gp_info_screen.cpp +++ b/src/states_screens/gp_info_screen.cpp @@ -71,8 +71,9 @@ void GPInfoScreen::loadedFromFile() // (since the groups can change if addons are added/deleted). m_group_spinner = getWidget("group-spinner"); m_reverse_spinner = getWidget("reverse-spinner"); - m_reverse_spinner->addLabel(_("No")); - m_reverse_spinner->addLabel(_("Yes")); + m_reverse_spinner->addLabel(_("Default")); + m_reverse_spinner->addLabel(_("None")); + m_reverse_spinner->addLabel(_("All")); m_reverse_spinner->addLabel(_("Random")); m_reverse_spinner->setValue(0); @@ -108,13 +109,14 @@ GrandPrixData::GPReverseType GPInfoScreen::getReverse() const { switch (m_reverse_spinner->getValue()) { - case 0: return GrandPrixData::GP_NO_REVERSE; break; - case 1: return GrandPrixData::GP_ALL_REVERSE; break; - case 2: return GrandPrixData::GP_RANDOM_REVERSE; break; - default: assert(false); + case 0: return GrandPrixData::GP_DEFAULT_REVERSE; break; + case 1: return GrandPrixData::GP_NO_REVERSE; break; + case 2: return GrandPrixData::GP_ALL_REVERSE; break; + case 3: return GrandPrixData::GP_RANDOM_REVERSE; break; + default: assert(false); } // switch // Avoid compiler warning - return GrandPrixData::GP_NO_REVERSE; + return GrandPrixData::GP_DEFAULT_REVERSE; } // getReverse // ---------------------------------------------------------------------------- void GPInfoScreen::beforeAddingWidget() @@ -296,6 +298,7 @@ void GPInfoScreen::eventCallback(Widget *, const std::string &name, // Normal GP: start/continue a saved GP int n = getWidget("ai-spinner")->getValue(); + m_gp.changeReverse(getReverse()); race_manager->setNumKarts(race_manager->getNumLocalPlayers() + n); race_manager->startGP(m_gp, false, (name == "continue")); } @@ -326,10 +329,6 @@ void GPInfoScreen::eventCallback(Widget *, const std::string &name, m_gp.changeTrackNumber(m_num_tracks_spinner->getValue(), m_group_name); addTracks(); } - else if (name=="reverse-spinner") - { - m_gp.changeReverse(getReverse()); - } else if(name=="back") { StateManager::get()->escapePressed(); From 8eb51f78b42d1492a8f0fd42ba81005776dbd186 Mon Sep 17 00:00:00 2001 From: deve Date: Tue, 23 Sep 2014 09:11:39 +0200 Subject: [PATCH 2/2] Fixed warning in cmake 3.0 and above. If I understand correctly, the COMPILE_DEFINITIONS_DEBUG property is ignored in newer versions of cmake. I fixed it by forcing to use old method. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8987b6107..57889dbb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(SuperTuxKart) set(PROJECT_VERSION "0.8.1") cmake_minimum_required(VERSION 2.8.1) +cmake_policy(SET CMP0043 OLD) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") include(BuildTypeSTKRelease)