Constants.hh

00001 /*
00002 ** TowBowlTactics, a turn-based strategy football game.
00003 **
00004 ** Copyright (C) 2006-2010 The TBT Team.
00005 **
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 **
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 **
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
00015 */
00016 
00017 #ifndef CONSTANTS_HH_
00018 # define CONSTANTS_HH_
00019 
00020 # include "rules/BaseRules.hh"
00021 
00024 
00027 enum {
00028   GS_UNASSIGNED = 0,
00029 
00030   GS_INITGAME,      
00031   GS_INITHALF,      
00032   GS_DRAWKICKER,    
00033   GS_INITKICKOFF,   
00034   GS_KICKOFF,       
00035   GS_TOUCHBACK,     
00036   GS_TOUCHDOOOWN,   
00037   GS_CELEBRATE,     
00038   GS_TURN,          
00039 // Team state.
00040   GS_REROLL,        
00041   GS_BLOCK,         
00042   GS_PUSH,          
00043   GS_FOLLOW,        
00044   GS_SKILL,         
00045 
00046   GS_LAST = GS_SKILL
00047 };
00048 
00051 extern const char *bb5_gamestate_str[1 + GS_LAST];
00052 
00054 const int MAX_PERIOD       = 5;
00055 
00058 extern const char *bb5_period_str[1 + MAX_PERIOD];
00059 
00060 // Field limits.
00061 const int COLS             = 15;  
00062 const int ROWS             = 26;  
00063 const int SIDE             = 4;   
00064 
00065 // Team identifiants.
00066 const int HOME             = 0;   
00067 const int VISITOR          = 1;   
00068 
00070 const int MAX_PLAYER       = 16;
00071 
00072 // Constants that can be returned by the API.
00073 const int INVALID_REQUEST  = -4;  
00074 const int BAD_TEAM         = -3;  
00075 const int BAD_PLAYER       = -2;  
00076 const int BAD_ARGUMENT     = -1;  
00077 const int SUCCESS          = 0;   
00078 
00082 enum {
00083   MSG_CHAT = 0,       
00084   MSG_DEBUG,          
00085   MSG_ILLEGAL,        
00086   MSG_INITGAME,       
00087   MSG_INITHALF,       
00088   MSG_DRAWKICKER,     
00089   MSG_INITKICKOFF,    
00090   MSG_TOUCHBACK,      
00091   MSG_CHEATDICE,      
00092   MSG_RESULT,         
00093   MSG_BLOCKRESULT,    
00094   MSG_BLOCKDICE,      
00095   MSG_FOLLOW,         
00096   MSG_REROLL,         
00097   MSG_NEWTURN,        
00098   MSG_ENDTURN,        
00099   MSG_ENDGAME,        
00100   MSG_CANCELGAME,     
00101   MSG_BALLCOORD,      
00102   MSG_BALLOWNER,      
00103   MSG_WEATHER,        
00104   MSG_TIMER,          
00105   MSG_TURNOVER,       
00106   MSG_TOUCHDOOOWN,    
00107   MSG_TEAMINFO,       
00108   MSG_PLAYERCREATE,   
00109   MSG_PLAYERCOORD,    
00110   MSG_PLAYERKNOCKED,  
00111   MSG_PLAYERSTATUS,   
00112   MSG_PLAYERMAREMAIN, 
00113   MSG_SKILL,          
00114   MSG_ROLLINFO, // FIXME: complete usage ... TODO: remember which usage ... if any ...
00115   MSG_MOVETURNMARKER, 
00116   MSG_ILLEGALPROC,    
00117   MSG_ACTION,         
00118   MSG_EFFORT,         
00119   MSG_REQUESTPROCESSED,
00120   MSG_MOVE,           
00121   MSG_STANDUP,        
00122   MSG_BLOCK,          
00123   MSG_BLOCKPUSH,      
00124   MSG_MULTIBLOCK,     
00125   MSG_FOUL,           
00126   MSG_HANDOFF,        
00127   MSG_PASS,           
00128 
00129   RULES_TOKEN_LAST
00130 };
00131 
00134 extern const char *bb5_token_str[RULES_TOKEN_LAST];
00135 
00138 enum eStatus {
00139   STA_UNASSIGNED = 0,
00140 
00141   // Common status
00142   STA_RESERVE,    
00143   STA_STANDING,   
00144   STA_PRONE,      
00145   STA_STUNNED,    
00146   STA_KO,         
00147   STA_INJURED,    
00148   STA_SENTOFF,    
00149 
00150   STA_LAST = STA_SENTOFF
00151 
00152   // skill/trait related... for futur usage
00153   //STA_ROOTED,
00154   //STA_BONEHEAD,
00155   //STA_STUPID,
00156   //STA_GAZE
00157 };
00158 
00161 extern const char *bb5_playerstatus_str[1 + STA_LAST];
00162 
00165 enum eAction {
00166   ACT_UNASSIGNED = 0,
00167 
00168   ACT_MOVE,     
00169   ACT_BLOCK,    
00170   ACT_BLITZ,    
00171   ACT_FOUL,     
00172   ACT_PASS,     
00173   ACT_TRANSMIT, 
00174 
00175   ACT_LAST = ACT_TRANSMIT
00176 };
00177 
00180 extern const char *bb5_action_str[1 + ACT_LAST];
00181 
00184 enum eEffort {
00185   EFF_UNASSIGNED = 0,
00186 
00187   EFF_BLOCK,      
00188   EFF_FOUL,       
00189   EFF_HANDOFF,    
00190   EFF_MOVE,       
00191   EFF_STANDUP,    
00192   EFF_THROW,      
00193 
00194   EFF_LAST = EFF_THROW
00195 
00196   // extra rules efforts:
00197   //EFF_GATHER,
00198   //EFF_GOFORIT,
00199   //EFF_LEAP,
00200   //EFF_THROWTM,
00201 };
00202 
00205 extern const char *bb5_effort_str[1 + EFF_LAST];
00206 
00209 enum eRoll {
00210   R_UNASSIGNED = 0,
00211 
00212   R_ARMOUR,   
00213   R_BLOCK,    
00214   R_CATCH,    
00215   R_DODGE,    
00216   R_INJURY,   
00217   R_PICKUP,   
00218   R_REGENERATE, 
00219   R_STANDUP,  
00220   R_TAME,     
00221   R_THROW,    
00222   R_WAKEUP,   
00223 
00224   R_LAST = R_WAKEUP
00225 };
00226 
00229 extern const char *bb5_roll_str[1 + R_LAST];
00230 
00233 enum eSkill {
00234   SK_UNASSIGNED = 0,
00235 
00236   SK_BLOCK,         
00237   SK_CATCH,         
00238   SK_CLAWS,         
00239 
00240   SK_DODGE,         
00241 
00242   SK_GUARD,         
00243   SK_HORNS,         
00244   SK_MIGHTYBLOW,    
00245 
00246   SK_PASS,          
00247   SK_REGENERATION,  
00248   SK_SUREHANDS,     
00249   SK_STRONGARM,     
00250   SK_STUNTY,        
00251 
00252   SK_TACKLE,        
00253   SK_TITCHY,        
00254 
00255   SK_THICKSKULL,    
00256   SK_WILDANIMAL,    
00257 
00258 
00259   SK_LAST = SK_WILDANIMAL
00260 };
00261 
00264 extern const char *bb5_skill_str[1 + SK_LAST];
00265 
00268 enum eTurnOverMotive {
00269   TOM_UNASSIGNED = 0,
00270 
00271   TOM_KNOCKEDDOWN,    
00272   TOM_LOSTBALL,       
00273 
00274 
00275   TOM_FAILEDPICKUP,   
00276   TOM_TOUCHDOOOWN,    
00277   TOM_TIMEEXCEEDED,   
00278   TOM_FUMBLEDPASS,    
00279   TOM_THROWNTMFAILED, 
00280 
00281   TOM_EJECTEDFORAFOUL,
00282 
00283   TOM_LAST = TOM_EJECTEDFORAFOUL
00284 };
00285 
00288 extern const char *bb5_turnovermotive_str[1 + TOM_LAST];
00289 
00292 enum eError {
00293   ERR_UNASSIGNED = 0,
00294 
00295   ERR_UNREADABLE,               
00296   ERR_WRONGCONTEXT,             
00297   ERR_INVALIDTEAMINFO,          
00298   ERR_ALREADYEXISTS,            
00299   ERR_INVALIDPLAYERINFO,        
00300   ERR_NONEXISTENTPLAYER,        
00301   ERR_CANNOTENTERINPLAY,        
00302   ERR_ALREADYHERE,              
00303   ERR_PLAYERSINOPPOSITEHALF,    
00304   ERR_TOOMANYPLAYERSINWIDEZONE, 
00305   ERR_LINEOFSCRIMMAGENOTFILLED, 
00306   ERR_TOOMANYPLAYERSINTHEFIELD, 
00307   ERR_TOOMANYPLAYERSINRESERVE,  
00308   ERR_INVALIDBALLPLACEMENT,     
00309   ERR_CANNOTCARRYTHEBALL,       
00310   ERR_HASPLAYED,                
00311   ERR_ISPLAYING,                
00312   ERR_SINGLEACTIONUSED,         
00313   ERR_ACTIONMISSEFFORT,         
00314   ERR_NOTACTIVEPLAYER,          
00315   ERR_SINGLEEFFORTUSED,         
00316   ERR_PLAYERSTATUS,             
00317   ERR_NONEXISTENTTARGET,        
00318   ERR_DOESNTOWNTHEBALL,         
00319   ERR_CANTPASSTOTHECROWD,       
00320   ERR_CANTPASSTHATFARAWAY,      
00321   ERR_NOTENOUGHMOVEMENT,        
00322   ERR_NOTADJACENTSQUARE,        
00323   ERR_NOTEMPTYSQUARE,           
00324   ERR_USEDTEAMREROLL,           
00325   ERR_NOTSKILLED,               
00326   ERR_USEDSKILL,                
00327 
00328   ERR_LAST = ERR_USEDSKILL
00329 };
00330 
00333 extern const char *bb5_error_str[1 + ERR_LAST];
00334 
00335 
00336 /*
00337 ** Messages (Packet) used to control game state.
00338 */
00339 
00346 DECLARE_PACKET(MSG_INITGAME, MsgInitGame)
00347   int time_per_turn;  
00348 END_PACKET;
00349 
00356 DECLARE_PACKET(MSG_INITHALF, MsgInitHalf)
00357   int cur_half; 
00358 END_PACKET;
00359 
00366 DECLARE_PACKET(MSG_DRAWKICKER, MsgDrawKicker);
00371   int kickoff;
00372 END_PACKET;
00373 
00380 DECLARE_PACKET(MSG_INITKICKOFF, MsgInitKickoff);
00381   int place_team; 
00382 END_PACKET;
00383 
00390 DECLARE_EMPTY_PACKET(MSG_TOUCHBACK, MsgTouchBack);
00391 
00398 DECLARE_PACKET(MSG_NEWTURN, MsgNewTurn)
00399   int cur_half; 
00400   int cur_turn; 
00401 END_PACKET;
00402 
00409 DECLARE_EMPTY_PACKET(MSG_REQUESTPROCESSED, MsgRequestProcessed);
00410 
00417 DECLARE_EMPTY_PACKET(MSG_ENDTURN, MsgEndTurn);
00418 
00425 DECLARE_PACKET(MSG_ENDGAME, MsgEndGame)
00426   bool evacuated; 
00427 END_PACKET;
00428 
00435 DECLARE_EMPTY_PACKET(MSG_CANCELGAME, MsgCancelGame);
00436 
00443 DECLARE_PACKET(MSG_TIMER, MsgTimer)
00444   bool pause;         
00445   int time_remaining; 
00446 END_PACKET;
00447 
00454 DECLARE_PACKET(MSG_TURNOVER, MsgTurnOver)
00455   int motive; 
00456 END_PACKET;
00457 
00465 DECLARE_EMPTY_PACKET(MSG_MOVETURNMARKER, MsgMoveTurnMarker);
00466 
00474 DECLARE_EMPTY_PACKET(MSG_ILLEGALPROC, MsgIllegalProc);
00475 
00483 DECLARE_PACKET(MSG_CHAT, MsgChat)
00484   int msg[32];  
00485 END_PACKET;
00486 
00493 DECLARE_EMPTY_PACKET(MSG_DEBUG, MsgDebug);
00494 
00501 // A coach tried something forbidden.
00502 DECLARE_PACKET(MSG_ILLEGAL, MsgIllegal)
00503   int was_token;  
00504   int error;      
00505 END_PACKET;
00506 
00508 
00509 #endif /* !CONSTANTS_HH_ */
Generated on Mon Apr 5 21:17:11 2010 for Stechec/TBT by  doxygen 1.6.3