From a59898c4bac133a4dd4966c01a81b1cc66a7f3d9 Mon Sep 17 00:00:00 2001 From: Benau Date: Sat, 5 Jan 2019 03:21:06 +0800 Subject: [PATCH] Fix compiler warning --- src/input/input_manager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/input/input_manager.cpp b/src/input/input_manager.cpp index e0c9c5d34..f98c8a512 100644 --- a/src/input/input_manager.cpp +++ b/src/input/input_manager.cpp @@ -824,13 +824,14 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, else return; - for (int i=0;igetNumKarts();i++) + const int num_karts = World::getWorld()->getNumKarts(); + for (int i=0;igetNumKarts() - 1; - else if (current_idx == World::getWorld()->getNumKarts()) + current_idx = num_karts - 1; + else if (current_idx == num_karts) current_idx = 0; if (!World::getWorld()->getKart(current_idx)->isEliminated())