Fixes ordering error

This commit is contained in:
Alayan-stk-2 2018-04-27 23:46:13 +02:00 committed by GitHub
parent 5f994204ab
commit c785a45e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
{