1 /* bzflag 2 * Copyright (c) 1993-2021 Tim Riker 3 * 4 * This package is free software; you can redistribute it and/or 5 * modify it under the terms of the license found in the file 6 * named COPYING that should have accompanied this file. 7 * 8 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 13 #ifndef __SCORE_H__ 14 #define __SCORE_H__ 15 16 // bzflag global header 17 #include "global.h" 18 19 #include "bzfsAPI.h" 20 21 class Score 22 { 23 public: 24 Score(); 25 int playerID; 26 27 void dump(); 28 /** Take into account the quality of player wins/(wins+loss) 29 Try to penalize winning casuality 30 */ 31 float ranking(); 32 bool isTK() const; 33 void tK(); 34 void killedBy(); 35 void kill(); 36 void reset(); 37 void *pack(void *buf); 38 bool reached() const; getWins()39 int getWins() const 40 { 41 return wins; 42 } getLosses()43 int getLosses() const 44 { 45 return losses; 46 } getTKs()47 int getTKs() const 48 { 49 return tks; 50 } getHandicap()51 int getHandicap() const 52 { 53 return handicap; 54 }; 55 setWins(int v)56 void setWins(int v) 57 { 58 wins = v; 59 } setLosses(int v)60 void setLosses(int v) 61 { 62 losses = v; 63 } setTKs(int v)64 void setTKs(int v) 65 { 66 tks = v; 67 } setHandicap(int v)68 void setHandicap(int v) 69 { 70 handicap = v; 71 } 72 73 static bool KeepPlayerScores; 74 static bool KeepTeamScores; 75 76 static void setTeamKillRatio(int _tkKickRatio); 77 static void setWinLimit(int _score); 78 static void setRandomRanking(); 79 80 private: 81 // player's score 82 int wins, losses, tks; 83 int handicap; 84 // Tk index 85 static float tkKickRatio; 86 static int score; 87 static bool randomRanking; 88 89 void changeScoreElement(bz_eScoreElement element, int *toChange, int newValue); 90 }; 91 92 #endif 93 94 // Local Variables: *** 95 // mode: C++ *** 96 // tab-width: 4 *** 97 // c-basic-offset: 4 *** 98 // indent-tabs-mode: nil *** 99 // End: *** 100 // ex: shiftwidth=4 tabstop=4 101