unmovable_cmd.cpp File Reference

#include "stdafx.h"
#include "openttd.h"
#include "tile_cmd.h"
#include "landscape.h"
#include "command_func.h"
#include "viewport_func.h"
#include "player_func.h"
#include "player_base.h"
#include "gui.h"
#include "station.h"
#include "town.h"
#include "sprite.h"
#include "bridge_map.h"
#include "unmovable_map.h"
#include "variables.h"
#include "genworld.h"
#include "bridge.h"
#include "autoslope.h"
#include "transparency.h"
#include "functions.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "player_gui.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "table/unmovable_land.h"

Go to the source code of this file.

Functions

static CommandCost DestroyCompanyHQ (PlayerID pid, uint32 flags)
 Destroy a HQ.
void UpdateCompanyHQ (Player *p, uint score)
CommandCost CheckFlatLandBelow (TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID *station, bool check_clear=true)
 Tries to clear the given area.
CommandCost CmdBuildCompanyHQ (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Build or relocate the HQ.
CommandCost CmdPurchaseLandArea (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Purchase a land area.
CommandCost CmdSellLandArea (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 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, byte flags)
static void GetAcceptedCargo_Unmovable (TileIndex tile, AcceptedCargo ac)
static void GetTileDesc_Unmovable (TileIndex tile, TileDesc *td)
static void AnimateTile_Unmovable (TileIndex tile)
static void TileLoop_Unmovable (TileIndex tile)
static TrackStatus GetTileTrackStatus_Unmovable (TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
static void ClickTile_Unmovable (TileIndex tile)
static bool IsRadioTowerNearby (TileIndex tile)
void GenerateUnmovables ()
static void ChangeTileOwner_Unmovable (TileIndex tile, PlayerID old_player, PlayerID new_player)
static CommandCost TerraformTile_Unmovable (TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)

Variables

const TileTypeProcs _tile_type_unmovable_procs


Detailed Description

Definition in file unmovable_cmd.cpp.


Function Documentation

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

Tries to clear the given area.

Parameters:
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)
Returns:
the cost in case of success, or an error code if it failed.

Definition at line 703 of file station_cmd.cpp.

References CommandCost::AddCost(), BEGIN_TILE_LOOP, CMD_ERROR, CMD_LANDSCAPE_CLEAR, CmdFailed(), DC_AUTO, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, DoCommand(), END_TILE_LOOP, HasBit(), IsBridgeAbove(), IsSteepSlope(), IsTileType(), MayHaveBridgeAbove(), return_cmd_error, SLOPE_FLAT, SLOPE_NE, SLOPE_NW, SLOPE_SE, SLOPE_SW, and TILE_HEIGHT.

Referenced by CmdBuildAirport(), CmdBuildCompanyHQ(), CmdBuildRailroadStation(), and CmdBuildRoadStop().

CommandCost CmdBuildCompanyHQ ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Build or relocate the HQ.

This depends if the HQ is already built or not

Parameters:
tile tile where the HQ will be built or relocated to
flags type of operation
p1 unused
p2 unused

Definition at line 88 of file unmovable_cmd.cpp.

References CommandCost::AddCost(), CheckFlatLandBelow(), CmdFailed(), DC_EXEC, DestroyCompanyHQ(), MakeCompanyHQ(), and UpdateCompanyRatingAndValue().

CommandCost CmdPurchaseLandArea ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Purchase a land area.

Actually you only purchase one tile, so the name is a bit confusing ;p

Parameters:
tile the tile the player is purchasing
flags for this command type
p1 unused
p2 unused
Returns:
error of cost of operation

Definition at line 122 of file unmovable_cmd.cpp.

References CommandCost::AddCost(), CMD_ERROR, CMD_LANDSCAPE_CLEAR, CmdFailed(), DC_EXEC, DoCommand(), IsOwnedLandTile(), IsTileOwner(), MakeOwnedLand(), MarkTileDirtyByTile(), and return_cmd_error.

CommandCost CmdSellLandArea ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Sell a land area.

Actually you only sell one tile, so the name is a bit confusing ;p

Parameters:
tile the tile the player is selling
flags for this command type
p1 unused
p2 unused
Returns:
error or cost of operation

Definition at line 149 of file unmovable_cmd.cpp.

References CMD_ERROR, DC_EXEC, IsOwnedLandTile(), and OWNER_WATER.

static CommandCost DestroyCompanyHQ ( PlayerID  pid,
uint32  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.

Parameters:
pid Player requesting the destruction of his HQ
flags docommand flags of calling function
Returns:
cost of the operation

Definition at line 40 of file unmovable_cmd.cpp.

References DC_EXEC, and TileDiffXY().

Referenced by CmdBuildCompanyHQ().


Variable Documentation

const TileTypeProcs _tile_type_unmovable_procs

Initial value:

 {
  DrawTile_Unmovable,             
  GetSlopeZ_Unmovable,            
  ClearTile_Unmovable,            
  GetAcceptedCargo_Unmovable,     
  GetTileDesc_Unmovable,          
  GetTileTrackStatus_Unmovable,   
  ClickTile_Unmovable,            
  AnimateTile_Unmovable,          
  TileLoop_Unmovable,             
  ChangeTileOwner_Unmovable,      
  NULL,                           
  NULL,                           
  GetFoundation_Unmovable,        
  TerraformTile_Unmovable,        
}


Generated on Wed Oct 1 17:03:34 2008 for openttd by  doxygen 1.5.6