From 93aa94921e027e05d7cb9908305af225c64b1ff2 Mon Sep 17 00:00:00 2001 From: Max-001 Date: Wed, 8 Jan 2025 09:03:30 +0100 Subject: Make format --- game/menus/ButtonNextMainMenuSubScript.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'game/menus/ButtonNextMainMenuSubScript.cpp') diff --git a/game/menus/ButtonNextMainMenuSubScript.cpp b/game/menus/ButtonNextMainMenuSubScript.cpp index d6e315e..e03a34a 100644 --- a/game/menus/ButtonNextMainMenuSubScript.cpp +++ b/game/menus/ButtonNextMainMenuSubScript.cpp @@ -12,29 +12,31 @@ using namespace crepe; using namespace std; -void ButtonNextMainMenuSubScript::init(){ +void ButtonNextMainMenuSubScript::init() { IButtonScript::init(); - this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); + this->subscribe([this](const ButtonPressEvent & e) { + return this->on_button_press(e); + }); } -bool ButtonNextMainMenuSubScript::on_button_press(const ButtonPressEvent& e){ - RefVector audios = this->get_components_by_name("background_music"); - +bool ButtonNextMainMenuSubScript::on_button_press(const ButtonPressEvent & e) { + RefVector audios + = this->get_components_by_name("background_music"); + for (AudioSource & audio : audios) { audio.stop(); } SaveManager & savemgr = this->get_save_manager(); - ValueBroker coins = savemgr.get(TOTAL_COINS_RUN,0); - ValueBroker coins_game = savemgr.get(TOTAL_COINS_GAME,0); - savemgr.set(TOTAL_COINS_GAME, coins_game.get()+coins.get()); - - ValueBroker distance = savemgr.get(DISTANCE_RUN,0); - ValueBroker distance_game = savemgr.get(DISTANCE_GAME,0); - if(distance.get() > distance_game.get()) savemgr.set(DISTANCE_GAME, distance.get()); + ValueBroker coins = savemgr.get(TOTAL_COINS_RUN, 0); + ValueBroker coins_game = savemgr.get(TOTAL_COINS_GAME, 0); + savemgr.set(TOTAL_COINS_GAME, coins_game.get() + coins.get()); + + ValueBroker distance = savemgr.get(DISTANCE_RUN, 0); + ValueBroker distance_game = savemgr.get(DISTANCE_GAME, 0); + if (distance.get() > distance_game.get()) savemgr.set(DISTANCE_GAME, distance.get()); this->set_next_scene(MAINMENU_SCENE); return false; } - -- cgit v1.2.3