Constants.hh

00001 /*
00002 ** TowBowlTactics, an adaptation of the tabletop game Blood Bowl.
00003 **
00004 ** Copyright (C) 2006, 2007 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 "BaseRules.hh"
00021 
00024 
00026 enum {
00027   GS_INITGAME = 1,  
00028   GS_INITHALF,      
00029   GS_DRAWKICKER,    
00030   GS_INITKICKOFF,   
00031   GS_KICKOFF,       
00032   GS_TOUCHBACK,     
00033   GS_COACH1,        
00034   GS_COACH2,        
00035 // Team status.
00036   GS_REROLL,        
00037   GS_BLOCK,         
00038   GS_PUSH,          
00039   GS_FOLLOW,        
00040   GS_SKILL          
00041 };
00042 
00043 // Field limits.
00044 const int COLS             = 15;  
00045 const int ROWS             = 26;  
00046 const int SIDE             = 4;   
00047 
00049 const int MAX_PLAYER       = 16;
00050 
00051 // Constants that can be returned by the API.
00052 const int INVALID_ACTION   = -4;  
00053 const int BAD_TEAM         = -3;  
00054 const int BAD_PLAYER       = -2;  
00055 const int BAD_ARGUMENT     = -1;  
00056 const int SUCCESS          = 0;   
00057 
00061 enum {
00062   MSG_CHAT = 0,       
00063   MSG_ILLEGAL,        
00064   MSG_INITGAME,       
00065   MSG_INITHALF,       
00066   MSG_DRAWKICKER,     
00067   MSG_INITKICKOFF,    
00068   MSG_CHEATDICE,      
00069   MSG_RESULT,         
00070   MSG_BLOCKRESULT,    
00071   MSG_BLOCKDICE,      
00072   MSG_FOLLOW,         
00073   MSG_REROLL,         
00074   MSG_NEWTURN,        
00075   MSG_ENDTURN,        
00076   MSG_ENDGAME,        
00077   MSG_BALLPOS,        
00078   MSG_GIVEBALL,       
00079   MSG_WEATHER,        
00080   MSG_TIMER,          
00081   MSG_TURNOVER,       
00082   MSG_TOUCHDOOOWN,    
00083   MSG_TEAMINFO,       
00084   MSG_PLAYERCREATE,   
00085   MSG_PLAYERPOS,      
00086   MSG_PLAYERKNOCKED,  
00087   MSG_PLAYERSTATUS,   
00088   MSG_PLAYERKO,       
00089   MSG_SKILL,          
00090   MSG_ROLLINFO, // FIXME: complete usage ... TODO: remember which usage ... if any ...
00091   MSG_MOVETURNMARKER, 
00092   MSG_ILLEGALPROC,    
00093   MSG_DECLARE,        
00094   MSG_MOVE,           
00095   MSG_STANDUP,        
00096   MSG_BLOCK,          
00097   MSG_BLOCKPUSH,      
00098   MSG_MULTIBLOCK,     
00099   MSG_PASS,           
00100 
00101   RULES_TOKEN_LAST
00102 };
00103 
00107 enum eStatus {
00108   STA_UNASSIGNED = 0,
00109 
00110   // Common status
00111   STA_RESERVE,    
00112   STA_STANDING,   
00113   STA_PRONE,      
00114   STA_STUNNED,    
00115   STA_KO,         
00116   STA_INJURED,    
00117   STA_SENTOFF,    
00118 
00119   STA_LAST = STA_SENTOFF
00120 
00121   // skill/trait related... for futur usage
00122   //STA_ROOTED,
00123   //STA_BONEHEAD,
00124   //STA_STUPID,
00125   //STA_GAZE
00126 };
00127 
00131 enum eDeclaredAction {
00132   DCL_UNASSIGNED = 0,
00133 
00134   DCL_MOVE,     
00135   DCL_BLOCK,    
00136   DCL_BLITZ,    
00137   DCL_PASS,     
00138 
00139   DCL_LAST = DCL_PASS
00140 
00141   // extra rules actions:
00142   //DCL_HANDOFF,  ///< Hand-off, only one per turn.
00143   //DCL_FOUL,    ///< Foul, only one per turn.
00144 };
00145 
00148 enum eRealAction {
00149   ACT_UNASSIGNED = 0,
00150 
00151   ACT_BLOCK,      
00152   ACT_MOVE,       
00153   ACT_STANDUP,    
00154   ACT_THROW,      
00155 
00156   ACT_LAST = ACT_THROW
00157 
00158   // extra rules actions:
00159   //ACT_AGGRESS,
00160   //ACT_GATHER,
00161   //ACT_GOFORIT,
00162   //ACT_HANDOFF,
00163   //ACT_LEAP,
00164   //ACT_THROWTM,
00165   //ACT_TRANSMIT,
00166 };
00167 
00171 enum eRoll {
00172   R_UNASSIGNED = 0,
00173 
00174   R_ARMOUR,   
00175   R_BLOCK,    
00176   R_CATCH,    
00177   R_DODGE,    
00178   R_INJURY,   
00179   R_PICKUP,   
00180   R_STANDUP,  
00181   R_THROW,    
00182 
00183   R_LAST = R_THROW
00184 };
00185 
00189 enum eSkill {
00190   SK_UNASSIGNED = 0,
00191 
00192   SK_BLOCK,         
00193   SK_CATCH,         
00194   SK_DODGE,         
00195 
00196   SK_PASS,          
00197   SK_SUREHANDS,     
00198 
00199   SK_LAST = SK_SUREHANDS
00200 };
00201 
00204 enum eTurnOverMotive {
00205   TOM_UNASSIGNED = 0,
00206 
00207   TOM_KNOCKEDDOWN,    
00208   TOM_LOSTBALL,       
00209 
00210 
00211   TOM_FAILEDPICKUP,   
00212   TOM_TOUCHDOOOWN,    
00213   TOM_TIMEEXCEEDED,   
00214   TOM_FUMBLEDPASS,    
00215   TOM_THROWNTMFAILED, 
00216 
00217   TOM_EJECTEDFORAFOUL,
00218 
00219   TOM_LAST = TOM_EJECTEDFORAFOUL
00220 };
00221 
00224 enum eError {
00225   ERR_UNASSIGNED = 0,
00226 
00227   ERR_UNREADABLE,               
00228   ERR_WRONGCONTEXT,             
00229   ERR_ALREADYEXISTS,            
00230   ERR_NONEXISTENTPLAYER,        
00231   ERR_CANNOTENTERINPLAY,        
00232   ERR_TOOMANYPLAYERSINWIDEZONE, 
00233   ERR_LINEOFSCRIMMAGENOTFILLED, 
00234   ERR_TOOMANYPLAYERSINRESERVE,  
00235   ERR_INVALIDBALLPLACEMENT,     
00236   ERR_CANNOTCARRYTHEBALL,       
00237   ERR_HASPLAYED,                
00238   ERR_ISPLAYING,                
00239   ERR_SINGLEACTIONUSED,         
00240   ERR_DOESNTOWNTHEBALL,         
00241   ERR_CANTPASSTOTHECROWD,       
00242   ERR_CANTPASSTHATFARAWAY,      
00243   ERR_NOTENOUGHMOVEMENT,        
00244   ERR_NOTADJACENTSQUARE,        
00245   ERR_NOTEMPTYSQUARE,           
00246 
00247   ERR_LAST = ERR_NOTEMPTYSQUARE
00248 };
00249 
00250 
00253 extern const char *bb5_token_str[RULES_TOKEN_LAST];
00254 
00255 
00256 /*
00257 ** Messages (Packet) used to control game status.
00258 */
00259 
00266 DECLARE_PACKET(MSG_INITGAME, MsgInitGame)
00267   int time_per_turn;  
00268 END_PACKET;
00269 
00276 DECLARE_PACKET(MSG_INITHALF, MsgInitHalf)
00277   int cur_half; 
00278 END_PACKET;
00279 
00286 DECLARE_PACKET(MSG_DRAWKICKER, MsgDrawKicker);
00291   int kickoff;
00292 END_PACKET;
00293 
00300 DECLARE_PACKET(MSG_INITKICKOFF, MsgInitKickoff);
00301   int place_team; 
00302 END_PACKET;
00303 
00310 DECLARE_PACKET(MSG_NEWTURN, MsgNewTurn)
00311   int cur_half; 
00312   int cur_turn; 
00313 END_PACKET;
00314 
00321 DECLARE_EMPTY_PACKET(MSG_ENDTURN, MsgEndTurn);
00322 
00329 DECLARE_EMPTY_PACKET(MSG_ENDGAME, MsgEndGame);
00330 
00337 DECLARE_PACKET(MSG_TIMER, MsgTimer)
00338   bool pause;         
00339   int time_remaining; 
00340 END_PACKET;
00341 
00348 DECLARE_PACKET(MSG_TURNOVER, MsgTurnOver)
00349   int motive; 
00350 END_PACKET;
00351 
00359 DECLARE_EMPTY_PACKET(MSG_MOVETURNMARKER, MsgMoveTurnMarker);
00360 
00368 DECLARE_EMPTY_PACKET(MSG_ILLEGALPROC, MsgIllegalProc);
00369 
00377 DECLARE_PACKET(MSG_CHAT, MsgChat)
00378   int msg[32];  
00379 END_PACKET;
00380 
00387 // A coach tried something forbidden.
00388 DECLARE_PACKET(MSG_ILLEGAL, MsgIllegal)
00389   int was_token;  
00390   int error;      
00391 END_PACKET;
00392 
00394 
00395 #endif /* !CONSTANTS_HH_ */

Generated on Sat Jun 23 16:07:23 2007 for Stechec/TBT by  doxygen 1.4.7