TankAI.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D 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 //    Scorched3D 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 Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_TankAI_H__5F21C9C7_0F71_4CCC_ABB9_976CF0A5C5EC__INCLUDED_)
00022 #define AFX_TankAI_H__5F21C9C7_0F71_4CCC_ABB9_976CF0A5C5EC__INCLUDED_
00023 
00024 #include <engine/ScorchedCollisionIds.h>
00025 #include <common/Vector.h>
00026 #include <common/ToolTip.h>
00027 #include <string>
00028 
00029 class Weapon;
00030 class XMLNode;
00031 class Tank;
00032 class TankAI
00033 {
00034 public:
00035         TankAI();
00036         virtual ~TankAI();
00037 
00038         // Instance init
00039         virtual TankAI *createCopy(Tank *tank) = 0;
00040 
00041         // Onetime init
00042         virtual bool parseConfig(XMLNode *node);
00043 
00044         // Other
00045         virtual const char *getName() { return name_.c_str(); }
00046         virtual const char *getDescription() { return description_.c_str(); }
00047         virtual ToolTip *getToolTip();
00048 
00049         // Notification of actions to perform
00050         virtual void newMatch() = 0;
00051         virtual void newGame() = 0;
00052         virtual void playMove() = 0;
00053         virtual void buyAccessories() = 0;
00054         virtual void autoDefense() = 0;
00055 
00056         // Notification of actions happened
00057         virtual void tankHurt(Weapon *weapon, float damage, 
00058                 unsigned int damaged, unsigned int firer) = 0;
00059         virtual void shotLanded(ScorchedCollisionId collision,
00060                 Weapon *weapon, unsigned int firer, 
00061                 Vector &position) = 0;
00062 
00063         // Indicates if this computer ai is available for choice by
00064         // the random tank ai type
00065         virtual bool availableForRandom() { return availableForRandom_; }
00066         virtual bool availableForPlayers() { return availableForPlayers_; }
00067 
00068 protected:
00069         std::string name_, description_;
00070         bool availableForRandom_;
00071         bool availableForPlayers_;
00072         ToolTip toolTip_;
00073 
00074 };
00075 
00076 #endif // !defined(AFX_TankAI_H__5F21C9C7_0F71_4CCC_ABB9_976CF0A5C5EC__INCLUDED_)

Generated on Mon Feb 16 15:14:53 2009 for Scorched3D by  doxygen 1.5.3