Don't try displaying highscores in modes that don't generate highscores (3 strikes, FTL)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4757 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
bbd2ecb4c4
commit
2478db386a
@ -151,7 +151,10 @@ public:
|
||||
|
||||
void updateWorld(float dt);
|
||||
virtual void restartRace();
|
||||
void disableRace(); // Put race into limbo phase
|
||||
|
||||
/** Put race into limbo phase */
|
||||
void disableRace();
|
||||
|
||||
/** Returns a pointer to the race gui. */
|
||||
RaceGUI *getRaceGUI() const { return m_race_gui; }
|
||||
Kart *getPlayerKart(unsigned int player) const;
|
||||
@ -167,12 +170,13 @@ public:
|
||||
unsigned int getCurrentNumPlayers() const { return m_num_players -
|
||||
m_eliminated_players; }
|
||||
|
||||
Physics *getPhysics() const { return m_physics; }
|
||||
Track *getTrack() const { return m_track; }
|
||||
Kart* getFastestKart() const { return m_fastest_kart; }
|
||||
float getFastestLapTime() const { return m_fastest_lap; }
|
||||
void setFastestLap(Kart *k, float time) {m_fastest_kart=k;m_fastest_lap=time; }
|
||||
HighscoreEntry* getHighscores() const;
|
||||
Physics *getPhysics() const { return m_physics; }
|
||||
Track *getTrack() const { return m_track; }
|
||||
Kart *getFastestKart() const { return m_fastest_kart; }
|
||||
float getFastestLapTime() const { return m_fastest_lap; }
|
||||
void setFastestLap(Kart *k, float time){ m_fastest_kart = k;
|
||||
m_fastest_lap = time; }
|
||||
HighscoreEntry *getHighscores() const;
|
||||
|
||||
virtual void terminateRace();
|
||||
|
||||
@ -202,6 +206,9 @@ public:
|
||||
bool shouldDrawTimer() const { return isRacePhase() &&
|
||||
getClockMode() != CLOCK_NONE; }
|
||||
|
||||
/** \return whether this world can generate/have highscores */
|
||||
bool useHighScores() const { return m_use_highscores; }
|
||||
|
||||
/** called when a bonus box is hit, to determine which types of powerups are allowed
|
||||
in each game mode. By default all are accepted, override in child classes to get
|
||||
a different behaviour */
|
||||
|
@ -274,25 +274,36 @@ public:
|
||||
if(id > 999 && id < 2000) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/** get information about given mode (returns true if 'mode' is of battle type)
|
||||
info is stored in its ID for conveniance, see the macros above for exact meaning
|
||||
*/
|
||||
static bool isBattleMode(const MinorRaceModeType type)
|
||||
{
|
||||
const int id = (int)type;
|
||||
if(id >= 2000) return true;
|
||||
else return false;
|
||||
if (id >= 2000) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/** get information about given mode (returns true if 'mode' requires lap counting)
|
||||
info is stored in its ID for conveniance, see the macros above for exact meaning
|
||||
*/
|
||||
static bool modeHasLaps(const MinorRaceModeType type)
|
||||
{
|
||||
if(isBattleMode(type)) return false;
|
||||
if (isBattleMode(type)) return false;
|
||||
const int id = (int)type;
|
||||
const int answer = (id-1000)/100;
|
||||
return answer!=0;
|
||||
}
|
||||
|
||||
static bool modeHasHighscores(const MinorRaceModeType type)
|
||||
{
|
||||
//FIXME: this information is duplicated. RaceManager knows about it, and
|
||||
// each World may set m_use_highscores to true or false. The reason
|
||||
// for this duplication is that we might want to know whether to
|
||||
// display highscores without creating a World.
|
||||
return type != MINOR_MODE_3_STRIKES && type != MINOR_MODE_FOLLOW_LEADER;
|
||||
}
|
||||
};
|
||||
|
||||
extern RaceManager *race_manager;
|
||||
|
@ -45,7 +45,8 @@ using namespace GUIEngine;
|
||||
TrackInfoDialog::TrackInfoDialog(const std::string& trackIdent, const irr::core::stringw& trackName,
|
||||
ITexture* screenshot, const float w, const float h) : ModalDialog(w, h)
|
||||
{
|
||||
const bool has_laps = RaceManager::modeHasLaps(race_manager->getMinorMode());
|
||||
const bool has_laps = RaceManager::modeHasLaps (race_manager->getMinorMode());
|
||||
const bool has_highscores = RaceManager::modeHasHighscores(race_manager->getMinorMode());
|
||||
|
||||
const int y1 = m_area.getHeight()/7;
|
||||
const int y2 = m_area.getHeight()*5/7;
|
||||
@ -60,11 +61,14 @@ TrackInfoDialog::TrackInfoDialog(const std::string& trackIdent, const irr::core:
|
||||
m_irrlicht_window);
|
||||
a->setTabStop(false);
|
||||
|
||||
// ---- High Scores & track info
|
||||
// ---- High Scores
|
||||
const int hscores_y_from = y1;
|
||||
const int hscores_y_to = y1 + (y2 - y1)*2/3;
|
||||
addHighScoreWidgets(hscores_y_from, hscores_y_to);
|
||||
updateHighScores();
|
||||
if (has_highscores)
|
||||
{
|
||||
addHighScoreWidgets(hscores_y_from, hscores_y_to);
|
||||
updateHighScores();
|
||||
}
|
||||
|
||||
// ---- Track credits
|
||||
Track* track = track_manager->getTrack(trackIdent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user