Feature: Infinite money mode (#11902)

This commit is contained in:
merni-ns
2024-01-30 23:31:02 +05:30
committed by GitHub
parent 7acf78964f
commit 5a88027a19
15 changed files with 63 additions and 27 deletions

View File

@@ -220,7 +220,7 @@ bool Vehicle::NeedsServicing() const
* There are a lot more reasons for autoreplace to fail than we can test here reasonably. */
bool pending_replace = false;
Money needed_money = c->settings.engine_renew_money;
if (needed_money > c->money) return false;
if (needed_money > GetAvailableMoney(c->index)) return false;
for (const Vehicle *v = this; v != nullptr; v = (v->type == VEH_TRAIN) ? Train::From(v)->GetNextUnit() : nullptr) {
bool replace_when_old = false;
@@ -258,7 +258,7 @@ bool Vehicle::NeedsServicing() const
* We want 2*(the price of the new vehicle) without looking at the value of the vehicle we are going to sell. */
pending_replace = true;
needed_money += 2 * Engine::Get(new_engine)->GetCost();
if (needed_money > c->money) return false;
if (needed_money > GetAvailableMoney(c->index)) return false;
}
return pending_replace;