1 /*************************************************************************** 2 carrulestatus.h - Rule status of a racing car 3 ------------------- 4 begin : wo apr 6 2005 5 copyright : (C) 2005 by CJP 6 email : cornware-cjp@users.sourceforge.net 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 #ifndef CARRULESTATUS_H 19 #define CARRULESTATUS_H 20 21 #include <vector> //STL vector template 22 namespace std {} 23 using namespace std; 24 25 26 /** 27 *@author CJP 28 */ 29 30 class CCarRuleStatus { 31 public: 32 CCarRuleStatus(); 33 ~CCarRuleStatus(); 34 35 //return false when it's invalid, e.g. 36 //finishing when already finished 37 bool start(); 38 bool finish(); 39 bool crash(); 40 bool giveUp(); 41 bool addPenalty(float time); 42 43 float startTime; //time when it started racing 44 float penaltyTime; //penalty time accumulated while playing 45 float finishTime; //time when it finished racing 46 47 enum 48 { 49 eNotStarted = 0, 50 eRacing = 1, 51 eFinished = 2, 52 eCrashed = 3, 53 eGivenUp = 4 54 } state; 55 56 57 vector<int> lastPosition; //last legal position on a route 58 59 //tile where the car currently is 60 unsigned int currentTile; 61 unsigned int currentRoute; 62 63 //Cached from settings: 64 bool m_CanCrash; 65 }; 66 67 #endif 68