the difficulty setting in the race setup menu is now taken into consideration
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3345 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
199baee176
commit
054b656701
@ -10,6 +10,7 @@
|
|||||||
#include "main_loop.hpp"
|
#include "main_loop.hpp"
|
||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
|
#include "user_config.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -112,9 +113,30 @@ namespace StateManager
|
|||||||
*/
|
*/
|
||||||
void menuEventRaceSetup(GUIEngine::Widget* widget, std::string& name)
|
void menuEventRaceSetup(GUIEngine::Widget* widget, std::string& name)
|
||||||
{
|
{
|
||||||
// TODO - detect difficulty, allow more game modes
|
if(name == "init")
|
||||||
if(name == "gamemode")
|
|
||||||
{
|
{
|
||||||
|
GUIEngine::RibbonWidget* w = dynamic_cast<GUIEngine::RibbonWidget*>
|
||||||
|
(GUIEngine::getCurrentScreen()->getWidget("difficulty"));
|
||||||
|
assert( w != NULL );
|
||||||
|
w->setSelection(user_config->getDefaultDifficulty());
|
||||||
|
race_manager->setDifficulty( (RaceManager::Difficulty)user_config->getDefaultDifficulty() );
|
||||||
|
}
|
||||||
|
else if(name == "difficulty")
|
||||||
|
{
|
||||||
|
GUIEngine::RibbonWidget* w = dynamic_cast<GUIEngine::RibbonWidget*>(widget);
|
||||||
|
assert(w != NULL);
|
||||||
|
const std::string& selection = w->getSelectionName();
|
||||||
|
|
||||||
|
if(selection == "novice")
|
||||||
|
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||||
|
else if(selection == "intermediate")
|
||||||
|
race_manager->setDifficulty(RaceManager::RD_MEDIUM);
|
||||||
|
else if(selection == "expert")
|
||||||
|
race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||||
|
}
|
||||||
|
else if(name == "gamemode")
|
||||||
|
{
|
||||||
|
// TODO - detect more game modes
|
||||||
GUIEngine::RibbonWidget* w = dynamic_cast<GUIEngine::RibbonWidget*>(widget);
|
GUIEngine::RibbonWidget* w = dynamic_cast<GUIEngine::RibbonWidget*>(widget);
|
||||||
if(w->getSelectionName() == "normal")
|
if(w->getSelectionName() == "normal")
|
||||||
{
|
{
|
||||||
@ -202,7 +224,7 @@ namespace StateManager
|
|||||||
|
|
||||||
StateManager::enterGameState();
|
StateManager::enterGameState();
|
||||||
race_manager->setLocalKartInfo(0, "tux");
|
race_manager->setLocalKartInfo(0, "tux");
|
||||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
//race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||||
race_manager->setTrack("beach");
|
race_manager->setTrack("beach");
|
||||||
race_manager->setNumLaps( 3 );
|
race_manager->setNumLaps( 3 );
|
||||||
race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge
|
race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge
|
||||||
|
@ -225,6 +225,8 @@ namespace GUIEngine
|
|||||||
virtual ~RibbonWidget() {}
|
virtual ~RibbonWidget() {}
|
||||||
|
|
||||||
int getSelection() const { return m_selection; }
|
int getSelection() const { return m_selection; }
|
||||||
|
void setSelection(const int i) { m_selection = i; updateSelection(); }
|
||||||
|
|
||||||
RibbonType getRibbonType() const { return m_ribbon_type; }
|
RibbonType getRibbonType() const { return m_ribbon_type; }
|
||||||
const std::string& getSelectionName() { return m_children[m_selection].m_properties[PROP_ID]; }
|
const std::string& getSelectionName() { return m_children[m_selection].m_properties[PROP_ID]; }
|
||||||
void select(std::string item);
|
void select(std::string item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user