Changeset - r24588:3e3c6adeb5cc
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-01-07 07:01:46
truebrain@openttd.org
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.
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -1109,7 +1109,8 @@ CommandCost CmdRemoveLongRoad(TileIndex 
 
		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 
 
			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;
 
					}
0 comments (0 inline, 0 general)