File diff r11089:babc36cbd948 → r11090:9276cea703d4
src/unmovable_cmd.cpp
Show inline comments
 
@@ -46,13 +46,13 @@ static inline const UnmovableSpec *GetUn
 
 * During normal gameplay you can only implicitely destroy a HQ when you are
 
 * rebuilding it. Otherwise, only water can destroy it.
 
 * @param cid Company requesting the destruction of his HQ
 
 * @param flags docommand flags of calling function
 
 * @return cost of the operation
 
 */
 
static CommandCost DestroyCompanyHQ(CompanyID cid, uint32 flags)
 
static CommandCost DestroyCompanyHQ(CompanyID cid, DoCommandFlag flags)
 
{
 
	Company *c = GetCompany(cid);
 

	
 
	if (flags & DC_EXEC) {
 
		TileIndex t = c->location_of_HQ;
 

	
 
@@ -86,21 +86,21 @@ void UpdateCompanyHQ(Company *c, uint sc
 
	MarkTileDirtyByTile(tile);
 
	MarkTileDirtyByTile(tile + TileDiffXY(0, 1));
 
	MarkTileDirtyByTile(tile + TileDiffXY(1, 0));
 
	MarkTileDirtyByTile(tile + TileDiffXY(1, 1));
 
}
 

	
 
extern CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID *station, bool check_clear = true);
 
extern CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, DoCommandFlag flags, uint invalid_dirs, StationID *station, bool check_clear = true);
 

	
 
/** Build or relocate the HQ. This depends if the HQ is already built or not
 
 * @param tile tile where the HQ will be built or relocated to
 
 * @param flags type of operation
 
 * @param p1 unused
 
 * @param p2 unused
 
 */
 
CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
CommandCost CmdBuildCompanyHQ(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	Company *c = GetCompany(_current_company);
 
	CommandCost cost(EXPENSES_PROPERTY);
 

	
 
	cost = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
 
	if (CmdFailed(cost)) return cost;
 
@@ -128,13 +128,13 @@ CommandCost CmdBuildCompanyHQ(TileIndex 
 
 * @param tile the tile the company is purchasing
 
 * @param flags for this command type
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @return error of cost of operation
 
 */
 
CommandCost CmdPurchaseLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
CommandCost CmdPurchaseLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 

	
 
	if (IsOwnedLandTile(tile) && IsTileOwner(tile, _current_company)) {
 
		return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT);
 
	}
 
@@ -155,13 +155,13 @@ CommandCost CmdPurchaseLandArea(TileInde
 
 * @param tile the tile the company is selling
 
 * @param flags for this command type
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @return error or cost of operation
 
 */
 
CommandCost CmdSellLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
CommandCost CmdSellLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	if (!IsOwnedLandTile(tile)) return CMD_ERROR;
 
	if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER) return CMD_ERROR;
 

	
 
	if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
 

	
 
@@ -255,13 +255,13 @@ static uint GetSlopeZ_Unmovable(TileInde
 

	
 
static Foundation GetFoundation_Unmovable(TileIndex tile, Slope tileh)
 
{
 
	return IsOwnedLand(tile) ? FOUNDATION_NONE : FlatteningFoundation(tileh);
 
}
 

	
 
static CommandCost ClearTile_Unmovable(TileIndex tile, byte flags)
 
static CommandCost ClearTile_Unmovable(TileIndex tile, DoCommandFlag flags)
 
{
 
	if (IsCompanyHQ(tile)) {
 
		if (_current_company == OWNER_WATER) {
 
			return DestroyCompanyHQ(GetTileOwner(tile), DC_EXEC);
 
		} else {
 
			return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
 
@@ -483,13 +483,13 @@ static void ChangeTileOwner_Unmovable(Ti
 
		InvalidateWindow(WC_TOWN_AUTHORITY, town);
 
	} else {
 
		DoClearSquare(tile);
 
	}
 
}
 

	
 
static CommandCost TerraformTile_Unmovable(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 
static CommandCost TerraformTile_Unmovable(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
 
{
 
	/* Owned land remains unsold */
 
	if (IsOwnedLand(tile) && CheckTileOwnership(tile)) return CommandCost();
 

	
 
	if (AutoslopeEnabled() && (IsStatue(tile) || IsCompanyHQ(tile))) {
 
		if (!IsSteepSlope(tileh_new) && (z_new + GetSlopeMaxZ(tileh_new) == GetTileMaxZ(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);