From b772bf3f2d18a1e787712e4d0a754c015e05d697 Mon Sep 17 00:00:00 2001 From: Alfred Burgess <alfred.burgess95@gmail.com> Date: Fri, 5 Jan 2024 02:21:29 +0800 Subject: [PATCH] Removed code from main function call --- include/game-engine.h | 2 ++ makefile | 5 +++++ src/entity-manager.cpp | 1 + src/game-engine.cpp | 1 + src/main.cpp | 40 ++++++++++++++++++++-------------------- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/include/game-engine.h b/include/game-engine.h index e45cccf..3a564b5 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 b581349..06bbc31 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 c568bf7..b19b6ea 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 8c51eb8..9395230 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 06ff1c9..758b292 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 -- GitLab