OptionsTransient.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(__INCLUDE_OptionsTransienth_INCLUDE__)
00022 #define __INCLUDE_OptionsTransienth_INCLUDE__
00023 
00024 #include <common/Vector.h>
00025 #include <common/OptionsScorched.h>
00026 #include <net/NetBuffer.h>
00027 
00028 class TankContainer;
00029 class OptionsTransient
00030 {
00031 public:
00032         OptionsTransient(OptionsScorched &optionsGame);
00033         virtual ~OptionsTransient();
00034 
00035         const char *getGameType();
00036         unsigned int getLeastUsedTeam(TankContainer &container);
00037 
00038         enum WallType
00039         {
00040                 wallConcrete = 0,
00041                 wallBouncy = 1,
00042                 wallWrapAround = 2,
00043                 wallNone = 3
00044         };
00045         enum WallSide
00046         {
00047                 LeftSide = 0,
00048                 RightSide,
00049                 TopSide,
00050                 BotSide
00051         };
00052 
00053         void reset();
00054         void newGame();
00055         void nextRound();
00056 
00057         void startNewGame();
00058         void startNewRound();
00059 
00060         // Walls
00061         WallType getWallType() { return (WallType) wallType_.getValue(); }
00062         Vector &getWallColor();
00063 
00064         // Rounds left
00065         int getCurrentRoundNo() { return currentRoundNo_.getValue(); }
00066         int getCurrentGameNo() { return currentGameNo_.getValue(); }
00067 
00068         // Wind
00069         fixed getWindAngle() { return windAngle_.getValue(); }
00070         fixed getWindSpeed() { return windSpeed_.getValue(); }
00071         FixedVector &getWindDirection() { return windDirection_.getValue(); }
00072         bool getWindOn() { return (windSpeed_.getValue() > fixed(0)); }
00073 
00074         // Arms Level
00075         int getArmsLevel();
00076 
00077         // Used to send this structure over coms
00078         bool writeToBuffer(NetBuffer &buffer);
00079         bool readFromBuffer(NetBufferReader &reader);
00080 
00081 protected:
00082         std::list<OptionEntry *> options_;
00083         OptionsScorched &optionsGame_;
00084         OptionEntryInt currentRoundNo_;
00085         OptionEntryInt currentGameNo_;
00086         OptionEntryFixed windAngle_;
00087         OptionEntryFixed windStartAngle_;
00088         OptionEntryFixed windSpeed_;
00089         OptionEntryFixedVector windDirection_;
00090         OptionEntryInt wallType_;
00091 
00092         bool newGame_;
00093         void newGameWind();
00094         void newGameWall();
00095         void nextRoundWind();
00096 
00097 };
00098 
00099 #endif

Generated on Mon Feb 16 15:14:49 2009 for Scorched3D by  doxygen 1.5.3