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

BattlePlan.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(BattlePlan_h)
00031 #define BattlePlan_h
00032 
00033 class TiXmlNode;
00034 class Player;
00035 
00036 typedef unsigned long BPTactic;
00037 
00043 class BattlePlan {
00044 public:
00045         BattlePlan(bool defined);
00046 //      BattlePlan(const BattlePlan & c);       Default should be fine
00047         virtual ~BattlePlan();
00048         void SetDefault();
00049 
00050         bool ParseNode(const TiXmlNode * node, Player * owner);
00051         void WriteNode(TiXmlNode * node) const;
00052         void WriteNodeBattle(TiXmlNode * node) const;
00053         bool IsDefined() const  { return mDefined; }
00054         void Undefine()                 { mDefined = false; }
00055         unsigned long GetEnemy() const  { return mEnemy; }
00056         HullType GetPrimary() const     { return mPrimary; }
00057         HullType GetSecondary() const   { return mSecondary; }
00058         BPTactic GetTactic() const              { return mTactic; }
00059         // does 'attacker' want to fight 'defender'
00060         bool WillFight(const Player * attacker, const Player * defender) const;
00061 
00062 protected:
00063         static HullType GetTarget(const char *ptr);
00064         static const char * WriteTarget(HullType target);
00065         string mName;
00066         HullType mPrimary;
00067         HullType mSecondary;
00068         BPTactic mTactic;
00069         unsigned long mEnemy;
00070         bool mDumpCargo;
00071         bool mDefined;  // is this battle plan real
00072 };
00073 
00074 // Battle Plan Tactic
00075 const BPTactic BPT_DISENGAGE    = 0x0001;
00076 const BPTactic BPT_DISIFHIT             = 0x0002;
00077 const BPTactic BPT_MINDAM               = 0x0004;
00078 const BPTactic BPT_MAXNET               = 0x0008;
00079 const BPTactic BPT_MAXRATIO             = 0x0010;
00080 const BPTactic BPT_MAXDAM               = 0x0020;
00081 
00082 // Battle Plan race to target (enemy for this battle plan) - other numbers are player numbers
00083 const unsigned long BPE_NONE                    = ULONG_MAX - 1;
00084 const unsigned long BPE_ENEMY                   = ULONG_MAX - 2;
00085 const unsigned long BPE_ENEMYNEUTRAL    = ULONG_MAX - 3;
00086 const unsigned long BPE_ALL                             = ULONG_MAX - 4;
00087 
00088 #endif // !defined(BattlePlan_h)

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