From c9bce16570160af24ae7f1f04249aa0e8313fb06 Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Thu, 24 Mar 2016 08:25:56 -0400 Subject: Fire flickering --- src/ui.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/ui.cpp') 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. -- cgit v1.2.3