From c785a45e93fcd9d1d1bbc7cb3a8ddc1fa2b1e34f Mon Sep 17 00:00:00 2001 From: Alayan-stk-2 Date: Fri, 27 Apr 2018 23:46:13 +0200 Subject: [PATCH] Fixes ordering error --- src/items/powerup_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/items/powerup_manager.cpp b/src/items/powerup_manager.cpp index 9b47e183e..f8973d8b1 100644 --- a/src/items/powerup_manager.cpp +++ b/src/items/powerup_manager.cpp @@ -586,7 +586,6 @@ PowerupManager::PowerupType PowerupManager::getRandomPowerup(unsigned int pos, { int random = rand(); int random_class = random%RAND_CLASS_RANGE; - int random_item = (random/RAND_CLASS_RANGE)%m_powerups_for_reference_pos[pos_class].size(); //First step : select at random a class according to the weights of class for this position // Positions start with 1, while the index starts with 0 - so subtract 1 @@ -599,6 +598,8 @@ PowerupManager::PowerupType PowerupManager::getRandomPowerup(unsigned int pos, //Second step : select an item at random + int random_item = (random/RAND_CLASS_RANGE)%m_powerups_for_reference_pos[pos_class].size(); + int i=m_powerups_for_reference_pos[pos_class][random_item]; if(i>=POWERUP_MAX) {