2010-07-29 05:21:18 +00:00
|
|
|
/* copyright (c) 2008 rajh and gregwar. Score stuff */
|
|
|
|
|
|
|
|
#ifndef SCORE_H_RACE
|
|
|
|
#define SCORE_H_RACE
|
|
|
|
#include <engine/server.h>
|
|
|
|
#include <engine/shared/protocol.h>
|
2010-08-07 08:02:58 +00:00
|
|
|
#include <string>
|
2010-08-20 17:45:09 +00:00
|
|
|
#include <list>
|
|
|
|
|
2010-07-29 05:21:18 +00:00
|
|
|
|
|
|
|
class CPlayerScore
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
char name[MAX_NAME_LENGTH];
|
|
|
|
float m_Score;
|
|
|
|
|
|
|
|
CPlayerScore(const char *name, float score);
|
|
|
|
|
|
|
|
bool operator==(const CPlayerScore& other) { return (this->m_Score == other.m_Score); }
|
|
|
|
bool operator<(const CPlayerScore& other) { return (this->m_Score < other.m_Score); }
|
|
|
|
};
|
|
|
|
|
|
|
|
class CScore
|
|
|
|
{
|
|
|
|
class CGameContext *m_pGameServer;
|
2010-08-07 08:02:58 +00:00
|
|
|
std::string SaveFile();
|
2010-07-29 05:21:18 +00:00
|
|
|
public:
|
|
|
|
CScore(class CGameContext *pGameServer);
|
2010-08-10 04:28:17 +00:00
|
|
|
CScore();
|
2010-07-29 05:21:18 +00:00
|
|
|
void Save();
|
|
|
|
void Load();
|
|
|
|
CPlayerScore *SearchName(const char *name, int &pos);
|
|
|
|
CPlayerScore *SearchName(const char *name);
|
|
|
|
void ParsePlayer(const char *name, float score);
|
2010-08-20 17:51:06 +00:00
|
|
|
std::list<std::string> Top5Draw(int id, int debut);
|
2010-07-29 05:21:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|