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

WayOrder.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(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;        // true if mLoc is For Me Only, and I need to delete it when done.
00078         long mSpeed;            // -1 to gate
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;      // 0 for automatic
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)

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