2004-05-22 02:57:54 +02:00
|
|
|
// BaseEntityCollection.h
|
|
|
|
//
|
2004-07-20 21:30:35 +02:00
|
|
|
// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com
|
2004-05-22 02:57:54 +02:00
|
|
|
//
|
|
|
|
// Keeps tabs on the various types of entity that roam the world.
|
|
|
|
//
|
|
|
|
// General note: Template, Base Entity, and Entity Class are used more-or-less interchangably.
|
|
|
|
//
|
2004-08-11 22:17:13 +02:00
|
|
|
// Usage: g_EntityTemplateCollection.loadTemplates(): initializes the lists from entities/templates
|
2004-05-22 02:57:54 +02:00
|
|
|
// After that, you can:
|
|
|
|
// Find an entity class by the actor it uses: g_EntityTemplateCollection.getTemplateByActor()
|
|
|
|
// Note that this is included solely for loading ScnEd 4,5 and 6 format map files. Don't rely on this
|
|
|
|
// working all the time.
|
2005-03-23 00:31:30 +01:00
|
|
|
// Find an entity class by its name: g_EntityTemplateCollection.getTemplate()
|
2004-05-22 02:57:54 +02:00
|
|
|
// g_EntityManager will also use this class to lookup entity templates when you instantiate an entity with
|
|
|
|
// a class name string.
|
2004-05-22 01:46:16 +02:00
|
|
|
|
|
|
|
#ifndef BASEENT_COLLECTION_INCLUDED
|
|
|
|
#define BASEENT_COLLECTION_INCLUDED
|
|
|
|
|
|
|
|
#include <vector>
|
2006-04-28 06:53:23 +02:00
|
|
|
#include <map>
|
2004-05-22 01:46:16 +02:00
|
|
|
#include "CStr.h"
|
|
|
|
#include "Singleton.h"
|
|
|
|
#include "ObjectEntry.h"
|
|
|
|
#include "BaseEntity.h"
|
|
|
|
|
|
|
|
#define g_EntityTemplateCollection CBaseEntityCollection::GetSingleton()
|
|
|
|
|
|
|
|
class CBaseEntityCollection : public Singleton<CBaseEntityCollection>
|
|
|
|
{
|
2005-03-29 22:50:04 +02:00
|
|
|
typedef std::map<CStrW, CBaseEntity*> templateMap;
|
|
|
|
typedef std::map<CStrW, CStr> templateFilenameMap;
|
|
|
|
templateMap m_templates;
|
|
|
|
templateFilenameMap m_templateFilenames;
|
2004-05-22 01:46:16 +02:00
|
|
|
public:
|
2004-06-11 00:24:03 +02:00
|
|
|
~CBaseEntityCollection();
|
2004-08-03 01:14:54 +02:00
|
|
|
CBaseEntity* getTemplate( CStrW entityType );
|
2005-05-03 23:36:57 +02:00
|
|
|
int loadTemplates();
|
2005-03-27 03:44:41 +02:00
|
|
|
void LoadFile( const char* path );
|
2005-03-23 00:31:30 +01:00
|
|
|
|
2005-03-30 04:06:00 +02:00
|
|
|
// Create a list of the names of all base entities, excluding template_*,
|
|
|
|
// for display in ScEd's entity-selection box.
|
|
|
|
void getBaseEntityNames( std::vector<CStrW>& names );
|
2004-05-22 01:46:16 +02:00
|
|
|
};
|
|
|
|
|
2004-06-02 18:11:32 +02:00
|
|
|
#endif
|