Handling of unmovable tiles. More...
#include "stdafx.h"#include "landscape.h"#include "command_func.h"#include "viewport_func.h"#include "company_base.h"#include "town.h"#include "bridge_map.h"#include "genworld.h"#include "autoslope.h"#include "transparency.h"#include "functions.h"#include "window_func.h"#include "vehicle_func.h"#include "company_gui.h"#include "cheat_type.h"#include "landscape_type.h"#include "unmovable.h"#include "cargopacket.h"#include "sprite.h"#include "core/random_func.hpp"#include "unmovable_map.h"#include "table/strings.h"#include "table/sprites.h"#include "table/unmovable_land.h"Go to the source code of this file.
Functions | |
| static const UnmovableSpec * | GetUnmovableSpec (UnmovableType type) |
| Accessor for array _original_unmovable. | |
| static CommandCost | DestroyCompanyHQ (CompanyID cid, DoCommandFlag flags) |
| Destroy a HQ. | |
| void | UpdateCompanyHQ (Company *c, uint score) |
| CommandCost | CheckFlatLandBelow (TileIndex tile, uint w, uint h, DoCommandFlag flags, uint invalid_dirs, StationID *station, bool check_clear=true, RailType rt=INVALID_RAILTYPE) |
| Tries to clear the given area. | |
| CommandCost | CmdBuildCompanyHQ (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Build or relocate the HQ. | |
| CommandCost | CmdPurchaseLandArea (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Purchase a land area. | |
| CommandCost | CmdSellLandArea (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Sell a land area. | |
| static Foundation | GetFoundation_Unmovable (TileIndex tile, Slope tileh) |
| static void | DrawTile_Unmovable (TileInfo *ti) |
| static uint | GetSlopeZ_Unmovable (TileIndex tile, uint x, uint y) |
| static CommandCost | ClearTile_Unmovable (TileIndex tile, DoCommandFlag flags) |
| static void | AddAcceptedCargo_Unmovable (TileIndex tile, CargoArray &acceptance, uint32 *always_accepted) |
| static void | GetTileDesc_Unmovable (TileIndex tile, TileDesc *td) |
| static void | TileLoop_Unmovable (TileIndex tile) |
| static TrackStatus | GetTileTrackStatus_Unmovable (TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) |
| static bool | ClickTile_Unmovable (TileIndex tile) |
| static bool | IsRadioTowerNearby (TileIndex tile) |
| void | GenerateUnmovables () |
| static void | ChangeTileOwner_Unmovable (TileIndex tile, Owner old_owner, Owner new_owner) |
| static CommandCost | TerraformTile_Unmovable (TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) |
Variables | |
| const TileTypeProcs | _tile_type_unmovable_procs |
Handling of unmovable tiles.
Definition in file unmovable_cmd.cpp.
| CommandCost CheckFlatLandBelow | ( | TileIndex | tile, | |
| uint | w, | |||
| uint | h, | |||
| DoCommandFlag | flags, | |||
| uint | invalid_dirs, | |||
| StationID * | station, | |||
| bool | check_clear = true, |
|||
| RailType | rt = INVALID_RAILTYPE | |||
| ) |
Tries to clear the given area.
| tile | TileIndex to start check | |
| w | width of search area | |
| h | height of search area | |
| flags | operation to perform | |
| invalid_dirs | prohibited directions (set of DiagDirections) | |
| station | StationID to be queried and returned if available | |
| check_clear | if clearing tile should be performed (in wich case, cost will be added) | |
| rt | The rail type to check for (overbuilding rail stations over rail) |
Definition at line 675 of file station_cmd.cpp.
References _settings_game, CommandCost::AddCost(), ConstructionSettings::build_on_slopes, CMD_ERROR, CMD_LANDSCAPE_CLEAR, CMD_REMOVE_SINGLE_RAIL, GameSettings::construction, DC_AUTO, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, DoCommand(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), GetRailType(), GetStationIndex(), GetTileSlope(), GetTrackBits(), HasBit(), HasPowerOnRail(), HasSignals(), INVALID_RAILTYPE, IsBridgeAbove(), IsPlainRailTile(), IsRailStation(), IsSteepSlope(), IsTileType(), MayHaveBridgeAbove(), MP_STATION, RemoveFirstTrack(), return_cmd_error, SLOPE_FLAT, SLOPE_NE, SLOPE_NW, SLOPE_SE, SLOPE_SW, TILE_HEIGHT, TILE_LOOP, TRACK_BIT_NONE, TRACK_X, and TRACK_Y.
Referenced by CmdBuildAirport(), CmdBuildCompanyHQ(), CmdBuildRailStation(), and CmdBuildRoadStop().
| CommandCost CmdBuildCompanyHQ | ( | TileIndex | tile, | |
| DoCommandFlag | flags, | |||
| uint32 | p1, | |||
| uint32 | p2, | |||
| const char * | text | |||
| ) |
Build or relocate the HQ.
This depends if the HQ is already built or not
| tile | tile where the HQ will be built or relocated to | |
| flags | type of operation | |
| p1 | unused | |
| p2 | unused | |
| text | unused |
Definition at line 111 of file unmovable_cmd.cpp.
References CommandCost::AddCost(), CheckFlatLandBelow(), DC_EXEC, DestroyCompanyHQ(), EXPENSES_PROPERTY, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, Company::location_of_HQ, MakeCompanyHQ(), SetWindowDirty(), and UpdateCompanyRatingAndValue().
| CommandCost CmdPurchaseLandArea | ( | TileIndex | tile, | |
| DoCommandFlag | flags, | |||
| uint32 | p1, | |||
| uint32 | p2, | |||
| const char * | text | |||
| ) |
Purchase a land area.
Actually you only purchase one tile, so the name is a bit confusing ;p
| tile | the tile the company is purchasing | |
| flags | for this command type | |
| p1 | unused | |
| p2 | unused | |
| text | unused |
Definition at line 146 of file unmovable_cmd.cpp.
References CommandCost::AddCost(), CMD_ERROR, CMD_LANDSCAPE_CLEAR, DC_EXEC, DoCommand(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), GetUnmovableSpec(), IsOwnedLandTile(), IsTileOwner(), MakeOwnedLand(), MarkTileDirtyByTile(), return_cmd_error, and UNMOVABLE_OWNED_LAND.
| CommandCost CmdSellLandArea | ( | TileIndex | tile, | |
| DoCommandFlag | flags, | |||
| uint32 | p1, | |||
| uint32 | p2, | |||
| const char * | text | |||
| ) |
Sell a land area.
Actually you only sell one tile, so the name is a bit confusing ;p
| tile | the tile the company is selling | |
| flags | for this command type | |
| p1 | unused | |
| p2 | unused | |
| text | unused |
Definition at line 175 of file unmovable_cmd.cpp.
References CheckTileOwnership(), CMD_ERROR, DC_EXEC, EXPENSES_CONSTRUCTION, GetUnmovableSpec(), IsOwnedLandTile(), OWNER_WATER, and UNMOVABLE_OWNED_LAND.
| static CommandCost DestroyCompanyHQ | ( | CompanyID | cid, | |
| DoCommandFlag | flags | |||
| ) | [static] |
Destroy a HQ.
During normal gameplay you can only implicitely destroy a HQ when you are rebuilding it. Otherwise, only water can destroy it.
| cid | Company requesting the destruction of his HQ | |
| flags | docommand flags of calling function |
Definition at line 59 of file unmovable_cmd.cpp.
References CalculateCompanyValue(), DC_EXEC, EXPENSES_PROPERTY, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), INVALID_TILE, CargoPacket::InvalidateAllFrom(), Company::location_of_HQ, SetWindowDirty(), ST_HEADQUARTERS, and TileDiffXY().
Referenced by CmdBuildCompanyHQ().
| static const UnmovableSpec* GetUnmovableSpec | ( | UnmovableType | type | ) | [inline, static] |
Accessor for array _original_unmovable.
This will ensure at once : proper access and not allowing modifications of it.
| type | of unmovable (which is the index in _original_unmovable) |
Definition at line 46 of file unmovable_cmd.cpp.
Referenced by CmdPurchaseLandArea(), and CmdSellLandArea().
| const TileTypeProcs _tile_type_unmovable_procs |
{
DrawTile_Unmovable,
GetSlopeZ_Unmovable,
ClearTile_Unmovable,
AddAcceptedCargo_Unmovable,
GetTileDesc_Unmovable,
GetTileTrackStatus_Unmovable,
ClickTile_Unmovable,
NULL,
TileLoop_Unmovable,
ChangeTileOwner_Unmovable,
NULL,
NULL,
GetFoundation_Unmovable,
TerraformTile_Unmovable,
}
1.6.1