tile_cmd.h

Go to the documentation of this file.
00001 /* $Id: tile_cmd.h 15434 2009-02-09 21:20:05Z rubidium $ */
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 "company_type.h"
00016 #include "direction_type.h"
00017 #include "track_type.h"
00018 #include "transport_type.h"
00019 
00021 enum VehicleEnterTileStatus {
00022   VETS_ENTERED_STATION  = 1, 
00023   VETS_ENTERED_WORMHOLE = 2, 
00024   VETS_CANNOT_ENTER     = 3, 
00025 
00031   VETS_STATION_ID_OFFSET = 8,
00032   VETS_STATION_MASK      = 0xFFFF << VETS_STATION_ID_OFFSET,
00033 
00035   VETSB_CONTINUE         = 0,                          
00036   VETSB_ENTERED_STATION  = 1 << VETS_ENTERED_STATION,  
00037   VETSB_ENTERED_WORMHOLE = 1 << VETS_ENTERED_WORMHOLE, 
00038   VETSB_CANNOT_ENTER     = 1 << VETS_CANNOT_ENTER,     
00039 };
00040 DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus);
00041 
00043 struct TileInfo {
00044   uint x;         
00045   uint y;         
00046   Slope tileh;    
00047   TileIndex tile; 
00048   uint z;         
00049 };
00050 
00052 struct TileDesc {
00053   StringID str;           
00054   Owner owner[4];         
00055   StringID owner_type[4]; 
00056   Date build_date;        
00057   StringID station_class; 
00058   StringID station_name;  
00059   const char *grf;        
00060   uint64 dparam[2];       
00061 };
00062 
00067 typedef void DrawTileProc(TileInfo *ti);
00068 typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
00069 typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags);
00070 
00076 typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
00077 
00083 typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
00084 
00098 typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
00099 
00105 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
00106 typedef bool ClickTileProc(TileIndex tile);
00107 typedef void AnimateTileProc(TileIndex tile);
00108 typedef void TileLoopProc(TileIndex tile);
00109 typedef void ChangeTileOwnerProc(TileIndex tile, Owner old_owner, Owner new_owner);
00110 
00112 typedef VehicleEnterTileStatus VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
00113 typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
00114 
00130 typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new);
00131 
00135 struct TileTypeProcs {
00136   DrawTileProc *draw_tile_proc;                  
00137   GetSlopeZProc *get_slope_z_proc;
00138   ClearTileProc *clear_tile_proc;
00139   GetAcceptedCargoProc *get_accepted_cargo_proc; 
00140   GetTileDescProc *get_tile_desc_proc;           
00141   GetTileTrackStatusProc *get_tile_track_status_proc; 
00142   ClickTileProc *click_tile_proc;                
00143   AnimateTileProc *animate_tile_proc;
00144   TileLoopProc *tile_loop_proc;
00145   ChangeTileOwnerProc *change_tile_owner_proc;
00146   GetProducedCargoProc *get_produced_cargo_proc; 
00147   VehicleEnterTileProc *vehicle_enter_tile_proc; 
00148   GetFoundationProc *get_foundation_proc;
00149   TerraformTileProc *terraform_tile_proc;        
00150 };
00151 
00152 extern const TileTypeProcs * const _tile_type_procs[16];
00153 
00154 TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
00155 VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y);
00156 void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
00157 void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner);
00158 void AnimateTile(TileIndex tile);
00159 bool ClickTile(TileIndex tile);
00160 void GetTileDesc(TileIndex tile, TileDesc *td);
00161 
00162 #endif /* TILE_CMD_H */

Generated on Mon May 11 15:48:08 2009 for OpenTTD by  doxygen 1.5.6