Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CPathFinder.h
Go to the documentation of this file.
1 // Copyright (C) 2004-2013 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 #ifndef CPATH_FINDER_H
22 #define CPATH_FINDER_H
23 
24 #include "CPathUpdater.h"
25 #include "../PF_LIB/PFManager.h"
26 
27 namespace OpenSkyNet {
28  namespace Core {
30  class CORE_DLL PathFinder : public Updater {
31  std::list<Object*> _continuingObjects;
32  bool _allObjectsFinished;
33  void removeFinishedPiecemealObjects();
34  protected:
35  virtual bool addObject(Object* obj_, Updater::OBJECT_PRIORITY prio_=Updater::OBJ_1, bool isOneShot_=false);
36  virtual bool removeObject(Object* obj_);
37  public:
43  std::vector<Math::Point<int> > _drivBins, _targBins;
44 
46  bool _createSpline, _resetPFVars, _assignToDriver;
48 
49  enum STATUS { NO, NO_BUT_DONT_PF_AGAIN_YET, YES };
51 
53  };
54 
55  PathFinder() : Updater(Updater::PATH_FINDER, "PATH_FINDER", Updater::UPD_6, 1.0f), _allObjectsFinished(true) {
56  if (!CD::g_initialGrid) CD::Grid::init(32,32,32,0);
57  }
59 
60  virtual bool update(float dt_);
61 
62  virtual bool setPriority(Object* obj_, OBJECT_PRIORITY prio_);
63 
65  virtual void setPFGrid(const Math::Point<>* corners_, std::set<CD::Volume*>& obstacles_);
66 
78  virtual void setPFOptions(Object* driver_, Object* target_, float targetRadius_,
79  PF::Manager::ALGORITHM algo_, bool createSpline_, bool resetPFVars_,
80  bool assignToDriver_, Math::Path& path_, double secsAllottedPerUpdate_=0.00033);
81 
86  virtual PF::RESULT findPath(Object* driver_, Object* target_);
87 
88  inline PF::Manager* getPFManager(Object* obj_) {
89  return &(static_cast<PathFinderInfo*>(_objMap[obj_])->_pFManager);
90  }
91 
92  inline Math::Path* getPath(Object* obj_) {
93  return static_cast<PathFinderInfo*>(_objMap[obj_])->_path;
94  }
95  };
96  }
97 }
98 
99 #endif //CPATH_FINDER_H
Grid * g_initialGrid
Definition: CDGrid.cpp:18
std::vector< Math::Point< int > > _targBins
Definition: CPathFinder.h:43
PF::Manager::ALGORITHM _algo
Definition: CPathFinder.h:45
STATUS _inProgress
Definition: CPathFinder.h:50
double _secsAllottedPerUpdate
Definition: CPathFinder.h:47
Definition: CUpdater.h:49
PF::Manager * getPFManager(Object *obj_)
Definition: CPathFinder.h:88
Definition: CUpdater.h:40
Math::Path * getPath(Object *obj_)
Definition: CPathFinder.h:92
static void shutDown()
Definition: CDGrid.cpp:85
RESULT
Definition: PFConsts.h:33
virtual ~PathFinder()
Definition: CPathFinder.h:58
static void init(Utils::uint initGlobalXDivs_, Utils::uint initGlobalYDivs_, Utils::uint initGlobalZDivs_, Utils::uint maxGlobalSubdivs_)
Definition: CDGrid.cpp:70
ALGORITHM
Definition: PFManager.h:132
PF::Manager _pFManager
Definition: CPathFinder.h:39
OBJECT_PRIORITY
Definition: CUpdater.h:49
#define CORE_DLL
Definition: CCoreDLL.h:57
Object * _target
Definition: CPathFinder.h:40
bool _resetPFVars
Definition: CPathFinder.h:46
Definition: MPoint.h:33
Math::Path * _path
Definition: CPathFinder.h:41
Definition: IObject.h:36
Definition: PFManager.h:129
Math::Point _targPos
Definition: CPathFinder.h:42
PathFinder()
Definition: CPathFinder.h:55
Definition: CPathFinder.h:30
Definition: CUpdater.h:54
Definition: MPath.h:31