diff --git a/include/entities/entity-generic.h b/include/entities/entity.h similarity index 77% rename from include/entities/entity-generic.h rename to include/entities/entity.h index aef3d46522b24e45c1c45ffe4bd9619b28aa41ff..3224a221a3171de68f2d29a1db18ed30cdc1cc95 100644 --- a/include/entities/entity-generic.h +++ b/include/entities/entity.h @@ -5,12 +5,12 @@ // #include "entity-manager.h" #include "logger.h" -class EntityGeneric +class Entity { // friend class EntityManager; public: - EntityGeneric( const std::string& tag, size_t id ); /** @todo make this private */ - ~EntityGeneric(); + Entity( const std::string& tag, size_t id ); /** @todo make this private */ + ~Entity(); bool isAlive() { return this->_alive; } bool isDead() { return ! this->_alive; } @@ -28,6 +28,4 @@ class EntityGeneric }; -typedef EntityGeneric Entity; - #endif // __ENTITIES__ENTITY_GENERIC_H diff --git a/include/entity-manager.h b/include/entity-manager.h index c554c52240fa7da8dcee6de851cadd0e8aca6a3b..9be1add0bde27b8ca0e37b5c580d7bfc687c5149 100644 --- a/include/entity-manager.h +++ b/include/entity-manager.h @@ -7,10 +7,9 @@ #include <map> #include "logger.h" -#include "entities/entity-generic.h" +#include "entities/entity.h" -typedef EntityGeneric Entity; -typedef std::vector<std::shared_ptr<EntityGeneric>> EntityVector; +typedef std::vector<std::shared_ptr<Entity>> EntityVector; typedef std::map< std::string, EntityVector > EntityMap; class EntityManager @@ -18,7 +17,7 @@ class EntityManager public: EntityManager(); ~EntityManager(); - std::shared_ptr<EntityGeneric> addEntity( const std::string& tag ); + std::shared_ptr<Entity> addEntity( const std::string& tag ); void removeEntity(); void update(); diff --git a/include/main.h b/include/main.h index 2073f875790e074cc12c06de431360290940c494..e6be204a2846497939bdd9bdd8e46b577d3f63d3 100644 --- a/include/main.h +++ b/include/main.h @@ -19,7 +19,7 @@ enum GenerationMethod #include "config-parser.h" #include "game-engine.h" #include "logger.h" -#include "entities/entity-generic.h" +#include "entities/entity.h" #include "maths/maths.h" #include "entity-manager.h" diff --git a/include/scene.h b/include/scene.h index 79747924cbe0c76576546ff48b4cfca9b373fb19..20d4568005fcb8f4e90efad245077c1c031e2eb8 100644 --- a/include/scene.h +++ b/include/scene.h @@ -7,7 +7,7 @@ #include "logger.h" #include "asset.h" -#include "entities/entity-generic.h" +#include "entities/entity.h" #include "entity-manager.h" class Scene{ diff --git a/src/entities/entity-generic.cpp b/src/entities/entity.cpp similarity index 59% rename from src/entities/entity-generic.cpp rename to src/entities/entity.cpp index 9a56b644e2f6ed8101df4e4fcf7ac9434ef5b091..2c0f0e9ae7ce7a712484b9424718d0e35016ace5 100644 --- a/src/entities/entity-generic.cpp +++ b/src/entities/entity.cpp @@ -1,8 +1,8 @@ -#include "entities/entity-generic.h" +#include "entities/entity.h" -EntityGeneric::EntityGeneric( +Entity::Entity( const std::string& tag, size_t id ) : _tag( tag ), _id( id ), _logger( Logger::instance() ) { this->_logger.info( "Generic Entity Created" ); } -EntityGeneric::~EntityGeneric(){} +Entity::~Entity(){} diff --git a/src/entity-manager.cpp b/src/entity-manager.cpp index 4fb1e62a9b43f5fa225d80086bf5a2289866cda8..0c098ddec20157d13dc816998a7d08e3a5c209a4 100644 --- a/src/entity-manager.cpp +++ b/src/entity-manager.cpp @@ -12,7 +12,7 @@ EntityManager::~EntityManager() } std::shared_ptr<Entity> EntityManager::addEntity( const std::string& tag ) { - auto entity = std::shared_ptr< Entity >( new EntityGeneric( tag, this->nextId() ) ); + auto entity = std::shared_ptr< Entity >( new Entity( tag, this->nextId() ) ); this->_entitiesToAdd.push_back( entity ); return entity; } diff --git a/src/main.cpp b/src/main.cpp index 2e5a4298cbf501a3197c10fde4126c7efd49594e..a92f1abe9ea3e51ebfef92aa37336a8547756367 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,7 +20,7 @@ int main( int argc, char* argv[] ) { // Seed the random number generator srand(static_cast<unsigned int>(time(nullptr))); - std::vector< EntityGeneric* > entities; + std::vector< Entity* > entities; // Genrate a Random chunk WorldHex2D map( 5 ); //Chunk* chunk = new Chunk( 0, 0, 0); @@ -48,7 +48,7 @@ int main( int argc, char* argv[] ) { // Clean-up while( entities.size() > 0 ) { - EntityGeneric* entity = entities.back(); + Entity* entity = entities.back(); entities.pop_back(); delete entity; }