Merge branch 'master' into jgrpp
# Conflicts: # src/aircraft_cmd.cpp # src/company_gui.cpp # src/lang/arabic_egypt.txt # src/lang/czech.txt # src/lang/esperanto.txt # src/lang/faroese.txt # src/lang/finnish.txt # src/lang/german.txt # src/lang/korean.txt # src/lang/latvian.txt # src/lang/malay.txt # src/lang/polish.txt # src/lang/spanish.txt # src/lang/spanish_MX.txt # src/lang/unfinished/urdu.txt # src/main_gui.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/road_cmd.cpp # src/settings_type.h # src/station_cmd.cpp # src/table/settings.ini
This commit is contained in:
@@ -1609,7 +1609,8 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32
|
||||
FlushDeferredUpdateRoadCachedOneWayStates();
|
||||
});
|
||||
|
||||
Money money = GetAvailableMoneyForCommand();
|
||||
Money money_available = GetAvailableMoneyForCommand();
|
||||
Money money_spent = 0;
|
||||
TileIndex tile = start_tile;
|
||||
CommandCost last_error = CMD_ERROR;
|
||||
bool had_success = false;
|
||||
@@ -1626,8 +1627,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;
|
||||
}
|
||||
@@ -2939,6 +2940,17 @@ CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
}
|
||||
}
|
||||
|
||||
/* Base the ability to replace town roads and bridges on the town's
|
||||
* acceptance of destructive actions. */
|
||||
if (owner == OWNER_TOWN) {
|
||||
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
|
||||
CommandCost ret = CheckforTownRating(DC_NONE, t, tt == MP_TUNNELBRIDGE ? TUNNELBRIDGE_REMOVE : ROAD_REMOVE);
|
||||
if (ret.Failed()) {
|
||||
error = ret;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Vehicle on the tile when not converting normal <-> powered
|
||||
* Tunnels and bridges have special check later */
|
||||
if (tt != MP_TUNNELBRIDGE) {
|
||||
|
Reference in New Issue
Block a user