TBTR: Fix replacement servicing condition when using infinite money

This commit is contained in:
Jonathan G Rennison
2024-04-23 17:16:15 +01:00
parent 69e7c1697e
commit 980de7353d

View File

@@ -160,6 +160,7 @@ bool ShouldServiceTrainForTemplateReplacement(const Train *t, const TemplateVehi
if (needed_money > c->money) return false; if (needed_money > c->money) return false;
TBTRDiffFlags diff = TrainTemplateDifference(t, tv); TBTRDiffFlags diff = TrainTemplateDifference(t, tv);
if (diff & TBTRDF_CONSIST) { if (diff & TBTRDF_CONSIST) {
if (_settings_game.difficulty.infinite_money) return true;
/* Check money. /* Check money.
* We want 2*(the price of the whole template) without looking at the value of the vehicle(s) we are going to sell, or not need to buy. */ * We want 2*(the price of the whole template) without looking at the value of the vehicle(s) we are going to sell, or not need to buy. */
for (const TemplateVehicle *tv_unit = tv; tv_unit != nullptr; tv_unit = tv_unit->GetNextUnit()) { for (const TemplateVehicle *tv_unit = tv; tv_unit != nullptr; tv_unit = tv_unit->GetNextUnit()) {