From 6ad54434e0053233337ebaae5e0373ddf3d165d7 Mon Sep 17 00:00:00 2001 From: auria Date: Mon, 3 Jan 2011 18:23:52 +0000 Subject: [PATCH] Correct a few FIXMEs + minor style improvements git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7227 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/race/race_manager.hpp | 13 ++++++++++ src/states_screens/race_result_gui.cpp | 6 +---- src/states_screens/race_setup_screen.cpp | 30 ++++++++++++------------ src/tracks/quad_graph.cpp | 1 - src/tracks/quad_set.cpp | 10 ++++---- src/tracks/track.cpp | 6 +++-- src/tracks/track_object.cpp | 3 --- src/utils/translation.cpp | 3 +-- 8 files changed, 39 insertions(+), 33 deletions(-) diff --git a/src/race/race_manager.hpp b/src/race/race_manager.hpp index b3d2b123e..694fe9dae 100644 --- a/src/race/race_manager.hpp +++ b/src/race/race_manager.hpp @@ -151,6 +151,19 @@ public: } } + static bool hasAI(const MinorRaceModeType mode) + { + switch (mode) + { + case MINOR_MODE_NORMAL_RACE: return true; + case MINOR_MODE_TIME_TRIAL: return true; + case MINOR_MODE_FOLLOW_LEADER: return true; + case MINOR_MODE_3_STRIKES: return false; + default: assert(false); return NULL; + } + } + + // ------------------------------------------------------------------------ /** Returns the minor mode id from a string identifier. This function is * used from challenge_data, which reads the mode from a challenge file. diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 370f9d325..202a1da2f 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -26,17 +26,13 @@ #include "io/file_manager.hpp" #include "modes/world_with_rank.hpp" #include "states_screens/dialogs/race_over_dialog.hpp" +#include "states_screens/feature_unlocked.hpp" #include "states_screens/main_menu_screen.hpp" #include "states_screens/race_setup_screen.hpp" #include "utils/string_utils.hpp" DEFINE_SCREEN_SINGLETON( RaceResultGUI ); -// FIXME: debug only!!!!!!!!! -#include "karts/kart_properties_manager.hpp" -#include "states_screens/feature_unlocked.hpp" -// FIXME: debug end - /** Constructor, initialises internal data structures. */ RaceResultGUI::RaceResultGUI() : Screen("race_result.stkgui", /*pause race*/ false) diff --git a/src/states_screens/race_setup_screen.cpp b/src/states_screens/race_setup_screen.cpp index 00eda04b4..83f6cf82e 100644 --- a/src/states_screens/race_setup_screen.cpp +++ b/src/states_screens/race_setup_screen.cpp @@ -99,19 +99,19 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con DynamicRibbonWidget* w = dynamic_cast(widget); const std::string selectedMode = w->getSelectionIDString(PLAYER_ID_GAME_MASTER); - if (selectedMode == "normal") + if (selectedMode == IDENT_STD) { race_manager->setMinorMode(RaceManager::MINOR_MODE_NORMAL_RACE); UserConfigParams::m_game_mode = CONFIG_CODE_NORMAL; StateManager::get()->pushScreen( TracksScreen::getInstance() ); } - else if (selectedMode == "timetrial") + else if (selectedMode == IDENT_TTRIAL) { race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL); UserConfigParams::m_game_mode = CONFIG_CODE_TIMETRIAL; StateManager::get()->pushScreen( TracksScreen::getInstance() ); } - else if (selectedMode == "ftl") + else if (selectedMode == FTL_IDENT) { // Make sure there are at least three karts, otherwise FTL doesn't if(race_manager->getNumberOfKarts()<3) @@ -121,7 +121,7 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con UserConfigParams::m_game_mode = CONFIG_CODE_FTL; StateManager::get()->pushScreen( TracksScreen::getInstance() ); } - else if (selectedMode == "3strikes") + else if (selectedMode == STRIKES_IDENT) { race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES); UserConfigParams::m_game_mode = CONFIG_CODE_3STRIKES; @@ -148,12 +148,12 @@ void RaceSetupScreen::onGameModeChanged() DynamicRibbonWidget* w2 = getWidget("gamemode"); assert( w2 != NULL ); - std::string gamemode = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER); + std::string gamemode_str = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER); + RaceManager::MinorRaceModeType gamemode = RaceManager::getModeIDFromInternalName(gamemode_str.c_str()); // deactivate the AI karts count widget for modes for which we have no AI - //FIXME? Don't hardcode here which modes have an AI and which don't SpinnerWidget* kartamount = getWidget("aikartamount"); - if (gamemode == "3strikes") + if (!RaceManager::hasAI(gamemode)) { kartamount->setDeactivated(); @@ -199,13 +199,13 @@ void RaceSetupScreen::init() //FIXME: avoid duplicating descriptions from the help menu! name1 += _("All blows allowed, so catch weapons and make clever use of them!"); - w2->addItem( name1, "normal", RaceManager::getIconOf(RaceManager::MINOR_MODE_NORMAL_RACE)); + w2->addItem( name1, IDENT_STD, RaceManager::getIconOf(RaceManager::MINOR_MODE_NORMAL_RACE)); irr::core::stringw name2 = irr::core::stringw( RaceManager::getNameOf(RaceManager::MINOR_MODE_TIME_TRIAL)) + L"\n"; //FIXME: avoid duplicating descriptions from the help menu! name2 += _("Contains no powerups, so only your driving skills matter!"); - w2->addItem( name2, "timetrial", RaceManager::getIconOf(RaceManager::MINOR_MODE_TIME_TRIAL)); + w2->addItem( name2, IDENT_TTRIAL, RaceManager::getIconOf(RaceManager::MINOR_MODE_TIME_TRIAL)); if (unlock_manager->isLocked("followtheleader")) { @@ -218,7 +218,7 @@ void RaceSetupScreen::init() RaceManager::getNameOf(RaceManager::MINOR_MODE_FOLLOW_LEADER)) + L"\n"; //I18N: short definition for follow-the-leader game mode name3 += _("Keep up with the leader kart but don't overtake it!"); - w2->addItem(name3, "ftl", RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), false); + w2->addItem(name3, FTL_IDENT, RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), false); } if (race_manager->getNumPlayers() > 1) @@ -227,7 +227,7 @@ void RaceSetupScreen::init() RaceManager::getNameOf(RaceManager::MINOR_MODE_3_STRIKES)) + L"\n"; //FIXME: avoid duplicating descriptions from the help menu! name4 += _("Hit others with weapons until they lose all their lives. (Only in multiplayer games)"); - w2->addItem( name4, "3strikes", RaceManager::getIconOf(RaceManager::MINOR_MODE_3_STRIKES)); + w2->addItem( name4, STRIKES_IDENT, RaceManager::getIconOf(RaceManager::MINOR_MODE_3_STRIKES)); } @@ -237,16 +237,16 @@ void RaceSetupScreen::init() switch (UserConfigParams::m_game_mode) { case CONFIG_CODE_NORMAL : - w2->setSelection("normal", PLAYER_ID_GAME_MASTER, true); + w2->setSelection(IDENT_STD, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_TIMETRIAL : - w2->setSelection("timetrial", PLAYER_ID_GAME_MASTER, true); + w2->setSelection(IDENT_TTRIAL, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_FTL : - w2->setSelection("ftl", PLAYER_ID_GAME_MASTER, true); + w2->setSelection(FTL_IDENT, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_3STRIKES : - w2->setSelection("3strikes", PLAYER_ID_GAME_MASTER, true); + w2->setSelection(STRIKES_IDENT, PLAYER_ID_GAME_MASTER, true); break; } diff --git a/src/tracks/quad_graph.cpp b/src/tracks/quad_graph.cpp index 2fb0c5e7c..c60b6c3d2 100644 --- a/src/tracks/quad_graph.cpp +++ b/src/tracks/quad_graph.cpp @@ -552,7 +552,6 @@ int QuadGraph::findOutOfRoadSector(const Vec3& xyz, //----------------------------------------------------------------------------- /** Takes a snapshot of the driveline quads so they can be used as minimap. - * \param where the top left and lower right corner for the mini map. ??? FIXME */ video::ITexture *QuadGraph::makeMiniMap(const core::dimension2du &dimension, const std::string &name, diff --git a/src/tracks/quad_set.cpp b/src/tracks/quad_set.cpp index 333362855..1fe7e5e4c 100644 --- a/src/tracks/quad_set.cpp +++ b/src/tracks/quad_set.cpp @@ -70,24 +70,24 @@ void QuadSet::getPoint(const XMLNode *xml, const std::string &attribute_name, } // getPoint // ----------------------------------------------------------------------------- -void QuadSet::load(const std::string &filename) { +void QuadSet::load(const std::string &filename) +{ m_min = Vec3( 99999, 99999, 99999); m_max = Vec3(-99999, -99999, -99999); XMLNode *xml = file_manager->createXMLTree(filename); if(!xml || xml->getName()!="quads") { - fprintf(stderr, "QuadSet '%s' not found.\n", filename.c_str()); + fprintf(stderr, "[QuadSet::load] ERROR : QuadSet '%s' not found.\n", filename.c_str()); return; - //FIXME exit(-1); } for(unsigned int i=0; igetNumNodes(); i++) { const XMLNode *xml_node = xml->getNode(i); if(xml_node->getName()!="quad") { - printf("Unsupported node type '%s' found in '%s' - ignored.\n", - xml_node->getName().c_str(), filename.c_str()); + printf("[QuadSet::load] WARNING: Unsupported node type '%s' found in '%s' - ignored.\n", + xml_node->getName().c_str(), filename.c_str()); continue; } Vec3 p0, p1, p2, p3; diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index a16a6a680..a2deb322c 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -393,10 +393,12 @@ void Track::convertTrackToBullet(scene::ISceneNode *node) // overwrite the elements on the diagonal, making any rotation incorrect. mat_scale.setScale(scale); mat *= mat_scale; - for(unsigned int i=0; igetMeshBufferCount(); i++) { + for(unsigned int i=0; igetMeshBufferCount(); i++) + { scene::IMeshBuffer *mb = mesh->getMeshBuffer(i); // FIXME: take translation/rotation into account - if(mb->getVertexType()!=video::EVT_STANDARD) { + if(mb->getVertexType()!=video::EVT_STANDARD) + { fprintf(stderr, "WARNING: Physics::convertTrack: Ignoring type '%d'!", mb->getVertexType()); continue; diff --git a/src/tracks/track_object.cpp b/src/tracks/track_object.cpp index 5b89b2088..f2f9ee794 100644 --- a/src/tracks/track_object.cpp +++ b/src/tracks/track_object.cpp @@ -90,9 +90,6 @@ TrackObject::TrackObject(const XMLNode &xml_node) m_node->setPosition(m_init_xyz); m_node->setRotation(m_init_hpr); m_node->setScale(m_init_scale); - // FIXME (to-be-removed) If something looks polygonal - // re-export with normals instead of setting false here - //m_node->setMaterialFlag(video::EMF_LIGHTING, false); } reset(); } // TrackObject diff --git a/src/utils/translation.cpp b/src/utils/translation.cpp index 163cf6c9c..df489f522 100644 --- a/src/utils/translation.cpp +++ b/src/utils/translation.cpp @@ -73,7 +73,6 @@ Translations::Translations() if (sizeof(wchar_t) == 4) { - // FIXME: will probably not work on PPC maccs if (IS_LITTLE_ENDIAN) bind_textdomain_codeset(PACKAGE, "UTF-32LE"); else bind_textdomain_codeset(PACKAGE, "UTF-32BE"); } @@ -187,7 +186,7 @@ const wchar_t* Translations::w_gettext(const char* original) } //std::cout << " (len=" << len << ")\n"; - FriBidiCharType pbase_dir = FRIBIDI_TYPE_ON; //FIXME: what's that? + FriBidiCharType pbase_dir = FRIBIDI_TYPE_ON; // Not sure what's that for, but it seems to work... static FriBidiChar fribidiOutput[FRIBIDI_BUFFER_SIZE]; for (n = 0; n < 512 ; n++) { fribidiOutput[n] = 0; }