Added Fort Magma to last Grand Prix once the game
is completely unlocked (before only 4 tracks will be in the last GP). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12095 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
91342fee83
commit
6ebf8b6565
@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
<supertuxkart_grand_prix name="At World's End">
|
<supertuxkart_grand_prix name="At World's End">
|
||||||
|
|
||||||
<!--
|
|
||||||
<track id="fortmagma" laps="3" reverse="false" />
|
<track id="fortmagma" laps="3" reverse="false" />
|
||||||
-->
|
|
||||||
<track id="minigolf" laps="3" reverse="false" />
|
<track id="minigolf" laps="3" reverse="false" />
|
||||||
<track id="xr591" laps="3" reverse="false" />
|
<track id="xr591" laps="3" reverse="false" />
|
||||||
<track id="mines" laps="3" reverse="false" />
|
<track id="mines" laps="3" reverse="false" />
|
||||||
|
@ -19,15 +19,16 @@
|
|||||||
|
|
||||||
#include "race/grand_prix_data.hpp"
|
#include "race/grand_prix_data.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include "challenges/unlock_manager.hpp"
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "tracks/track_manager.hpp"
|
#include "tracks/track_manager.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
GrandPrixData::GrandPrixData(const std::string filename) throw(std::logic_error)
|
GrandPrixData::GrandPrixData(const std::string filename) throw(std::logic_error)
|
||||||
{
|
{
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
@ -143,5 +144,49 @@ bool GrandPrixData::checkConsistency(bool chatty) const
|
|||||||
|
|
||||||
} // for i
|
} // for i
|
||||||
return true;
|
return true;
|
||||||
}
|
} // checkConsistency
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Returns true if the track is available. This is used to test if Fort Magma
|
||||||
|
* is available (this way FortMagma is not used in the last Grand Prix in
|
||||||
|
* story mode, but will be available once all challenges are done and nolok
|
||||||
|
* is unlocked).
|
||||||
|
*/
|
||||||
|
bool GrandPrixData::isTrackAvailable(const std::string &id) const
|
||||||
|
{
|
||||||
|
return id!="fortmagma" ||
|
||||||
|
!unlock_manager->getCurrentSlot()->isLocked("fortmagma");
|
||||||
|
} // isTrackAvailable
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void GrandPrixData::getLaps(std::vector<int> *laps) const
|
||||||
|
{
|
||||||
|
laps->clear();
|
||||||
|
for(unsigned int i=0; i< m_tracks.size(); i++)
|
||||||
|
if(isTrackAvailable(m_tracks[i]))
|
||||||
|
laps->push_back(m_laps[i]);
|
||||||
|
} // getLaps
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void GrandPrixData::getReverse(std::vector<bool> *reverse) const
|
||||||
|
{
|
||||||
|
reverse->clear();
|
||||||
|
for(unsigned int i=0; i< m_tracks.size(); i++)
|
||||||
|
if(isTrackAvailable(m_tracks[i]))
|
||||||
|
reverse->push_back(m_reversed[i]);
|
||||||
|
} // getReverse
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
const std::vector<std::string>& GrandPrixData::getTrackNames() const
|
||||||
|
{
|
||||||
|
m_really_available_tracks.clear();
|
||||||
|
for(unsigned int i=0; i< m_tracks.size(); i++)
|
||||||
|
{
|
||||||
|
if(isTrackAvailable(m_tracks[i]))
|
||||||
|
m_really_available_tracks.push_back(m_tracks[i]);
|
||||||
|
} // for i
|
||||||
|
return m_really_available_tracks;
|
||||||
|
} // getTrackNames
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
@ -47,6 +47,15 @@ class GrandPrixData
|
|||||||
* means the filename of the .track file without .track extension
|
* means the filename of the .track file without .track extension
|
||||||
* (ie. 'volcano'). */
|
* (ie. 'volcano'). */
|
||||||
std::vector<std::string> m_tracks;
|
std::vector<std::string> m_tracks;
|
||||||
|
|
||||||
|
/** This is the list of actually available tracks. In the last GP Fort
|
||||||
|
* Magma can not be used untill the final challenge. In order to provide
|
||||||
|
* still 5 tracks/GP, the last GP is only using 4 tracks in story mode,
|
||||||
|
* but (once nolok is unlocked) Fort Magma is added after that. So this
|
||||||
|
* list is always re-evaluated depending on the state of Nolok (i.e. if
|
||||||
|
* nolok is unlocked, Fort Magma is available, otherwise not).
|
||||||
|
* Mark this member mutable so that getTrackNames can be const. */
|
||||||
|
mutable std::vector<std::string> m_really_available_tracks;
|
||||||
|
|
||||||
/** The number of laps that each track should be raced, in the right order */
|
/** The number of laps that each track should be raced, in the right order */
|
||||||
std::vector<int> m_laps;
|
std::vector<int> m_laps;
|
||||||
@ -54,9 +63,7 @@ class GrandPrixData
|
|||||||
/** Whether the track in question should be done in reverse mode */
|
/** Whether the track in question should be done in reverse mode */
|
||||||
std::vector<bool> m_reversed;
|
std::vector<bool> m_reversed;
|
||||||
|
|
||||||
|
bool isTrackAvailable(const std::string &id) const;
|
||||||
bool m_only_when_nolok_is_unlocked;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Load the GrandPrixData from the given filename */
|
/** Load the GrandPrixData from the given filename */
|
||||||
@ -66,27 +73,25 @@ public:
|
|||||||
GrandPrixData (const std::string filename) throw(std::logic_error);
|
GrandPrixData (const std::string filename) throw(std::logic_error);
|
||||||
GrandPrixData () {}; // empty for initialising
|
GrandPrixData () {}; // empty for initialising
|
||||||
|
|
||||||
/** @return the (potentially translated) user-visible name of the Grand Prix (apply fribidi as needed) */
|
bool checkConsistency(bool chatty=true) const;
|
||||||
const irr::core::stringw getName () const { return _LTR(m_name.c_str()); }
|
const std::vector<std::string>& getTrackNames() const;
|
||||||
|
void getLaps(std::vector<int> *laps) const;
|
||||||
/** @return the (potentially translated) user-visible description of the Grand Prix */
|
void getReverse(std::vector<bool> *reverse) const;
|
||||||
//const irr::core::stringw& getDescription () const { return m_description; }
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** @return the (potentially translated) user-visible name of the Grand
|
||||||
|
* Prix (apply fribidi as needed) */
|
||||||
|
const irr::core::stringw getName() const { return _LTR(m_name.c_str()); }
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
/** @return the internal name identifier of the Grand Prix (not translated) */
|
/** @return the internal name identifier of the Grand Prix (not translated) */
|
||||||
const std::string& getId () const { return m_id; }
|
const std::string& getId() const { return m_id; }
|
||||||
|
|
||||||
const std::string& getFilename () const { return m_filename; }
|
// ------------------------------------------------------------------------
|
||||||
const std::string& getTrack(size_t track_index) const { assert(track_index >= 0); assert(track_index < m_tracks.size());
|
/** Returns the filename of the grand prix xml file. */
|
||||||
return m_tracks[track_index]; }
|
const std::string& getFilename() const { return m_filename; }
|
||||||
const std::vector<std::string>& getTracks() const {return m_tracks; }
|
|
||||||
const std::vector<int>& getLaps() const {return m_laps; }
|
}; // GrandPrixData
|
||||||
const std::vector<bool>& getReverse() const {return m_reversed; }
|
|
||||||
size_t getTrackCount() const {return m_tracks.size(); }
|
|
||||||
const int& getLaps(size_t lap_index) const {assert(lap_index < m_tracks.size());
|
|
||||||
return m_laps[lap_index];}
|
|
||||||
bool checkConsistency(bool chatty=true) const;
|
|
||||||
}
|
|
||||||
; // GrandPrixData
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -263,9 +263,9 @@ void RaceManager::startNew(bool from_overworld)
|
|||||||
if(m_major_mode==MAJOR_MODE_GRAND_PRIX)
|
if(m_major_mode==MAJOR_MODE_GRAND_PRIX)
|
||||||
{
|
{
|
||||||
// GP: get tracks, laps and reverse info from grand prix
|
// GP: get tracks, laps and reverse info from grand prix
|
||||||
m_tracks = m_grand_prix.getTracks();
|
m_tracks = m_grand_prix.getTrackNames();
|
||||||
m_num_laps = m_grand_prix.getLaps();
|
m_grand_prix.getLaps(&m_num_laps);
|
||||||
m_reverse_track = m_grand_prix.getReverse();
|
m_grand_prix.getReverse(&m_reverse_track);
|
||||||
}
|
}
|
||||||
//assert(m_player_karts.size() > 0);
|
//assert(m_player_karts.size() > 0);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
|||||||
|
|
||||||
|
|
||||||
// ---- Track listings
|
// ---- Track listings
|
||||||
const std::vector<std::string>& tracks = gp->getTracks();
|
const std::vector<std::string>& tracks = gp->getTrackNames();
|
||||||
const int trackAmount = tracks.size();
|
const int trackAmount = tracks.size();
|
||||||
|
|
||||||
int height_of_one_line = (y2 - y1)/(trackAmount+1);
|
int height_of_one_line = (y2 - y1)/(trackAmount+1);
|
||||||
@ -224,7 +224,7 @@ void GPInfoDialog::onUpdate(float dt)
|
|||||||
|
|
||||||
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(m_gp_ident);
|
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(m_gp_ident);
|
||||||
assert(gp != NULL);
|
assert(gp != NULL);
|
||||||
const std::vector<std::string>& tracks = gp->getTracks();
|
const std::vector<std::string>& tracks = gp->getTrackNames();
|
||||||
if (frameAfter >= (int)tracks.size())
|
if (frameAfter >= (int)tracks.size())
|
||||||
{
|
{
|
||||||
frameAfter = 0;
|
frameAfter = 0;
|
||||||
|
@ -623,7 +623,7 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const std::vector<std::string>& gptracks = gp->getTracks();
|
const std::vector<std::string>& gptracks = gp->getTrackNames();
|
||||||
const int trackAmount = gptracks.size();
|
const int trackAmount = gptracks.size();
|
||||||
|
|
||||||
if (trackAmount == 0)
|
if (trackAmount == 0)
|
||||||
|
@ -836,7 +836,7 @@ void RaceResultGUI::enableGPProgress()
|
|||||||
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||||
{
|
{
|
||||||
const std::vector<std::string>& tracks =
|
const std::vector<std::string>& tracks =
|
||||||
race_manager->getGrandPrix()->getTracks();
|
race_manager->getGrandPrix()->getTrackNames();
|
||||||
size_t currentTrack = race_manager->getTrackNumber();
|
size_t currentTrack = race_manager->getTrackNumber();
|
||||||
|
|
||||||
// Assume 5 is the max amount we can render in any given height
|
// Assume 5 is the max amount we can render in any given height
|
||||||
@ -905,7 +905,7 @@ void RaceResultGUI::displayGPProgress()
|
|||||||
void RaceResultGUI::cleanupGPProgress()
|
void RaceResultGUI::cleanupGPProgress()
|
||||||
{
|
{
|
||||||
const std::vector<std::string>& tracks =
|
const std::vector<std::string>& tracks =
|
||||||
race_manager->getGrandPrix()->getTracks();
|
race_manager->getGrandPrix()->getTrackNames();
|
||||||
for(size_t i=0; i<tracks.size(); i++)
|
for(size_t i=0; i<tracks.size(); i++)
|
||||||
{
|
{
|
||||||
GUIEngine::Widget *trackWidget = getWidget(tracks[i].c_str());
|
GUIEngine::Widget *trackWidget = getWidget(tracks[i].c_str());
|
||||||
|
@ -225,7 +225,7 @@ void TracksScreen::init()
|
|||||||
{
|
{
|
||||||
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(n);
|
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(n);
|
||||||
|
|
||||||
std::vector<std::string> tracks = gp->getTracks();
|
const std::vector<std::string> &tracks = gp->getTrackNames();
|
||||||
|
|
||||||
std::vector<std::string> sshot_files;
|
std::vector<std::string> sshot_files;
|
||||||
for (unsigned int t=0; t<tracks.size(); t++)
|
for (unsigned int t=0; t<tracks.size(); t++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user