Fix karts without a type

This commit is contained in:
Flakebi 2015-07-24 02:10:23 +02:00
parent 2620a77dc1
commit 324a93cd65
2 changed files with 18 additions and 4 deletions

View File

@ -66,8 +66,13 @@ AbstractKart::AbstractKart(const std::string& ident,
m_characteristic->addCharacteristic(kart_properties_manager->
getDifficultyCharacteristic(race_manager->getDifficultyAsString(
race_manager->getDifficulty())));
m_characteristic->addCharacteristic(kart_properties_manager->
getKartTypeCharacteristic(m_kart_properties->getKartType()));
// Try to get the kart type
const AbstractCharacteristic *characteristic = kart_properties_manager->
getKartTypeCharacteristic(m_kart_properties->getKartType());
if (characteristic)
m_characteristic->addCharacteristic(characteristic);
m_characteristic->addCharacteristic(kart_properties_manager->
getPlayerCharacteristic(KartProperties::getPerPlayerDifficultyAsString(
m_difficulty)));

View File

@ -312,8 +312,17 @@ void KartProperties::combineCharacteristics()
m_combined_characteristic = new CombinedCharacteristic();
m_combined_characteristic->addCharacteristic(kart_properties_manager->
getBaseCharacteristic());
m_combined_characteristic->addCharacteristic(kart_properties_manager->
getKartTypeCharacteristic(m_kart_type));
// Try to get the kart type
const AbstractCharacteristic *characteristic = kart_properties_manager->
getKartTypeCharacteristic(m_kart_type);
if (!characteristic)
Log::warn("KartProperties", "Can't find kart type '%s' for kart '%s'",
m_kart_type.c_str(), m_name.c_str());
else
// Kart type found
m_combined_characteristic->addCharacteristic(characteristic);
m_combined_characteristic->addCharacteristic(m_characteristic);
} // combineCharacteristics