File diff r23953:ba75d2f3b530 → r23954:8e43140b9a66
src/town_cmd.cpp
Show inline comments
 
@@ -2863,26 +2863,25 @@ CommandCost CmdExpandTown(TileIndex tile
 
 * @param p1 Town ID to delete.
 
 * @param p2 Unused.
 
 * @param text Unused.
 
 * @return Empty cost or an error.
 
 */
 
CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	if (_game_mode != GM_EDITOR && !_generating_world) return CMD_ERROR;
 
	Town *t = Town::GetIfValid(p1);
 
	if (t == nullptr) return CMD_ERROR;
 

	
 
	/* Stations refer to towns. */
 
	const Station *st;
 
	FOR_ALL_STATIONS(st) {
 
	for (const Station *st : Station::Iterate()) {
 
		if (st->town == t) {
 
			/* Non-oil rig stations are always a problem. */
 
			if (!(st->facilities & FACIL_AIRPORT) || st->airport.type != AT_OILRIG) return CMD_ERROR;
 
			/* We can only automatically delete oil rigs *if* there's no vehicle on them. */
 
			CommandCost ret = DoCommand(st->airport.tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
			if (ret.Failed()) return ret;
 
		}
 
	}
 

	
 
	/* Depots refer to towns. */
 
	const Depot *d;
 
	FOR_ALL_DEPOTS(d) {
 
@@ -3150,26 +3149,25 @@ static CommandCost TownActionBuyRights(T
 
	}
 
	return CommandCost();
 
}
 

	
 
static CommandCost TownActionBribe(Town *t, DoCommandFlag flags)
 
{
 
	if (flags & DC_EXEC) {
 
		if (Chance16(1, 14)) {
 
			/* set as unwanted for 6 months */
 
			t->unwanted[_current_company] = 6;
 

	
 
			/* set all close by station ratings to 0 */
 
			Station *st;
 
			FOR_ALL_STATIONS(st) {
 
			for (Station *st : Station::Iterate()) {
 
				if (st->town == t && st->owner == _current_company) {
 
					for (CargoID i = 0; i < NUM_CARGO; i++) st->goods[i].rating = 0;
 
				}
 
			}
 

	
 
			/* only show error message to the executing player. All errors are handled command.c
 
			 * but this is special, because it can only 'fail' on a DC_EXEC */
 
			if (IsLocalCompany()) ShowErrorMessage(STR_ERROR_BRIBE_FAILED, INVALID_STRING_ID, WL_INFO);
 

	
 
			/* decrease by a lot!
 
			 * ChangeTownRating is only for stuff in demolishing. Bribe failure should
 
			 * be independent of any cheat settings