File diff r11089:babc36cbd948 → r11090:9276cea703d4
src/town_cmd.cpp
Show inline comments
 
@@ -513,13 +513,13 @@ static void TileLoop_Town(TileIndex tile
 
static bool ClickTile_Town(TileIndex tile)
 
{
 
	/* not used */
 
	return false;
 
}
 

	
 
static CommandCost ClearTile_Town(TileIndex tile, byte flags)
 
static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags)
 
{
 
	if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
 
	if (!CanDeleteHouse(tile)) return CMD_ERROR;
 

	
 
	const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
 

	
 
@@ -1507,13 +1507,13 @@ static void DoCreateTown(Town *t, TileIn
 
 * @param flags type of operation
 
 * @param p1  0..1 size of the town (@see TownSize)
 
 *               2 true iff it should be a city
 
 *            3..5 town road layout (@see TownLayout)
 
 * @param p2 unused
 
 */
 
CommandCost CmdBuildTown(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
CommandCost CmdBuildTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	/* Only in the scenario editor */
 
	if (_game_mode != GM_EDITOR) return CMD_ERROR;
 

	
 
	TownSize size = (TownSize)GB(p1, 0, 2);
 
	bool city = HasBit(p1, 2);
 
@@ -2095,13 +2095,13 @@ static bool IsUniqueTownName(const char 
 
/** Rename a town (server-only).
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 town ID to rename
 
 * @param p2 unused
 
 */
 
CommandCost CmdRenameTown(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	if (!IsValidTownID(p1)) return CMD_ERROR;
 

	
 
	bool reset = StrEmpty(text);
 

	
 
	if (!reset) {
 
@@ -2365,13 +2365,13 @@ uint GetMaskOfTownActions(int *nump, Com
 
 * but also bribing the town-council
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 town to do the action at
 
 * @param p2 action to perform, @see _town_action_proc for the list of available actions
 
 */
 
CommandCost CmdDoTownAction(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	if (!IsValidTownID(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR;
 

	
 
	Town *t = GetTown(p1);
 

	
 
	if (!HasBit(GetMaskOfTownActions(NULL, _current_company, t), p2)) return CMD_ERROR;
 
@@ -2494,13 +2494,13 @@ static void UpdateTownUnwanted(Town *t)
 

	
 
/**
 
 * Checks whether the local authority allows construction of a new station (rail, road, airport, dock) on the given tile
 
 * @param tile The tile where the station shall be constructed.
 
 * @param flags Command flags. DC_NO_TOWN_RATING is tested.
 
 */
 
bool CheckIfAuthorityAllowsNewStation(TileIndex tile, uint32 flags)
 
bool CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
 
{
 
	if (!IsValidCompanyID(_current_company) || (flags & DC_NO_TOWN_RATING)) return true;
 

	
 
	Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 
	if (t == NULL) return true;
 

	
 
@@ -2627,13 +2627,13 @@ static const int _default_rating_setting
 
	/* ROAD_REMOVE, TUNNELBRIDGE_REMOVE, INDUSTRY_REMOVE */
 
	{  0, 128, 384}, // Permissive
 
	{ 48, 192, 480}, // Neutral
 
	{ 96, 384, 768}, // Hostile
 
};
 

	
 
bool CheckforTownRating(uint32 flags, Town *t, byte type)
 
bool CheckforTownRating(DoCommandFlag flags, Town *t, byte type)
 
{
 
	/* if magic_bulldozer cheat is active, town doesn't restrict your destructive actions */
 
	if (t == NULL || !IsValidCompanyID(_current_company) || _cheats.magic_bulldozer.value)
 
		return true;
 

	
 
	/* check if you're allowed to remove the street/bridge/tunnel/industry
 
@@ -2689,13 +2689,13 @@ void InitializeTowns()
 

	
 
	_cur_town_ctr = 0;
 
	_cur_town_iter = 0;
 
	_total_towns = 0;
 
}
 

	
 
static CommandCost TerraformTile_Town(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 
static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
 
{
 
	if (AutoslopeEnabled()) {
 
		HouseID house = GetHouseType(tile);
 
		GetHouseNorthPart(house); // modifies house to the ID of the north tile
 
		const HouseSpec *hs = GetHouseSpecs(house);