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
CObjectFactory.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 COBJECT_FACTORY_H
22 #define COBJECT_FACTORY_H
23 
24 #include "CPhysVisObject.h"
25 #include "CCamera.h"
26 
27 #include "../PF_LIB/PFManager.h"
28 
29 #include <string>
30 
31 #define ObjFac OpenSkyNet::Core::ObjectFactory::getInstance()
32 
33 namespace OpenSkyNet {
34  namespace Core {
37  public:
38  enum CREATION_FLAG { NONE, PHYSICAL, VISIBLE, PHYS_VIS, CAMERA };
39 
40  protected:
42 
43  std::vector<CD::Shape*> _nonPersistentShapes;
44 
45  std::map<std::string, Object*> _namesToObjs;
46  std::vector<Object*> _nonPersistentObjs;
47 
48 #ifdef PF_USES_WPC
49  std::map<const CD::Volume*, PF::WaypointCollection*> _volWPCMap;
50  std::map<const CD::Volume*, PF::WaypointCollection*> _nonPersistentWPCs;
51 #endif
52 
53  static Utils::uint getColGroupUIntFromStr(const char* colGroup_);
54  static const char* getColGroupStrFromUInt(Utils::uint colGroup_);
55 
56  ObjectFactory();
57 
58  public:
59  static inline void createInstance() { _instance = new ObjectFactory(); }
60 
61  static inline ObjectFactory*& getInstance() { return _instance; }
62 
63  static void shutDown();
64 
66  void destroyAllObjects(bool doDestroyPersistentData_);
67 
68  virtual CD::Shape* createShape(CD::SHAPE_TYPE shapeType_, ...);
69 
70  inline CD::Shape* getShape(Utils::uint index_) { assert(index_ < _nonPersistentShapes.size()); return _nonPersistentShapes[index_]; }
71 
72  virtual Object* createObject(const char* name_, bool isPersistent_, CREATION_FLAG flag_, ...);
73 
74  Object* getObject(const char* name_);
75 
76  inline const std::map<std::string, Object*>& getObjects() const { return _namesToObjs; }
77 
78 #ifdef PF_USES_WPC
79  inline const std::map<const CD::Volume*, PF::WaypointCollection*>& getVolWPCMap() const { return _volWPCMap; }
80 #endif
81  };
82  }
83 }
84 
85 #endif //COBJECT_FACTORY_H
std::map< std::string, Object * > _namesToObjs
Definition: CObjectFactory.h:45
static ObjectFactory *& getInstance()
Definition: CObjectFactory.h:61
std::vector< CD::Shape * > _nonPersistentShapes
Definition: CObjectFactory.h:43
Definition: CObjectFactory.h:36
Definition: CDVolume.h:54
static ObjectFactory * _instance
Definition: CObjectFactory.h:41
static void createInstance()
Definition: CObjectFactory.h:59
Definition: CCamera.h:33
unsigned int uint
Definition: UTypes.h:39
#define CORE_DLL
Definition: CCoreDLL.h:57
std::vector< Object * > _nonPersistentObjs
Definition: CObjectFactory.h:46
CREATION_FLAG
Definition: CObjectFactory.h:38
Definition: IObject.h:36
Definition: CObjectFactory.h:38
SHAPE_TYPE
Definition: CDVolume.h:31
CD::Shape * getShape(Utils::uint index_)
Definition: CObjectFactory.h:70
const std::map< std::string, Object * > & getObjects() const
Definition: CObjectFactory.h:76