00001 //////////////////////////////////////////////////////////////////////////////// 00002 // Scorched3D (c) 2000-2009 00003 // 00004 // This file is part of Scorched3D. 00005 // 00006 // Scorched3D is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Scorched3D is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Scorched3D; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 //////////////////////////////////////////////////////////////////////////////// 00020 00021 #if !defined(AFX_TANKSCORE_H__ED963414_2B77_4027_B35A_D69960165470__INCLUDED_) 00022 #define AFX_TANKSCORE_H__ED963414_2B77_4027_B35A_D69960165470__INCLUDED_ 00023 00024 #include <set> 00025 #include <string> 00026 #include <time.h> 00027 #include <net/NetBuffer.h> 00028 00029 class Tank; 00030 class ScorchedContext; 00031 class TankScore 00032 { 00033 public: 00034 TankScore(ScorchedContext &context); 00035 virtual ~TankScore(); 00036 00037 void setTank(Tank *tank) { tank_ = tank; } 00038 00039 void newMatch(); 00040 void newGame(); 00041 void clientNewGame(); 00042 00043 int getKills() { return kills_; } 00044 void setKills(int kills) { kills_ = kills; } 00045 00046 int getAssists() { return assists_; } 00047 void setAssists(int assists) { assists_ = assists; } 00048 00049 int getMoney() { return money_; } 00050 void setMoney(int money); 00051 00052 int getWins() { return wins_; } 00053 void setWins(int wins) { wins_ = wins; } 00054 00055 int getScore() { return score_; } 00056 void setScore(int score); 00057 00058 int getTurnKills() { return turnKills_; } 00059 void setTurnKills(int kills) { turnKills_ = kills; } 00060 00061 int getMissedMoves() { return missedMoves_; } 00062 void setMissedMoves(int miss) { missedMoves_ = miss; } 00063 00064 bool getWonGame() { return wonGame_; } 00065 void setWonGame() { wonGame_ = true; } 00066 00067 int getRank() { return rank_; } 00068 void setRank(int rank) { rank_ = rank; } 00069 00070 int getSkill() { return skill_; } 00071 void setSkill(int skill); 00072 00073 int getStartSkill() { return startSkill_; } 00074 00075 std::set<unsigned int> &getHurtBy() { return hurtBy_; } 00076 00077 time_t getTimePlayed() { return time(0) - startTime_; } 00078 time_t getStartTime() { return startTime_; } 00079 00080 // Stuff for stats 00081 time_t getTimePlayedStat(); 00082 int getTotalMoneyEarnedStat() { return totalMoneyEarned_; } 00083 int getTotalScoreEarnedStat() { return totalScoreEarned_; } 00084 void resetTotalEarnedStats(); 00085 00086 // Get info as text 00087 const char *getTimePlayedString(); 00088 const char *getScoreString(); 00089 00090 // Serialize the tank 00091 bool writeMessage(NetBuffer &buffer); 00092 bool readMessage(NetBufferReader &reader); 00093 00094 protected: 00095 Tank *tank_; 00096 std::set<unsigned int> hurtBy_; 00097 ScorchedContext &context_; 00098 int rank_, skill_, startSkill_; 00099 int kills_, turnKills_; 00100 int assists_; 00101 int money_; 00102 int totalMoneyEarned_, totalScoreEarned_; 00103 int wins_; 00104 int score_; 00105 int missedMoves_; 00106 bool wonGame_; 00107 time_t startTime_; 00108 time_t lastStatTime_; 00109 00110 }; 00111 00112 #endif // !defined(AFX_TANKSCORE_H__ED963414_2B77_4027_B35A_D69960165470__INCLUDED_)
1.5.3