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(WayOrder_h)
00031 #define WayOrder_h
00032
00033 class Player;
00034 class TiXmlNode;
00035 class Planet;
00036 class Salvage;
00037 class Fleet;
00038
00039 #include "Location.h"
00040
00041 typedef unsigned long OrderType;
00042 const OrderType OT_NONE = 0;
00043 const OrderType OT_COLONIZE = 1;
00044 const OrderType OT_REMOTEMINE = 2;
00045 const OrderType OT_SCRAP = 3;
00046 const OrderType OT_ROUTE = 4;
00047 const OrderType OT_MERGE = 5;
00048 const OrderType OT_LAYMINE = 6;
00049 const OrderType OT_TRANSFER = 7;
00050 const OrderType OT_PATROL = 8;
00051 const OrderType OT_TRANSPORT = 9;
00052
00058 class WayOrder {
00059 public:
00060 WayOrder(Location * loc, bool ForMeOnly = false) : mLoc(loc), mForMeOnly(ForMeOnly), mSpeed(0), mOrder(OT_NONE) {}
00061 WayOrder(const WayOrder & copy);
00062 virtual ~WayOrder();
00063 TiXmlNode * WriteNode(TiXmlNode * node) const;
00064
00065 OrderType GetType() const { return mOrder; }
00066 void SetType(OrderType ot) { mOrder = ot; }
00067 Location * NCGetLocation() { return mLoc; }
00068 const Location * GetLocation() const { return mLoc; }
00069 void SetLocation(Location * loc, bool fmo = false);
00070 long GetSpeed() const { return mSpeed; }
00071 void SetSpeed(long s) { mSpeed = s; }
00072
00073 WayOrder * Copy() const;
00074
00075 protected:
00076 Location * mLoc;
00077 bool mForMeOnly;
00078 long mSpeed;
00079 OrderType mOrder;
00080
00081 friend class WayOrderList;
00082 };
00083
00084 class WayOrderNumber : public WayOrder {
00085 public:
00086 WayOrderNumber(long number, Location * loc, bool ForMeOnly = false) : WayOrder(loc, ForMeOnly), mNumber(number) {}
00087 WayOrderNumber(const WayOrderNumber & copy) : WayOrder(copy), mNumber(copy.mNumber) {}
00088 virtual ~WayOrderNumber();
00089 TiXmlNode * WriteNode(TiXmlNode * node) const;
00090
00091 protected:
00092 long mNumber;
00093 };
00094
00095 class WayOrderPatrol : public WayOrder {
00096 public:
00097 WayOrderPatrol(long speed, long range, Location * loc, bool ForMeOnly = false) : WayOrder(loc, ForMeOnly), mPatrolSpeed(speed), mRange(range) {}
00098 WayOrderPatrol(const WayOrderPatrol & copy) : WayOrder(copy), mPatrolSpeed(copy.mPatrolSpeed), mRange(copy.mRange) {}
00099 virtual ~WayOrderPatrol();
00100 TiXmlNode * WriteNode(TiXmlNode * node) const;
00101
00102 protected:
00103 long mPatrolSpeed;
00104 long mRange;
00105 };
00106
00107 class WayOrderTransport : public WayOrder {
00108 public:
00109 WayOrderTransport(Location * loc, bool ForMeOnly = false);
00110 WayOrderTransport(const WayOrderTransport & copy);
00111 virtual ~WayOrderTransport();
00112 bool ParseNode(const TiXmlNode * node, Player * player);
00113 TiXmlNode * WriteNode(TiXmlNode * node) const;
00114 TransferType GetAction(int i) const { return actions[i]; }
00115 long GetValue(int i) const { return values[i]; }
00116
00117 protected:
00118 deque<TransferType> actions;
00119 deque<long> values;
00120 };
00121
00122 #endif // !defined(WayOrder_h)