diff --git a/include/game-engine.h b/include/game-engine.h index e45cccfb9bdf4a48091e2929121323b6c8a9d8e9..3a564b5f7b147df08fcb561d20cc573c16396fe1 100644 --- a/include/game-engine.h +++ b/include/game-engine.h @@ -14,6 +14,7 @@ #include "entity-manager.h" #include "scene.h" #include "asset.h" +#include "save-manager.h" // #include "window.h" #ifdef console @@ -41,6 +42,7 @@ class GameEngine bool isRunning; void handleInput(); private: + SaveManager _saveManager; size_t _frame = 0; std::time_t _frametime = 0; EntityManager _entityManager; diff --git a/makefile b/makefile index b581349bb5d432dbd478509f38157cbde852ddcb..06bbc318488c41e603c8c536c5aac4a3ab165a68 100644 --- a/makefile +++ b/makefile @@ -10,6 +10,7 @@ else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) CXX = g++ +# CXX = clang CXXFLAGS = -std=c++17 -Wall -Wreorder RM = rm -f endif @@ -20,6 +21,8 @@ endif # DEBUG BUILD CXXFLAGS += -g --coverage -O0 +# CXXFLAGS += -fanalyzer +# CXXFLAGS += -Xanalyzer # Linker Flags LDFLAGS = @@ -72,6 +75,8 @@ all: $(TARGET) test test: $(TEST_TARGET) ./$(TEST_TARGET) +game: $(TARGET) + $(TARGET): $(OBJ_FILES) $(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJ_FILES) $(SDL_LIBRARY) $(SDL_OPTIONS) diff --git a/src/entity-manager.cpp b/src/entity-manager.cpp index c568bf7203e93ee0b4e1273a8458bacc75e7b43e..b19b6ea46acecd8de0eb82c6d3cc63c5dd3dde9e 100644 --- a/src/entity-manager.cpp +++ b/src/entity-manager.cpp @@ -40,6 +40,7 @@ void EntityManager::update() this->_entityMap[entity->tag()].push_back( entity ); } this->_entitiesToAdd.clear(); + return; } void EntityManager::removeEntity(){} diff --git a/src/game-engine.cpp b/src/game-engine.cpp index 8c51eb8982282f5fc4389efb918ad8da3721349e..9395230cf0994e803e909ed6e8db3857354c0129 100644 --- a/src/game-engine.cpp +++ b/src/game-engine.cpp @@ -15,6 +15,7 @@ void GameEngine::init() { this->isRunning = false; this->_currScene = ""; + // this->_saveManager.list(); } void GameEngine::changeScene( std::string label, Scene* scene ) { diff --git a/src/main.cpp b/src/main.cpp index 06ff1c9c38d2a2081fee4853181edbb23775c647..758b2921d0b039c916c972f812f717e03fc197b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,47 +12,47 @@ int main( int argc, char* argv[] ) { Logger& logger = Logger::instance(); int tickCount = 0; int _frame = 0; - SaveManager saveManager; - state = Initialise; + // SaveManager saveManager; + // state = Initialise; - ConfigParser userSettings = ConfigParser::UserSettings(); + // ConfigParser userSettings = ConfigParser::UserSettings(); - EntityManager entityManager; + // EntityManager entityManager; // Seed the random number generator srand(static_cast<unsigned int>(time(nullptr))); - std::vector< Entity* > entities; + // std::vector< Entity* > entities; // Genrate a Random chunk - WorldHex2D map( 5 ); + // WorldHex2D map( 5 ); //Chunk* chunk = new Chunk( 0, 0, 0); //std::cout << chunk.getString() << std::endl; // Chunk* chunk = map.getMidChunk(); // std::cout << chunk->getString() << std::endl; - map.showChunk( 0, 0, 0 ); - map.moveInto( -2, 1, 1 ); - map.moveInto( -3, 2, 1 ); - map.moveInto( 5, -2, -3 )->visualise(); - map.visualise(); + // map.showChunk( 0, 0, 0 ); + // map.moveInto( -2, 1, 1 ); + // map.moveInto( -3, 2, 1 ); + // map.moveInto( 5, -2, -3 )->visualise(); + // map.visualise(); // Menu Loop // List Saves - saveManager.list(); + // saveManager.list(); GameEngine* game = new GameEngine(); game->run(); - userSettings.set( "exit", "teset" ); - std::cout << userSettings; + // userSettings.set( "exit", "teset" ); + // std::cout << userSettings; // Clean-up - while( entities.size() > 0 ) - { - Entity* entity = entities.back(); - entities.pop_back(); - delete entity; - } + // while( entities.size() > 0 ) + // { + // Entity* entity = entities.back(); + // entities.pop_back(); + // delete entity; + // } delete game; // Return