1) Bugfix: GP were not locked.
2) Renamed all 'cups' into grand_prix. 3) Removed obsolete source files. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2190 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d6490dc48c
commit
3c018d5ac1
@ -1,6 +1,6 @@
|
|||||||
;; -*- mode: lisp -*-
|
;; -*- mode: lisp -*-
|
||||||
|
|
||||||
(supertuxkart-cup
|
(supertuxkart-grand-prix
|
||||||
(name _("All tracks"))
|
(name _("All tracks"))
|
||||||
(description _("All tracks included in SuperTuxKart"))
|
(description _("All tracks included in SuperTuxKart"))
|
||||||
(tracks "beach" "startrack" "lighthouse" "jungle" "volcano" "islandtrack" "sandtrack" "fortmagma" "snowtuxpeak" "crescentcrossing" "olivermath" "race" "city" "canyon" "subseatrack" "tuxtrack")
|
(tracks "beach" "startrack" "lighthouse" "jungle" "volcano" "islandtrack" "sandtrack" "fortmagma" "snowtuxpeak" "crescentcrossing" "olivermath" "race" "city" "canyon" "subseatrack" "tuxtrack")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;; -*- mode: lisp -*-
|
;; -*- mode: lisp -*-
|
||||||
|
|
||||||
(supertuxkart-cup
|
(supertuxkart-grand-prix
|
||||||
(name _("At world's end"))
|
(name _("At world's end"))
|
||||||
(description _("Last grand prix, longer and harder"))
|
(description _("Last grand prix, longer and harder"))
|
||||||
(tracks "fortmagma" "canyon" "subseatrack" "volcano" "snowtuxpeak")
|
(tracks "fortmagma" "canyon" "subseatrack" "volcano" "snowtuxpeak")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;; -*- mode: lisp -*-
|
;; -*- mode: lisp -*-
|
||||||
|
|
||||||
(supertuxkart-cup
|
(supertuxkart-grand-prix
|
||||||
(name _("Penguin Playground"))
|
(name _("Penguin Playground"))
|
||||||
(description _("First grand prix, easy to get started"))
|
(description _("First grand prix, easy to get started"))
|
||||||
(tracks "tuxtrack" "race" "olivermath")
|
(tracks "tuxtrack" "race" "olivermath")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;; -*- mode: lisp -*-
|
;; -*- mode: lisp -*-
|
||||||
|
|
||||||
(supertuxkart-cup
|
(supertuxkart-grand-prix
|
||||||
(name _("Snag Drive"))
|
(name _("Snag Drive"))
|
||||||
(description _("Third grand prix"))
|
(description _("Third grand prix"))
|
||||||
(tracks "islandtrack" "sandtrack" "city" "crescentcrossing")
|
(tracks "islandtrack" "sandtrack" "city" "crescentcrossing")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;; -*- mode: lisp -*-
|
;; -*- mode: lisp -*-
|
||||||
|
|
||||||
(supertuxkart-cup
|
(supertuxkart-grand-prix
|
||||||
(name _("To the Moon and Back"))
|
(name _("To the Moon and Back"))
|
||||||
(description _("Second grand prix"))
|
(description _("Second grand prix"))
|
||||||
(tracks "beach" "startrack" "jungle" "lighthouse")
|
(tracks "beach" "startrack" "jungle" "lighthouse")
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "lisp/parser.hpp"
|
#include "lisp/parser.hpp"
|
||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "world.hpp"
|
#include "world.hpp"
|
||||||
#include "cup_data.hpp"
|
#include "grand_prix_data.hpp"
|
||||||
#include "grand_prix_manager.hpp"
|
#include "grand_prix_manager.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
@ -198,8 +198,8 @@ void ChallengeData::setRace() const
|
|||||||
else // GP
|
else // GP
|
||||||
{
|
{
|
||||||
race_manager->setMinorMode(m_minor);
|
race_manager->setMinorMode(m_minor);
|
||||||
const CupData *cup = grand_prix_manager->getCup(m_gp_id);
|
const GrandPrixData *gp = grand_prix_manager->getGrandPrix(m_gp_id);
|
||||||
race_manager->setGrandPrix(*cup);
|
race_manager->setGrandPrix(*gp);
|
||||||
race_manager->setDifficulty(m_difficulty);
|
race_manager->setDifficulty(m_difficulty);
|
||||||
race_manager->setNumKarts(m_num_karts);
|
race_manager->setNumKarts(m_num_karts);
|
||||||
race_manager->setNumPlayers(1);
|
race_manager->setNumPlayers(1);
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
// $Id$
|
|
||||||
//
|
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
|
||||||
// Copyright (C) 2008 Joerg Henrichs
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be ruseful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
#include "translation.hpp"
|
|
||||||
#include "challenges/penguin_playground_gp.hpp"
|
|
||||||
#include "race_manager.hpp"
|
|
||||||
#include "world.hpp"
|
|
||||||
|
|
||||||
PenguinPlaygroundGP::PenguinPlaygroundGP() : Challenge("penguinplaygroundgp", _("Win Penguin Playground Grand\nPrix"))
|
|
||||||
{
|
|
||||||
setChallengeDescription(_("Win Penguin Playground Grand\nPrix with 3 'Racer' Level AI karts."));
|
|
||||||
addUnlockModeReward("followleader", _("Follow the Leader"));
|
|
||||||
// The energymathclass challenge must be done, otherwise GP can't be selected
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void PenguinPlaygroundGP::setRace() const {
|
|
||||||
race_manager->setMajorMode(RaceManager::RM_GRAND_PRIX);
|
|
||||||
race_manager->setMinorMode(RaceManager::RM_QUICK_RACE);
|
|
||||||
CupData cup("gp1.cup");
|
|
||||||
race_manager->setGrandPrix(cup);
|
|
||||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
|
||||||
race_manager->setNumKarts(4);
|
|
||||||
race_manager->setNumPlayers(1);
|
|
||||||
} // setRace
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool PenguinPlaygroundGP::grandPrixFinished()
|
|
||||||
{
|
|
||||||
if (race_manager->getMajorMode() != RaceManager::RM_GRAND_PRIX ||
|
|
||||||
race_manager->getMinorMode() != RaceManager::RM_QUICK_RACE ||
|
|
||||||
race_manager->getGrandPrix()->getName() != _("Penguin Playground") ||
|
|
||||||
race_manager->getDifficulty()!= RaceManager::RD_HARD ||
|
|
||||||
race_manager->getNumKarts() < 4 ||
|
|
||||||
race_manager->getNumPlayers() > 1) return false;
|
|
||||||
// Check if the player was in top 3:
|
|
||||||
for(int i=0; i<(int)race_manager->getNumKarts(); i++)
|
|
||||||
{
|
|
||||||
const Kart* k=world->getKart(i);
|
|
||||||
if(k->isPlayerKart() && !k->isEliminated()) return k->getPosition()==1;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // grandPrixFinished
|
|
||||||
//-----------------------------------------------------------------------------
|
|
@ -1,34 +0,0 @@
|
|||||||
// $Id$
|
|
||||||
//
|
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
|
||||||
// Copyright (C) 2008 Joerg Henrichs
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
#ifndef PENGUIN_PLAYGROUND_GP_H
|
|
||||||
#define PENGUIN_PLAYGROUND_GP_H
|
|
||||||
|
|
||||||
#include "challenges/challenge.hpp"
|
|
||||||
|
|
||||||
class PenguinPlaygroundGP : public Challenge
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PenguinPlaygroundGP();
|
|
||||||
virtual bool grandPrixFinished();
|
|
||||||
virtual void setRace() const;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*PENGUIN_PLAYGROUND_GP_H*/
|
|
@ -1,69 +0,0 @@
|
|||||||
// $Id$
|
|
||||||
//
|
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
|
||||||
// Copyright (C) 2008 Joerg Henrichs
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be ruseful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
#include "translation.hpp"
|
|
||||||
#include "worlds_end_gp.hpp"
|
|
||||||
#include "race_manager.hpp"
|
|
||||||
#include "world.hpp"
|
|
||||||
|
|
||||||
WorldsEndGP::WorldsEndGP() : Challenge("worldsendgp",_("Win the At World's End\nGrand Prix"))
|
|
||||||
{
|
|
||||||
setChallengeDescription(_("Come first in the At World's End\nGrand Prix with 3 'Racer'\nLevel AI karts."));
|
|
||||||
|
|
||||||
addUnlockDifficultyReward("skidding","Skidding Preview");
|
|
||||||
addUnlockGPReward("All tracks");
|
|
||||||
|
|
||||||
addDependency("islandfollow");
|
|
||||||
addDependency("racetracktime");
|
|
||||||
addDependency("tollwaytime");
|
|
||||||
addDependency("junglefollow");
|
|
||||||
addDependency("citytime");
|
|
||||||
addDependency("tollwayhead");
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void WorldsEndGP::setRace() const {
|
|
||||||
race_manager->setMajorMode(RaceManager::RM_GRAND_PRIX);
|
|
||||||
race_manager->setMinorMode(RaceManager::RM_QUICK_RACE);
|
|
||||||
CupData cup("gp4.cup");
|
|
||||||
race_manager->setGrandPrix(cup);
|
|
||||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
|
||||||
race_manager->setNumKarts(4);
|
|
||||||
race_manager->setNumPlayers(1);
|
|
||||||
} // setRace
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool WorldsEndGP::grandPrixFinished()
|
|
||||||
{
|
|
||||||
if (race_manager->getMajorMode() != RaceManager::RM_GRAND_PRIX ||
|
|
||||||
race_manager->getMinorMode() != RaceManager::RM_QUICK_RACE ||
|
|
||||||
race_manager->getGrandPrix()->getName() != _("At world's end") ||
|
|
||||||
race_manager->getDifficulty()!= RaceManager::RD_HARD ||
|
|
||||||
race_manager->getNumKarts() < 4 ||
|
|
||||||
race_manager->getNumPlayers() > 1) return false;
|
|
||||||
// Check if the player was first:
|
|
||||||
for(int i=0; i<(int)race_manager->getNumKarts(); i++)
|
|
||||||
{
|
|
||||||
const Kart* k=world->getKart(i);
|
|
||||||
if(k->isPlayerKart() && !k->isEliminated()) return k->getPosition()==1;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // grandPrixFinished
|
|
||||||
//-----------------------------------------------------------------------------
|
|
@ -1,36 +0,0 @@
|
|||||||
// $Id$
|
|
||||||
//
|
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
|
||||||
// Copyright (C) 2008 Joerg Henrichs
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
#ifndef WORLDS_END_GP_H
|
|
||||||
#define WORLDS_END_GP_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "challenge.hpp"
|
|
||||||
|
|
||||||
class WorldsEndGP : public Challenge
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WorldsEndGP();
|
|
||||||
virtual bool grandPrixFinished();
|
|
||||||
virtual void setRace() const;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*WORLDS_END_GP_H*/
|
|
@ -23,24 +23,24 @@
|
|||||||
#include "file_manager.hpp"
|
#include "file_manager.hpp"
|
||||||
#include "lisp/parser.hpp"
|
#include "lisp/parser.hpp"
|
||||||
#include "lisp/lisp.hpp"
|
#include "lisp/lisp.hpp"
|
||||||
#include "cup_data.hpp"
|
#include "grand_prix_data.hpp"
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
#include "track_manager.hpp"
|
#include "track_manager.hpp"
|
||||||
|
|
||||||
CupData::CupData(const std::string filename)
|
GrandPrixData::GrandPrixData(const std::string filename)
|
||||||
{
|
{
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
m_id = StringUtils::without_extension(filename);
|
m_id = StringUtils::basename(StringUtils::without_extension(filename));
|
||||||
const lisp::Lisp* lisp = 0;
|
const lisp::Lisp* lisp = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lisp::Parser parser;
|
lisp::Parser parser;
|
||||||
lisp = parser.parse(file_manager->getConfigFile(m_filename));
|
lisp = parser.parse(file_manager->getConfigFile(m_filename));
|
||||||
|
|
||||||
lisp = lisp->getLisp("supertuxkart-cup");
|
lisp = lisp->getLisp("supertuxkart-grand-prix");
|
||||||
if(!lisp)
|
if(!lisp)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("No supertuxkart-cup node");
|
throw std::runtime_error("No supertuxkart-grand-prix node");
|
||||||
}
|
}
|
||||||
|
|
||||||
lisp->get ("name", m_name );
|
lisp->get ("name", m_name );
|
||||||
@ -51,7 +51,7 @@ CupData::CupData(const std::string filename)
|
|||||||
}
|
}
|
||||||
catch(std::exception& err)
|
catch(std::exception& err)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error while reading cup file '%s'\n", filename.c_str());
|
fprintf(stderr, "Error while reading grandprix file '%s'\n", filename.c_str());
|
||||||
fprintf(stderr, err.what());
|
fprintf(stderr, err.what());
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ CupData::CupData(const std::string filename)
|
|||||||
delete lisp;
|
delete lisp;
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
bool CupData::checkConsistency()
|
bool GrandPrixData::checkConsistency()
|
||||||
{
|
{
|
||||||
bool correct=true;
|
bool correct=true;
|
||||||
for(unsigned int i=0; i<m_tracks.size(); i++)
|
for(unsigned int i=0; i<m_tracks.size(); i++)
|
@ -18,8 +18,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_CUPDATA_H
|
#ifndef HEADER_GRAND_PRIX_DATA_H
|
||||||
#define HEADER_CUPDATA_H
|
#define HEADER_GRAND_PRIX_DATA_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -27,16 +27,16 @@
|
|||||||
|
|
||||||
#include "herring_manager.hpp"
|
#include "herring_manager.hpp"
|
||||||
|
|
||||||
/** Simple class that hold the data relevant to a 'cup', aka. a number
|
/** Simple class that hold the data relevant to a 'grand_prix', aka. a number
|
||||||
of races that has to be completed one after the other */
|
of races that has to be completed one after the other */
|
||||||
class CupData
|
class GrandPrixData
|
||||||
{
|
{
|
||||||
std::string m_name; // The name of the cup - might be translated!
|
std::string m_name; // The name of the grand prix - might be translated!
|
||||||
std::string m_id; // Internal name of the cup, not translated
|
std::string m_id; // Internal name of the grand prix, not translated
|
||||||
std::string m_filename; // Original filename, only for error handling needed
|
std::string m_filename; // Original filename, only for error handling needed
|
||||||
std::string m_description; // Description for this track
|
std::string m_description; // Description for this track
|
||||||
std::string m_herring_style; // herring style which overwrites the track default
|
std::string m_herring_style; // herring style which overwrites the track default
|
||||||
/** The ident of the tracks in this cup in their right order, ident
|
/** The ident of the tracks in this grand prix in their right order, ident
|
||||||
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;
|
||||||
@ -46,9 +46,9 @@ class CupData
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Load the CupData from the given filename */
|
/** Load the GrandPrixData from the given filename */
|
||||||
CupData (const std::string filename);
|
GrandPrixData (const std::string filename);
|
||||||
CupData () {}; // empty for initialising
|
GrandPrixData () {}; // empty for initialising
|
||||||
const std::string& getName () const { return m_name; }
|
const std::string& getName () const { return m_name; }
|
||||||
const std::string& getId () const { return m_id; }
|
const std::string& getId () const { return m_id; }
|
||||||
const std::string& getDescription () const { return m_description; }
|
const std::string& getDescription () const { return m_description; }
|
||||||
@ -60,10 +60,10 @@ public:
|
|||||||
const std::vector<int>& getLaps() const {return m_laps; }
|
const std::vector<int>& getLaps() const {return m_laps; }
|
||||||
size_t getTrackCount() const {return m_tracks.size(); }
|
size_t getTrackCount() const {return m_tracks.size(); }
|
||||||
const int& getLaps(size_t lap_index) const {assert(lap_index < m_tracks.size());
|
const int& getLaps(size_t lap_index) const {assert(lap_index < m_tracks.size());
|
||||||
return m_laps[lap_index]; }
|
return m_laps[lap_index];}
|
||||||
bool checkConsistency();
|
bool checkConsistency();
|
||||||
}
|
}
|
||||||
; // CupData
|
; // GrandPrixData
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -43,31 +43,31 @@ GrandPrixManager::GrandPrixManager()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
GrandPrixManager::~GrandPrixManager()
|
GrandPrixManager::~GrandPrixManager()
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<m_cup_data.size(); i++)
|
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||||
{
|
{
|
||||||
delete m_cup_data[i];
|
delete m_gp_data[i];
|
||||||
} // for i
|
} // for i
|
||||||
|
|
||||||
} // ~GrandPrixManager
|
} // ~GrandPrixManager
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
const CupData* GrandPrixManager::getCup(const std::string& s) const
|
const GrandPrixData* GrandPrixManager::getGrandPrix(const std::string& s) const
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<m_cup_data.size(); i++)
|
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||||
if(m_cup_data[i]->getId()==s) return m_cup_data[i];
|
if(m_gp_data[i]->getId()==s) return m_gp_data[i];
|
||||||
return NULL;
|
return NULL;
|
||||||
} // getCup
|
} // getGrandPrix
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void GrandPrixManager::load(const std::string& filename)
|
void GrandPrixManager::load(const std::string& filename)
|
||||||
{
|
{
|
||||||
m_cup_data.push_back(new CupData(filename));
|
m_gp_data.push_back(new GrandPrixData(filename));
|
||||||
} // load
|
} // load
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void GrandPrixManager::checkConsistency()
|
void GrandPrixManager::checkConsistency()
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<m_cup_data.size(); i++)
|
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||||
{
|
{
|
||||||
m_cup_data[i]->checkConsistency();
|
m_gp_data[i]->checkConsistency();
|
||||||
}
|
}
|
||||||
} // checkConsistency
|
} // checkConsistency
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -22,20 +22,20 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "cup_data.hpp"
|
#include "grand_prix_data.hpp"
|
||||||
|
|
||||||
class GrandPrixManager
|
class GrandPrixManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::vector<CupData*> m_cup_data;
|
std::vector<GrandPrixData*> m_gp_data;
|
||||||
public:
|
public:
|
||||||
GrandPrixManager();
|
GrandPrixManager();
|
||||||
~GrandPrixManager();
|
~GrandPrixManager();
|
||||||
void load(const std::string &filename);
|
void load(const std::string &filename);
|
||||||
const CupData* getCup(int i) const { return m_cup_data[i]; }
|
const GrandPrixData* getGrandPrix(int i) const { return m_gp_data[i]; }
|
||||||
const CupData* getCup(const std::string& s) const;
|
const GrandPrixData* getGrandPrix(const std::string& s) const;
|
||||||
unsigned int getNumberOfGrandPrix() const { return m_cup_data.size(); }
|
unsigned int getNumberOfGrandPrix() const { return m_gp_data.size(); }
|
||||||
void checkConsistency();
|
void checkConsistency();
|
||||||
|
|
||||||
}; // GrandPrixManager
|
}; // GrandPrixManager
|
||||||
|
|
||||||
|
@ -51,9 +51,9 @@ GrandPrixSelect::GrandPrixSelect() : m_curr_track_img(0), m_clock(0.0f)
|
|||||||
m_gp_index.clear();
|
m_gp_index.clear();
|
||||||
for(unsigned int i=0; i<grand_prix_manager->getNumberOfGrandPrix(); i++)
|
for(unsigned int i=0; i<grand_prix_manager->getNumberOfGrandPrix(); i++)
|
||||||
{
|
{
|
||||||
const CupData *cup = grand_prix_manager->getCup(i);
|
const GrandPrixData *gp = grand_prix_manager->getGrandPrix(i);
|
||||||
if(unlock_manager->isLocked(cup->getName())) continue;
|
if(unlock_manager->isLocked(gp->getId())) continue;
|
||||||
widget_manager->addTextButtonWgt(WTOK_FIRSTPRIX + nId, 60, 7, cup->getName() );
|
widget_manager->addTextButtonWgt(WTOK_FIRSTPRIX + nId, 60, 7, gp->getName() );
|
||||||
m_gp_index.push_back(i);
|
m_gp_index.push_back(i);
|
||||||
nId++;
|
nId++;
|
||||||
} // for i
|
} // for i
|
||||||
@ -97,19 +97,19 @@ void GrandPrixSelect::update(float dt)
|
|||||||
if( widget_manager->selectionChanged() &&
|
if( widget_manager->selectionChanged() &&
|
||||||
!( SELECTED_TOKEN < WTOK_FIRSTPRIX ))
|
!( SELECTED_TOKEN < WTOK_FIRSTPRIX ))
|
||||||
{
|
{
|
||||||
const int CUP_NUM = m_gp_index[SELECTED_TOKEN - WTOK_FIRSTPRIX];
|
const int NUM = m_gp_index[SELECTED_TOKEN - WTOK_FIRSTPRIX];
|
||||||
const CupData *cup = grand_prix_manager->getCup(CUP_NUM);
|
const GrandPrixData *gp = grand_prix_manager->getGrandPrix(NUM);
|
||||||
const int NUM_TRACKS = cup->getTrackCount();
|
const int NUM_TRACKS = gp->getTrackCount();
|
||||||
|
|
||||||
widget_manager->setWgtText(WTOK_DESCRIPTION, cup->getDescription());
|
widget_manager->setWgtText(WTOK_DESCRIPTION, gp->getDescription());
|
||||||
|
|
||||||
|
|
||||||
std::string track_list;
|
std::string track_list;
|
||||||
m_cup_tracks = cup->getTracks();
|
m_gp_tracks = gp->getTracks();
|
||||||
|
|
||||||
for( int i = 0; i < NUM_TRACKS; ++i )
|
for( int i = 0; i < NUM_TRACKS; ++i )
|
||||||
{
|
{
|
||||||
track_list.append( track_manager->getTrack( m_cup_tracks[i] )->getName() );
|
track_list.append( track_manager->getTrack( m_gp_tracks[i] )->getName() );
|
||||||
track_list.push_back('\n');
|
track_list.push_back('\n');
|
||||||
}
|
}
|
||||||
widget_manager->setWgtText( WTOK_TRACKS, track_list );
|
widget_manager->setWgtText( WTOK_TRACKS, track_list );
|
||||||
@ -122,10 +122,10 @@ void GrandPrixSelect::update(float dt)
|
|||||||
|
|
||||||
for( int i = 0; i < NUM_TRACKS; ++i )
|
for( int i = 0; i < NUM_TRACKS; ++i )
|
||||||
{
|
{
|
||||||
img_filename = track_manager->getTrack( m_cup_tracks[i] )->getTopviewFile();
|
img_filename = track_manager->getTrack( m_gp_tracks[i] )->getTopviewFile();
|
||||||
if( img_filename.empty() )
|
if( img_filename.empty() )
|
||||||
{
|
{
|
||||||
img_filename = track_manager->getTrack( m_cup_tracks[i] )->getScreenshotFile();
|
img_filename = track_manager->getTrack( m_gp_tracks[i] )->getScreenshotFile();
|
||||||
if( img_filename.empty() ) continue;
|
if( img_filename.empty() ) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,8 +182,8 @@ void GrandPrixSelect::select()
|
|||||||
menu_manager->popMenu();
|
menu_manager->popMenu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const CupData *cup=grand_prix_manager->getCup(m_gp_index[CLICKED_TOKEN-WTOK_FIRSTPRIX]);
|
const GrandPrixData *gp=grand_prix_manager->getGrandPrix(m_gp_index[CLICKED_TOKEN-WTOK_FIRSTPRIX]);
|
||||||
race_manager->setGrandPrix(*cup);
|
race_manager->setGrandPrix(*gp);
|
||||||
menu_manager->pushMenu(MENUID_RACE_OPTIONS);
|
menu_manager->pushMenu(MENUID_RACE_OPTIONS);
|
||||||
} // select
|
} // select
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "base_gui.hpp"
|
#include "base_gui.hpp"
|
||||||
#include "cup_data.hpp"
|
#include "grand_prix_data.hpp"
|
||||||
|
|
||||||
class GrandPrixSelect: public BaseGUI
|
class GrandPrixSelect: public BaseGUI
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> m_cup_tracks;
|
std::vector<std::string> m_gp_tracks;
|
||||||
std::vector<int> m_track_imgs;
|
std::vector<int> m_track_imgs;
|
||||||
std::vector<unsigned int> m_gp_index;
|
std::vector<unsigned int> m_gp_index;
|
||||||
unsigned int m_curr_track_img;
|
unsigned int m_curr_track_img;
|
||||||
|
@ -42,7 +42,7 @@ private:
|
|||||||
ssgEntity *m_herring_model[HE_SILVER+1];
|
ssgEntity *m_herring_model[HE_SILVER+1];
|
||||||
|
|
||||||
// This is the active model. It gets determined by first loading the
|
// This is the active model. It gets determined by first loading the
|
||||||
// default, then track models, user models, cup models. This means, that
|
// default, then track models, user models, grand prix models. This means that
|
||||||
// a herring style specified in a track overwrites a command line option.
|
// a herring style specified in a track overwrites a command line option.
|
||||||
std::map<std::string,ssgEntity*> m_all_models;
|
std::map<std::string,ssgEntity*> m_all_models;
|
||||||
|
|
||||||
|
@ -699,10 +699,6 @@
|
|||||||
RelativePath="../../../src\collectable_manager.cpp"
|
RelativePath="../../../src\collectable_manager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\cup_data.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\explosion.cpp"
|
RelativePath="../../../src\explosion.cpp"
|
||||||
>
|
>
|
||||||
@ -719,6 +715,10 @@
|
|||||||
RelativePath="../../../src\game_manager.cpp"
|
RelativePath="../../../src\game_manager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\grand_prix_data.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\grand_prix_manager.cpp"
|
RelativePath="..\..\grand_prix_manager.cpp"
|
||||||
>
|
>
|
||||||
@ -1078,10 +1078,6 @@
|
|||||||
RelativePath="..\..\challenges\challenge_data.cpp"
|
RelativePath="..\..\challenges\challenge_data.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\challenges\worlds_end_gp.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
@ -1137,10 +1133,6 @@
|
|||||||
RelativePath="..\..\coord.hpp"
|
RelativePath="..\..\coord.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\cup_data.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\explosion.hpp"
|
RelativePath="../../../src\explosion.hpp"
|
||||||
>
|
>
|
||||||
@ -1157,6 +1149,10 @@
|
|||||||
RelativePath="../../../src\game_manager.hpp"
|
RelativePath="../../../src\game_manager.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\grand_prix_data.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\grand_prix_manager.hpp"
|
RelativePath="..\..\grand_prix_manager.hpp"
|
||||||
>
|
>
|
||||||
@ -1552,10 +1548,6 @@
|
|||||||
RelativePath="..\..\challenges\challenge_data.hpp"
|
RelativePath="..\..\challenges\challenge_data.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\challenges\worlds_end_gp.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
@ -112,10 +112,10 @@ void RaceManager::setTrack(const std::string& track)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void RaceManager::startNew()
|
void RaceManager::startNew()
|
||||||
{
|
{
|
||||||
if(m_major_mode==RM_GRAND_PRIX) // GP: get tracks and laps from cup object
|
if(m_major_mode==RM_GRAND_PRIX) // GP: get tracks and laps from grand prix
|
||||||
{
|
{
|
||||||
m_tracks = m_cup.getTracks();
|
m_tracks = m_grand_prix.getTracks();
|
||||||
m_num_laps = m_cup.getLaps();
|
m_num_laps = m_grand_prix.getLaps();
|
||||||
}
|
}
|
||||||
assert(m_player_karts.size() > 0);
|
assert(m_player_karts.size() > 0);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "cup_data.hpp"
|
#include "grand_prix_data.hpp"
|
||||||
|
|
||||||
/** The race manager has two functions:
|
/** The race manager has two functions:
|
||||||
1) it stores information about the race the user selected (e.g. number
|
1) it stores information about the race the user selected (e.g. number
|
||||||
@ -79,7 +79,7 @@ private:
|
|||||||
std::vector<int> m_num_laps;
|
std::vector<int> m_num_laps;
|
||||||
std::vector<int> m_score_for_position;
|
std::vector<int> m_score_for_position;
|
||||||
int m_track_number;
|
int m_track_number;
|
||||||
CupData m_cup;
|
GrandPrixData m_grand_prix;
|
||||||
int m_num_karts;
|
int m_num_karts;
|
||||||
unsigned int m_num_finished_karts;
|
unsigned int m_num_finished_karts;
|
||||||
unsigned int m_num_finished_players;
|
unsigned int m_num_finished_players;
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
void reset();
|
void reset();
|
||||||
void RaceFinished(const Kart* kart, float time);
|
void RaceFinished(const Kart* kart, float time);
|
||||||
void setTrack(const std::string& track);
|
void setTrack(const std::string& track);
|
||||||
void setGrandPrix(const CupData &cup){ m_cup = cup; }
|
void setGrandPrix(const GrandPrixData &gp){ m_grand_prix = gp; }
|
||||||
void setDifficulty(Difficulty diff);
|
void setDifficulty(Difficulty diff);
|
||||||
void setNumLaps(int num) { m_num_laps.clear();
|
void setNumLaps(int num) { m_num_laps.clear();
|
||||||
m_num_laps.push_back(num); }
|
m_num_laps.push_back(num); }
|
||||||
@ -121,14 +121,14 @@ public:
|
|||||||
Difficulty getDifficulty() const { return m_difficulty; }
|
Difficulty getDifficulty() const { return m_difficulty; }
|
||||||
const std::string&
|
const std::string&
|
||||||
getTrackName() const { return m_tracks[m_track_number]; }
|
getTrackName() const { return m_tracks[m_track_number]; }
|
||||||
const CupData
|
const GrandPrixData
|
||||||
*getGrandPrix() const { return &m_cup; }
|
*getGrandPrix() const { return &m_grand_prix; }
|
||||||
unsigned int getFinishedKarts() const { return m_num_finished_karts; }
|
unsigned int getFinishedKarts() const { return m_num_finished_karts; }
|
||||||
unsigned int getFinishedPlayers() const { return m_num_finished_players; }
|
unsigned int getFinishedPlayers() const { return m_num_finished_players; }
|
||||||
const std::string&
|
const std::string&
|
||||||
getKartName(int kart) const { return m_kart_status[kart].m_ident;}
|
getKartName(int kart) const { return m_kart_status[kart].m_ident;}
|
||||||
const std::string&
|
const std::string&
|
||||||
getHerringStyle() const { return m_cup.getHerringStyle(); }
|
getHerringStyle() const { return m_grand_prix.getHerringStyle();}
|
||||||
int getKartScore(int krt) const { return m_kart_status[krt].m_score;}
|
int getKartScore(int krt) const { return m_kart_status[krt].m_score;}
|
||||||
int getKartPrevScore(int krt)const { return m_kart_status[krt].m_last_score;}
|
int getKartPrevScore(int krt)const { return m_kart_status[krt].m_last_score;}
|
||||||
int getkartPlayerId(int krt) const { return m_kart_status[krt].m_player_id;}
|
int getkartPlayerId(int krt) const { return m_kart_status[krt].m_player_id;}
|
||||||
|
@ -724,7 +724,7 @@ void World::loadTrack()
|
|||||||
}
|
}
|
||||||
catch(std::runtime_error)
|
catch(std::runtime_error)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "The cup '%s' contains an invalid herring style '%s'.\n",
|
fprintf(stderr, "The grand prix '%s' contains an invalid herring style '%s'.\n",
|
||||||
race_manager->getGrandPrix()->getName().c_str(),
|
race_manager->getGrandPrix()->getName().c_str(),
|
||||||
race_manager->getHerringStyle().c_str());
|
race_manager->getHerringStyle().c_str());
|
||||||
fprintf(stderr, "Please fix the file '%s'.\n",
|
fprintf(stderr, "Please fix the file '%s'.\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user