Skip to content

Commit 810060c

Browse files
committed
Fix crash when using Nitro-Hack ( Fix #46 )
1 parent 9180922 commit 810060c

8 files changed

Lines changed: 32 additions & 32 deletions

data/kart_characteristics.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ TEMPLATE
351351
<!-- Nitro-hack
352352
duration: Time a nitro-hack is active.
353353
factor: Multiplicative factor for the engine and max-speed boosts of nitro -->
354-
<nitro-hack duration="7.0" factor="1.7" />
354+
<nitrohack duration="7.0" factor="1.7" />
355355

356356
<!-- Electro-Shield
357357
duration: Duration during which the electro-shield is active.

src/karts/abstract_characteristic.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ AbstractCharacteristic::ValueType AbstractCharacteristic::getType(
217217
return TYPE_FLOAT;
218218
case PLUNGER_IN_FACE_TIME:
219219
return TYPE_FLOAT;
220-
case NITROHACK_DURATION:
220+
case NITRO_HACK_DURATION:
221221
return TYPE_FLOAT;
222-
case NITROHACK_FACTOR:
222+
case NITRO_HACK_FACTOR:
223223
return TYPE_FLOAT;
224224
case ELECTRO_DURATION:
225225
return TYPE_FLOAT;
@@ -585,10 +585,10 @@ std::string AbstractCharacteristic::getName(CharacteristicType type)
585585
return "PLUNGER_BAND_FADE_OUT_TIME";
586586
case PLUNGER_IN_FACE_TIME:
587587
return "PLUNGER_IN_FACE_TIME";
588-
case NITROHACK_DURATION:
589-
return "NITROHACK_DURATION";
590-
case NITROHACK_FACTOR:
591-
return "NITROHACK_FACTOR";
588+
case NITRO_HACK_DURATION:
589+
return "NITRO_HACK_DURATION";
590+
case NITRO_HACK_FACTOR:
591+
return "NITRO_HACK_FACTOR";
592592
case ELECTRO_DURATION:
593593
return "ELECTRO_DURATION";
594594
case ELECTRO_ENGINE_MULT:
@@ -1756,28 +1756,28 @@ float AbstractCharacteristic::getPlungerInFaceTime() const
17561756
} // getPlungerInFaceTime
17571757

17581758
// ----------------------------------------------------------------------------
1759-
float AbstractCharacteristic::getNitrohackDuration() const
1759+
float AbstractCharacteristic::getNitroHackDuration() const
17601760
{
17611761
float result;
17621762
bool is_set = false;
1763-
process(NITROHACK_DURATION, &result, &is_set);
1763+
process(NITRO_HACK_DURATION, &result, &is_set);
17641764
if (!is_set)
17651765
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
1766-
getName(NITROHACK_DURATION).c_str());
1766+
getName(NITRO_HACK_DURATION).c_str());
17671767
return result;
1768-
} // getNitrohackDuration
1768+
} // getNitroHackDuration
17691769

17701770
// ----------------------------------------------------------------------------
1771-
float AbstractCharacteristic::getNitrohackFactor() const
1771+
float AbstractCharacteristic::getNitroHackFactor() const
17721772
{
17731773
float result;
17741774
bool is_set = false;
1775-
process(NITROHACK_FACTOR, &result, &is_set);
1775+
process(NITRO_HACK_FACTOR, &result, &is_set);
17761776
if (!is_set)
17771777
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
1778-
getName(NITROHACK_FACTOR).c_str());
1778+
getName(NITRO_HACK_FACTOR).c_str());
17791779
return result;
1780-
} // getNitrohackFactor
1780+
} // getNitroHackFactor
17811781

17821782
// ----------------------------------------------------------------------------
17831783
float AbstractCharacteristic::getElectroDuration() const

src/karts/abstract_characteristic.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ class AbstractCharacteristic
190190
PLUNGER_IN_FACE_TIME,
191191

192192
// Nitrohack
193-
NITROHACK_DURATION,
194-
NITROHACK_FACTOR,
193+
NITRO_HACK_DURATION,
194+
NITRO_HACK_FACTOR,
195195

196196
// Electro
197197
ELECTRO_DURATION,
@@ -436,8 +436,8 @@ class AbstractCharacteristic
436436
float getPlungerBandFadeOutTime() const;
437437
float getPlungerInFaceTime() const;
438438

439-
float getNitrohackDuration() const;
440-
float getNitrohackFactor() const;
439+
float getNitroHackDuration() const;
440+
float getNitroHackFactor() const;
441441

442442
float getElectroDuration() const;
443443
float getElectroEngineMult() const;

src/karts/kart.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,8 +2750,8 @@ void Kart::addEnergy(float val, bool allow_negative = false)
27502750
/** Called when the NitroHack powerup is used by the kart. **/
27512751
void Kart::activateNitroHack()
27522752
{
2753-
m_nitro_hack_ticks = STKConfig::get()->time2Ticks(m_kart_properties->getNitrohackDuration());
2754-
m_nitro_hack_factor = m_kart_properties->getNitrohackFactor();
2753+
m_nitro_hack_ticks = STKConfig::get()->time2Ticks(m_kart_properties->getNitroHackDuration());
2754+
m_nitro_hack_factor = m_kart_properties->getNitroHackFactor();
27552755
} // activateNitroHack
27562756

