# tile_cmd.h

Go to the documentation of this file.

    00001 /* $Id: tile_cmd.h 12199 2008-02-20 17:49:50Z frosch $ */
    00002
    00005 #ifndef TILE_CMD_H
    00006 #define TILE_CMD_H
    00007
    00008 #include "slope_type.h"
    00009 #include "tile_type.h"
    00010 #include "command_type.h"
    00011 #include "vehicle_type.h"
    00012 #include "cargo_type.h"
    00013 #include "strings_type.h"
    00014 #include "date_type.h"
    00015 #include "player_type.h"
    00016 #include "direction_type.h"
    00017 #include "track_type.h"
    00018
    00020 enum VehicleEnterTileStatus {
    00021   VETS_ENTERED_STATION  = 1,
    00022   VETS_ENTERED_WORMHOLE = 2,
    00023   VETS_CANNOT_ENTER     = 3,
    00024
    00030   VETS_STATION_ID_OFFSET = 8,
    00031   VETS_STATION_MASK      = 0xFFFF << VETS_STATION_ID_OFFSET,
    00032
    00034   VETSB_CONTINUE         = 0,
    00035   VETSB_ENTERED_STATION  = 1 << VETS_ENTERED_STATION,
    00036   VETSB_ENTERED_WORMHOLE = 1 << VETS_ENTERED_WORMHOLE,
    00037   VETSB_CANNOT_ENTER     = 1 << VETS_CANNOT_ENTER,
    00038 };
    00039 DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus);
    00040
    00041 struct TileInfo {
    00042   uint x;
    00043   uint y;
    00044   Slope tileh;
    00045   TileIndex tile;
    00046   uint z;
    00047 };
    00048
    00049 struct TileDesc {
    00050   StringID str;
    00051   Owner owner;
    00052   Date build_date;
    00053   uint64 dparam[2];
    00054 };
    00055
    00056 typedef void DrawTileProc(TileInfo *ti);
    00057 typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
    00058 typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
    00059 typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
    00060 typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
    00061
    00074 typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
    00075 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
    00076 typedef void ClickTileProc(TileIndex tile);
    00077 typedef void AnimateTileProc(TileIndex tile);
    00078 typedef void TileLoopProc(TileIndex tile);
    00079 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
    00080
    00082 typedef VehicleEnterTileStatus VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
    00083 typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
    00084
    00098 typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
    00099
    00100 struct TileTypeProcs {
    00101   DrawTileProc *draw_tile_proc;
    00102   GetSlopeZProc *get_slope_z_proc;
    00103   ClearTileProc *clear_tile_proc;
    00104   GetAcceptedCargoProc *get_accepted_cargo_proc;
    00105   GetTileDescProc *get_tile_desc_proc;
    00106   GetTileTrackStatusProc *get_tile_track_status_proc;
    00107   ClickTileProc *click_tile_proc;
    00108   AnimateTileProc *animate_tile_proc;
    00109   TileLoopProc *tile_loop_proc;
    00110   ChangeTileOwnerProc *change_tile_owner_proc;
    00111   GetProducedCargoProc *get_produced_cargo_proc;
    00112   VehicleEnterTileProc *vehicle_enter_tile_proc;
    00113   GetFoundationProc *get_foundation_proc;
    00114   TerraformTileProc *terraform_tile_proc;
    00115 };
    00116
    00117 extern const TileTypeProcs * const _tile_type_procs[16];
    00118
    00119 TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
    00120 void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
    00121 void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
    00122 void AnimateTile(TileIndex tile);
    00123 void ClickTile(TileIndex tile);
    00124 void GetTileDesc(TileIndex tile, TileDesc *td);
    00125
    00126 #endif /* TILE_CMD_H */