diff --git a/src/guiengine/widgets/kart_stats_widget.cpp b/src/guiengine/widgets/kart_stats_widget.cpp index 84f347ef8..9860b1fce 100644 --- a/src/guiengine/widgets/kart_stats_widget.cpp +++ b/src/guiengine/widgets/kart_stats_widget.cpp @@ -90,36 +90,34 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id, void KartStatsWidget::setValues(const KartProperties* props) { - // Use kart properties computed for "hard" difficulty to show the user, so - // that properties don't change according to the the last used difficulty - // (And because this code uses arbitrary scaling factors to make them look - // nice and the arbitrary factors were optimised for hard difficulty) - RaceManager::Difficulty previous_difficulty = race_manager->getDifficulty(); - race_manager->setDifficulty(RaceManager::DIFFICULTY_HARD); - //KartProperties* kp_computed = new KartProperties(); - KartProperties kp_computed; - kp_computed.copyForPlayer(props); - - // Scale the values so they look better - // The scaling factor and offset were found by trial and error. - // It should look nice and you should be able to see the difference between - // different masses or velocities. - m_skills[SKILL_MASS]->setValue((int) - ((kp_computed.getCombinedCharacteristic()->getMass() - 20) / 4)); - m_skills[SKILL_MASS]->setLabel(_("WEIGHT")); - m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id); - - m_skills[SKILL_SPEED]->setValue((int) - ((kp_computed.getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6)); - m_skills[SKILL_SPEED]->setLabel(_("SPEED")); - m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id); - - m_skills[SKILL_POWER]->setValue((int)((kp_computed.getAvgPower() - 30) / 20)); - m_skills[SKILL_POWER]->setLabel(_("POWER")); - m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id); - - race_manager->setDifficulty(previous_difficulty); - + // Use kart properties computed for "hard" difficulty to show the user, so + // that properties don't change according to the the last used difficulty + // (And because this code uses arbitrary scaling factors to make them look + // nice and the arbitrary factors were optimised for hard difficulty) + RaceManager::Difficulty previous_difficulty = race_manager->getDifficulty(); + race_manager->setDifficulty(RaceManager::DIFFICULTY_HARD); + KartProperties kp_computed; + kp_computed.copyForPlayer(props); + + // Scale the values so they look better + // The scaling factor and offset were found by trial and error. + // It should look nice and you should be able to see the difference between + // different masses or velocities. + m_skills[SKILL_MASS]->setValue((int) + ((kp_computed.getCombinedCharacteristic()->getMass() - 20) / 4)); + m_skills[SKILL_MASS]->setLabel(_("WEIGHT")); + m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id); + + m_skills[SKILL_SPEED]->setValue((int) + ((kp_computed.getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6)); + m_skills[SKILL_SPEED]->setLabel(_("SPEED")); + m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id); + + m_skills[SKILL_POWER]->setValue((int)((kp_computed.getAvgPower() - 30) / 20)); + m_skills[SKILL_POWER]->setLabel(_("POWER")); + m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id); + + race_manager->setDifficulty(previous_difficulty); } // ----------------------------------------------------------------------------- diff --git a/src/guiengine/widgets/kart_stats_widget.hpp b/src/guiengine/widgets/kart_stats_widget.hpp index ccdc13e57..d24ec1134 100644 --- a/src/guiengine/widgets/kart_stats_widget.hpp +++ b/src/guiengine/widgets/kart_stats_widget.hpp @@ -92,7 +92,7 @@ namespace GUIEngine * inside itself */ void setSize(const int x, const int y, const int w, const int h); - void setValues(const KartProperties* props); + void setValues(const KartProperties* props); /** Change the value of the widget, it must be a percent. */ void setValue(Stats type, int value); diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index c5ca77816..8a6ef3e8a 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -544,9 +544,9 @@ public: float getSkidReduceTurnMax() const; bool getSkidEnabled() const; - /* */ - - LEAK_CHECK() + /* */ + + LEAK_CHECK() }; // KartProperties #endif diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index 66e07d977..510022e23 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -812,7 +812,7 @@ void KartSelectionScreen::updateKartStats(uint8_t widget_id, if (kp != NULL) { - w->setValues(kp); + w->setValues(kp); w->update(0); } }