Fixes weight computation at reference points

This commit is contained in:
Alayan-stk-2 2018-04-29 07:23:33 +02:00 committed by GitHub
parent 49ff8ecd25
commit a1e19f3692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -403,8 +403,15 @@ void PowerupManager::loadWeights(const XMLNode &root,
float ref_diff = (float) (sup_num - inf_num);
float sup_diff = (float) (sup_num - num_karts);
float inf_diff = (float) (num_karts - inf_num);
float weight = (sup_diff/ref_diff)*weight_inf
float weight;
if (ref_diff != 0)
weight = (sup_diff/ref_diff)*weight_inf
+(inf_diff/ref_diff)*weight_sup;
//the sup and inf weights are the same here, take one of them
else
weight = weight_inf;
int rounded_weight = (int) weight;
m_weights[position_class].push_back(rounded_weight);