27572757
//-----------------------------------------------------------------------------

src/karts/kart_properties.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,16 +1242,16 @@ float KartProperties::getPlungerInFaceTime() const
12421242
} // getPlungerInFaceTime
12431243

12441244
// ----------------------------------------------------------------------------
1245-
float KartProperties::getNitrohackDuration() const
1245+
float KartProperties::getNitroHackDuration() const
12461246
{
1247-
return m_cached_characteristic->getNitrohackDuration();
1248-
} // getNitrohackDuration
1247+
return m_cached_characteristic->getNitroHackDuration();
1248+
} // getNitroHackDuration
12491249

12501250
// ----------------------------------------------------------------------------
1251-
float KartProperties::getNitrohackFactor() const
1251+
float KartProperties::getNitroHackFactor() const
12521252
{
1253-
return m_cached_characteristic->getNitrohackFactor();
1254-
} // getNitrohackFactor
1253+
return m_cached_characteristic->getNitroHackFactor();
1254+
} // getNitroHackFactor
12551255

12561256
// ----------------------------------------------------------------------------
12571257
float KartProperties::getElectroDuration() const

src/karts/kart_properties.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ class KartProperties
483483
float getPlungerBandFadeOutTime() const;
484484
float getPlungerInFaceTime() const;
485485

486-
float getNitrohackDuration() const;
487-
float getNitrohackFactor() const;
486+
float getNitroHackDuration() const;
487+
float getNitroHackFactor() const;
488488

489489
float getElectroDuration() const;
490490
float getElectroEngineMult() const;

src/karts/xml_characteristic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ void XmlCharacteristic::load(const XMLNode *node)
562562
if (const XMLNode *sub_node = node->getNode("nitrohack"))
563563
{
564564
sub_node->get("duration",
565-
&m_values[NITROHACK_DURATION]);
565+
&m_values[NITRO_HACK_DURATION]);
566566
sub_node->get("factor",
567-
&m_values[NITROHACK_FACTOR]);
567+
&m_values[NITRO_HACK_FACTOR]);
568568
}
569569

570570
if (const XMLNode *sub_node = node->getNode("electro"))

tools/create_kart_properties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
Zipper: duration, force, speedGain, maxSpeedIncrease, fadeOutTime
4646
Swatter: duration, distance, squashDuration, squashSlowdown
4747
Plunger: bandMaxLength, bandForce, bandDuration, bandSpeedIncrease, bandFadeOutTime, inFaceTime
48-
Nitrohack: duration, factor
48+
NitroHack: duration, factor
4949
Electro: duration, engineMult, maxSpeedIncrease, fadeOutTime
5050
Tyres: pitSpeedFraction, changeKartMap(std::string/string), namesLong(std::string/string), namesShort(std::string/string), maxLifeTurning(std::vector<float>/floatVector), maxLifeTraction(std::vector<float>/floatVector), minLifeTurning(std::vector<float>/floatVector), minLifeTraction(std::vector<float>/floatVector), regularTransferTurning(std::vector<float>/floatVector), regularTransferTraction(std::vector<float>/floatVector), limitingTransferTurning(std::vector<float>/floatVector), limitingTransferTraction(std::vector<float>/floatVector), initialBonusAddTurning(std::vector<float>/floatVector), initialBonusMultTurning(std::vector<float>/floatVector), initialBonusAddTraction(std::vector<float>/floatVector), initialBonusMultTraction(std::vector<float>/floatVector), initialBonusAddTopspeed(std::vector<float>/floatVector), initialBonusMultTopspeed(std::vector<float>/floatVector), responseCurveTurning(InterpolationArray), responseCurveTraction(InterpolationArray), responseCurveTopspeed(InterpolationArray), doGripBasedTurning(std::vector<float>/floatVector), doSubstractiveTurning(std::vector<float>/floatVector), doSubstractiveTraction(std::vector<float>/floatVector), doSubstractiveTopspeed(std::vector<float>/floatVector), tractionConstant(std::vector<float>/floatVector), turningConstant(std::vector<float>/floatVector), topspeedConstant(std::vector<float>/floatVector), compoundNumber, offroadFactor(std::vector<float>/floatVector), rollingResistance(std::vector<float>/floatVector), skidFactor(std::vector<float>/floatVector), brakeThreshold(std::vector<float>/floatVector), crashPenalty(std::vector<float>/floatVector), defaultColor(std::vector<float>/floatVector)
5151
Startup: time(std::vector<float>/floatVector), boost(std::vector<float>/floatVector), engineForce(std::vector<float>/floatVector), duration, fadeOutTime

0 commit comments

Comments
 (0)