aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index f0736a5..e3e3e7d 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -858,7 +858,6 @@ namespace ui {
void quitGame(){
dialogBoxExists = false;
currentMenu = NULL;
- delete[] currentMenu;
gameRunning = false;
updateConfig();
saveConfig();
@@ -1446,17 +1445,11 @@ EXIT:
break;
case SDLK_l:
currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
- currentWorld->light.back().belongsTo = true;
- currentWorld->light.back().following = player;
- currentWorld->light.back().flame = true;
+ currentWorld->light.back().follow(player);
+ currentWorld->light.back().makeFlame();
break;
case SDLK_f:
currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
- std::cout << currentWorld->light.back().belongsTo << std::endl;
- currentWorld->light.back().belongsTo = false;
- std::cout << currentWorld->light.back().belongsTo << std::endl;
- currentWorld->light.back().following = nullptr;
- currentWorld->light.back().flame = true;
break;
case SDLK_g:
//currentWorld->addStructure(LAMP_POST, player->loc.x, player->loc.y, NULL);
@@ -1473,9 +1466,8 @@ EXIT:
case SDLK_b:
currentWorld->addStructure(FIRE_PIT, player->loc.x, player->loc.y, "", "");
currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
- currentWorld->light.back().belongsTo = false;
- currentWorld->light.back().following = nullptr;
- currentWorld->light.back().flame = true;
+ currentWorld->light.back().follow(currentWorld->build.back());
+ currentWorld->light.back().makeFlame();
break;
case SDLK_F12:
// Make the BYTE array, factor of 3 because it's RBG.