Api.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 API_HH_
00018 # define API_HH_
00019 
00020 # include "rules/BaseApi.hh"
00021 # include "CRules.hh"
00022 # include "CMatch.hh"
00023 
00035 class Api : public BaseApi<CRules>
00036 {
00037 public:
00038   Api(CRules* rules);
00039   ~Api();
00040  
00047 
00051   int                   turn() const;
00052 
00055   int                   half() const;
00056  
00059   int                   myTeamId() const;
00060 
00063   int                   getActiveTeamId() const;
00064 
00067   Coordinates            ball() const;
00070   const CPlayer*        getBallOwner() const;
00071 
00075   const char*           gameStateString() const;
00076 
00082   int                   canMakeRequest() const;
00083 
00089   int                   mustMakeChoice() const;
00090 
00094   int                   teamId(const Coordinates& coord);
00095   
00100   int                   selectTeam(int team_id);
00103   const CTeam*          getTeam() const;
00104 
00110   int                   selectPlayer(int player_id);
00111   
00115   int                   selectSkilledPlayer(int player_id);
00116   
00120   int                   playerId(const Coordinates& coord);
00121 
00124   const CPlayer*        getPlayer() const;
00128   const CPlayer*        getPlayer(int player_id);
00133   const CPlayer*        getPlayer(const Coordinates& coord);
00136   const CPlayer*        getActivePlayer() const;
00137   
00140   int                   actionPossibleNumber();
00141 
00146   int                   actionPossible(int index) const;
00147 
00150   int                   effortPossibleNumber();
00151 
00156   int                   effortPossible(int index) const;
00157 
00162   int                   isEffortPossible(int effort) const;
00163 
00169   int                   moveLength(const Coordinates& to);
00170 
00176   int                   moveDifficulty(int step);
00177 
00183   Coordinates            movePath(int step);
00184 
00189   int                   movePossible(const Coordinates& to);
00190 
00197   int                   blockDicesNumber(const Coordinates& to) const;
00198 
00201   int                   blockDicesNumberPadding() const;
00202 
00207   int                   throwDifficulty(const Coordinates& to) const;
00208 
00211   int           remainingTime() const;
00212 
00215   int           isTimerPaused() const;
00216   
00219   const Weather*        getWeather() const;
00220   
00222 
00223 
00235 
00237   int           doEndTurn();
00238 
00240   int           doCalmDown();
00241 
00243   int           doCelebrate();
00244 
00246   int           doMoveTurnMarker();
00247 
00249   int           doAskIllegalProcedure();
00250 
00255   int           doChooseKickoff(bool kickoff);
00256 
00262   int           doPlacePlayer(const Coordinates& coord);
00263 
00269   int           doPlaceTeam(int formation_id);
00270 
00272   int           doEndPlacement();
00273 
00276   int           doPlaceBall(const Coordinates& coord);
00277 
00281   int           doGiveBall(int p);
00282 
00286   int           doReroll(bool reroll);
00287 
00292   int           doUseSkill(enum eSkill skill, bool useIt);
00293 
00296   int           doBeginAction(enum eAction action);
00297 
00300   int           doEndAction();
00301 
00306   int           doChooseBlockDice(int n);
00307 
00312   int           doBlockPush(int n);
00313 
00317   int           doFollow(bool follow);
00318 
00324   int           doEffort(enum eEffort effort, const Coordinates& to);
00325 
00329   int           doStandUpPlayer();
00330 
00334   int           doMovePlayer(const Coordinates& to);
00335 
00339   int           doBlockPlayer(int def_p);
00340 
00344   int           doPassPlayer(const Coordinates& to);
00345 
00348   int           doCheatDice(int roll);
00349 
00352   int           sendChatMessage(const std::string& msg);
00353 
00355   int           sendDebugRequest();
00356 
00358 
00359 
00360 private:
00361   CTeam*                selected_team_;
00362   CPlayer*              selected_player_;
00363   CPlayer*              skilled_player_;
00364   const CoordList*      player_path_;
00365   bool                  possible_actions_[ACT_LAST];
00366   bool                  possible_efforts_[EFF_LAST];
00367 };
00368 
00369 # include "Api.hxx"
00370 
00371 #endif /* !API_HH_ */
Generated on Mon Apr 5 21:17:11 2010 for Stechec/TBT by  doxygen 1.6.3