Dice.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 _DICE_HH_
00018 # define _DICE_HH_
00019 
00020 # include "Constants.hh"
00021 # include "rules/PacketHandler.hh"
00022 
00023 class BaseRules;
00024 
00031 DECLARE_PACKET(MSG_CHEATDICE, MsgCheatDice)
00032   int next_result; 
00033 END_PACKET;
00034 
00037 
00039 enum eDiceFaceNumber {
00040   D2 = 2,
00041   D3,
00042   D4,
00043   DBLOCK,
00044   D6,
00045   D8 = 8,
00046   D10 = 10,
00047   D12 = 12,
00048   D16 = 16,
00049   D66 = 666 // :)
00050 };
00051 
00053 enum eBlockDiceFace {
00054   BATTACKER_DOWN = 1,
00055   BBOTH_DOWN,
00056   BPUSHED,
00057   BDEFENDER_STUMBLE,
00058   BDEFENDER_DOWN
00059 };
00060 
00062 
00067 class Dice
00068 {
00069  public:
00072   Dice(BaseRules* r);
00074   ~Dice();
00075 
00084   int roll(const std::string& msg, enum eDiceFaceNumber type = D6, int nb_dice = 1);
00085   int roll(enum eRoll bb_roll_type, enum eDiceFaceNumber type = D6, int nb_dice = 1);
00086 
00088   static const char* stringify(enum eBlockDiceFace face);
00090   static const char* stringify(enum eRoll roll);
00091   
00092 private:
00096   int roll(enum eDiceFaceNumber type = D6, int nb_dice = 1);
00097 
00098   void msgCheatDice(const MsgCheatDice* m);
00099   
00100   std::deque<int> cheat_dice_;
00101 };
00102 
00103 #endif // !_DICE_HH_
Generated on Mon Apr 5 21:17:12 2010 for Stechec/TBT by  doxygen 1.6.3