00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
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)