aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index a7e3777..f7cc099 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -6,6 +6,7 @@
#include <gametime.hpp>
#include <render.hpp>
+#include <engine.hpp>
#include <events.hpp>
extern Menu* currentMenu;
@@ -22,12 +23,6 @@ extern World *currentWorldToLeft;
extern World *currentWorldToRight;
/**
- * In the case of dialog, some NPC quests can be preloaded so that they aren't assigned until
- * the dialog box closes. Reference variables for that here.
- */
-extern std::vector<NPC *> aipreload;
-
-/**
* Pressing ESC or closing the window will set this to false.
*/
extern bool gameRunning;
@@ -1214,9 +1209,9 @@ namespace ui {
void quitGame() {
dialogBoxExists = false;
currentMenu = NULL;
- gameRunning = false;
game::config::update();
game::config::save();
+ game::endGame();
}
void closeBox() {
@@ -1281,16 +1276,6 @@ EXIT:
}
}
- void handleEvents(void) {
- // Flush preloaded AI functions if necessary
- if (!dialogBoxExists) {
- while (!aipreload.empty()) {
- aipreload.front()->addAIFunc(false);
- aipreload.erase(std::begin(aipreload));
- }
- }
- }
-
void drawFade(void) {
auto SCREEN_WIDTH = game::SCREEN_WIDTH;
auto SCREEN_HEIGHT = game::SCREEN_HEIGHT;
@@ -1474,7 +1459,7 @@ void InputSystem::update(entityx::EntityManager &en, entityx::EventManager &ev,
// escape - quit game
case SDL_QUIT:
- gameRunning = false;
+ game::endGame();
break;
// mouse movement - update mouse vector