00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifndef RCSC_GAME_MODE_H
00033 #define RCSC_GAME_MODE_H
00034
00035 #include <rcsc/game_time.h>
00036 #include <rcsc/types.h>
00037
00038 #include <string>
00039 #include <map>
00040 #include <utility>
00041
00042 namespace rcsc {
00043
00051 class GameMode {
00052 public:
00053
00057 enum Type {
00058 BeforeKickOff,
00059 TimeOver,
00060 PlayOn,
00061 KickOff_,
00062 KickIn_,
00063 FreeKick_,
00064 CornerKick_,
00065 GoalKick_,
00066 AfterGoal_,
00067
00068 OffSide_,
00069 PenaltyKick_,
00070 FirstHalfOver,
00071 Pause,
00072 Human,
00073 FoulCharge_,
00074 FoulPush_,
00075 FoulMultipleAttacker_,
00076 FoulBallOut_,
00077 BackPass_,
00078 FreeKickFault_,
00079
00080 CatchFault_,
00081 IndFreeKick_,
00082
00083 PenaltySetup_,
00084 PenaltyReady_,
00085 PenaltyTaken_,
00086 PenaltyMiss_,
00087 PenaltyScore_,
00088
00089
00090 PenaltyOnfield_,
00091 PenaltyFoul_,
00092
00093
00094
00095 GoalieCatch_,
00096 ExtendHalf,
00097 MODE_MAX
00098 };
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 typedef std::pair< Type, rcsc::SideID > Pair;
00174
00175 private:
00176
00178 GameTime M_time;
00179
00181 Type M_type;
00183 SideID M_side;
00184
00186 int M_score_left;
00188 int M_score_right;
00189 public:
00193 GameMode();
00194
00202 bool update( const std::string & mode_str,
00203 const GameTime & current );
00204
00205 private:
00211 Pair parse( const std::string & mode_str );
00212
00213 public:
00214
00219 const
00220 GameTime & time() const
00221 {
00222 return M_time;
00223 }
00224
00229 Type type() const
00230 {
00231 return M_type;
00232 }
00233
00238 SideID side() const
00239 {
00240 return M_side;
00241 }
00242
00247 int scoreLeft() const
00248 {
00249 return M_score_left;
00250 }
00251
00256 int scoreRight() const
00257 {
00258 return M_score_right;
00259 }
00260
00265 bool isServerCycleStoppedMode() const;
00266
00271 bool isGameEndMode() const;
00272
00277 bool isPenaltyKickMode() const;
00278
00284 bool isOurSetPlay( const SideID ourside ) const;
00285
00290 PlayMode getServerPlayMode() const;
00291
00297 std::ostream & print( std::ostream & os ) const;
00298 };
00299
00300 }
00301
00302 #endif