Fix #8068: always allow removal of tram track if that generates money (#8509)

Even if you are completely broke, generating money should always
be allowed.
pull/217/head
Patric Stout 3 years ago committed by GitHub
parent c7609e767f
commit 1b675e7075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1109,7 +1109,8 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32
p2 ^= IsInsideMM(p2 & 3, 1, 3) ? 3 : 0;
}
Money money = GetAvailableMoneyForCommand();
Money money_available = GetAvailableMoneyForCommand();
Money money_spent = 0;
TileIndex tile = start_tile;
CommandCost last_error = CMD_ERROR;
bool had_success = false;
@ -1126,8 +1127,8 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32
CommandCost ret = RemoveRoad(tile, flags & ~DC_EXEC, bits, rtt, true);
if (ret.Succeeded()) {
if (flags & DC_EXEC) {
money -= ret.GetCost();
if (money < 0) {
money_spent += ret.GetCost();
if (money_spent > 0 && money_spent > money_available) {
_additional_cash_required = DoCommand(start_tile, end_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD).GetCost();
return cost;
}

Loading…
Cancel
Save