2007-05-27 12:01:53 -04:00
|
|
|
// $Id: highscores.hpp 921 2007-02-28 05:43:34Z hiker $
|
|
|
|
//
|
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
|
|
|
// Copyright (C) 2006 Joerg Henrichs
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2008-06-12 20:53:52 -04:00
|
|
|
// as published by the Free Software Foundation; either version 3
|
2007-05-27 12:01:53 -04:00
|
|
|
// 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 HEADER_HIGHSCORES_H
|
|
|
|
#define HEADER_HIGHSCORES_H
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "lisp/lisp.hpp"
|
|
|
|
#include "lisp/writer.hpp"
|
1) Removed race_setup and race_mode data structures. All this
information is now only managed by the race_manager, no
more in-between objects to transfer information along.
2) The scores for grand prix are now defined in the stk_config.dat
file (10, 8, 6, 5, 4, .., 1, 0, 0) points
3) Bugfix: unlock information wasn't saved anymore. Added specific
saving after unlocking, plus re-inserted the 'generic' save
at the end of STK again.
4) bugfix/work around: Visual Studio complains about incompatible
iterators in sdldrv - apparently caused by using erase, and
then keep on using the iterator.
5) Fixed bug when running a race in a GP again (scores/times
were added each time).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1681 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2008-04-09 09:52:48 -04:00
|
|
|
#include "race_manager.hpp"
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2008-09-22 21:16:50 -04:00
|
|
|
/**
|
|
|
|
* Represents one highscore entry.
|
|
|
|
*/
|
|
|
|
class HighscoreEntry
|
2007-05-27 12:01:53 -04:00
|
|
|
{
|
|
|
|
public:
|
2008-09-22 21:16:50 -04:00
|
|
|
typedef std::string HighscoreType;
|
|
|
|
|
2007-05-27 12:01:53 -04:00
|
|
|
private:
|
2008-01-13 18:51:09 -05:00
|
|
|
enum {HIGHSCORE_LEN = 3}; // It's a top 3 list
|
2007-05-27 12:01:53 -04:00
|
|
|
std::string m_track;
|
|
|
|
HighscoreType m_highscore_type;
|
|
|
|
int m_number_of_karts;
|
|
|
|
int m_difficulty;
|
|
|
|
int m_number_of_laps;
|
|
|
|
std::string m_kart_name[HIGHSCORE_LEN];
|
|
|
|
std::string m_name[HIGHSCORE_LEN];
|
|
|
|
float m_time[HIGHSCORE_LEN];
|
|
|
|
public:
|
2008-09-22 21:16:50 -04:00
|
|
|
/** Creates a new entry
|
|
|
|
*/
|
|
|
|
HighscoreEntry (const HighscoreEntry::HighscoreType highscore_type,
|
|
|
|
int num_karts, const RaceManager::Difficulty difficulty,
|
|
|
|
const std::string trackName, const int number_of_laps);
|
|
|
|
/** Creates an entry from a file
|
|
|
|
*/
|
|
|
|
HighscoreEntry (const lisp::Lisp* const node);
|
|
|
|
|
2007-05-27 12:01:53 -04:00
|
|
|
void Read (const lisp::Lisp* const node);
|
|
|
|
void Write (lisp::Writer* writer);
|
|
|
|
int matches (HighscoreType highscore_type, int num_karts,
|
1) Removed race_setup and race_mode data structures. All this
information is now only managed by the race_manager, no
more in-between objects to transfer information along.
2) The scores for grand prix are now defined in the stk_config.dat
file (10, 8, 6, 5, 4, .., 1, 0, 0) points
3) Bugfix: unlock information wasn't saved anymore. Added specific
saving after unlocking, plus re-inserted the 'generic' save
at the end of STK again.
4) bugfix/work around: Visual Studio complains about incompatible
iterators in sdldrv - apparently caused by using erase, and
then keep on using the iterator.
5) Fixed bug when running a race in a GP again (scores/times
were added each time).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1681 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2008-04-09 09:52:48 -04:00
|
|
|
const RaceManager::Difficulty difficulty,
|
2008-09-22 21:16:50 -04:00
|
|
|
const std::string track, const int number_of_laps);
|
|
|
|
int addData (const std::string& kart_name,
|
|
|
|
const std::string& name, const float time);
|
2007-05-27 12:01:53 -04:00
|
|
|
int getNumberEntries() const;
|
|
|
|
void getEntry (int number, std::string &kart_name,
|
|
|
|
std::string &name, float *const time) const;
|
2008-09-22 21:16:50 -04:00
|
|
|
}; // HighscoreEntry
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
#endif
|