From ffeb83d56b72e0f8257e7543c8b7be0a1aacabae Mon Sep 17 00:00:00 2001 From: husho Date: Wed, 16 May 2018 15:35:56 +0300 Subject: [PATCH] Off by 1 error fix --- rwgame/states/DebugState.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rwgame/states/DebugState.cpp b/rwgame/states/DebugState.cpp index 8e2fc182..477c7dcd 100644 --- a/rwgame/states/DebugState.cpp +++ b/rwgame/states/DebugState.cpp @@ -212,9 +212,9 @@ std::shared_ptr DebugState::createWeatherMenu() { Menu::create({{"Back", [=] { this->enterMenu(createDebugMenu()); }}}, kDebugFont, kDebugEntryHeight); - std::string w[4]{"Sunny", "Cloudy", "Rainy", "Foggy"}; + const std::array w {"Sunny", "Cloudy", "Rainy", "Foggy"}; - for (int i = 0; i < 4; ++i) { + for (int i = 0; i < w.size(); ++i) { menu->lambda(w[i], [=] { game->getWorld()->state->basic.nextWeather = i; }); } @@ -228,7 +228,7 @@ std::shared_ptr DebugState::createMissionsMenu() { Menu::create({{"Back", [=] { this->enterMenu(createDebugMenu()); }}}, kDebugFont, kDebugEntryHeightMissions); - std::string w[80]{ + const std::array w { "Intro Movie", "Hospital Info Scene", "Police Station Info Scene", @@ -311,7 +311,7 @@ std::shared_ptr DebugState::createMissionsMenu() { "The Exchange", }; - for (int i = 0; i < 79; ++i) { + for (int i = 0; i < w.size(); ++i) { menu->lambda(w[i], [=] { ScriptMachine* vm = game->getScriptVM();