Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List

Battle.h

Go to the documentation of this file.
00001 /*
00002 Copyright 2003 - 2005 Elliott Kleinrock, Dan Neely, Kurt W. Over, Damon Domjan
00003 
00004 This file is part of FreeStars, a free clone of the Stars! game.
00005 
00006 FreeStars 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 FreeStars 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 FreeStars; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 The full GPL Copyright notice should be in the file COPYING.txt
00021 
00022 Contact:
00023 Email Elliott at 9jm0tjj02@sneakemail.com
00024 */
00025 
00030 #if !defined(Battle_h)
00031 #define Battle_h
00032 
00039 class Battle : public Location {
00040 public:
00041         Battle(const Location & loc);
00042         virtual ~Battle();
00043 
00044         void AddFleet(Fleet * fleet);
00045         void SetPlanet(Planet * planet) { mBPlanet = planet; }
00046         void AddFleets();
00047         void Resolve();
00048         static void SetStartPos();
00049         static void Cleanup();
00050 
00051 protected:
00052         long GetRange(const Stack * s1, const Stack * s2, int dx = 0, int dy = 0) const;
00053         bool FightRound();
00054         long GetSpeed(long speed, long round);
00055         bool MoveStack(long j);
00056 
00057         // Gatling flag: false-> return damage from all weapons, including gatlings, true-> return just gatling damage
00058         long PotentialDamage(const Stack * shoot, const Stack * target, long Range, const Slot * slot, bool Gatling = false) const;
00059         const Stack * GetTarget(const Stack * hunter, HullType hc, long Range, const Slot * slot) const;
00060 
00061         long mRound;
00062 
00063         deque<Fleet *> mThere;
00064         deque<Stack *> mFighting;
00065         deque<Slot *> mFireOrder;
00066         Planet * mBPlanet;
00067         bool mBaseFight;
00068         TiXmlElement * bReport;
00069 
00070         static long **StartX;
00071         static long **StartY;
00072 
00073         class bSlot {
00074         public:
00075                 bSlot(const Slot * sl, Stack * st) : slot(sl), stack(st) { init = stack->GetDesign()->GetNetInit() + slot->GetComp()->GetInit(); }
00076                 ~bSlot() {}
00077 
00078                 const Slot * slot;
00079                 Stack * stack;
00080                 long init;
00081         };
00082 
00083         static bool HighInit(const bSlot& s1, const bSlot& s2);
00084         deque<bSlot> mSlots;
00085         void ShootSlot(bSlot & shooter);
00086 };
00087 
00088 #endif // !defined(Battle_h)

Generated on Mon Aug 8 21:33:42 2005 for Freestars by  doxygen 1.4.2-20050421