~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/tile_cmd.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: tile_cmd.h 12199 2008-02-20 17:49:50Z frosch $ */
 
1
/* $Id: tile_cmd.h 15434 2009-02-09 21:20:05Z rubidium $ */
2
2
 
3
3
/** @file tile_cmd.h Generic 'commands' that can be performed on all tiles. */
4
4
 
12
12
#include "cargo_type.h"
13
13
#include "strings_type.h"
14
14
#include "date_type.h"
15
 
#include "player_type.h"
 
15
#include "company_type.h"
16
16
#include "direction_type.h"
17
17
#include "track_type.h"
 
18
#include "transport_type.h"
18
19
 
19
20
/** The returned bits of VehicleEnterTile. */
20
21
enum VehicleEnterTileStatus {
38
39
};
39
40
DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus);
40
41
 
 
42
/** Tile information, used while rendering the tile */
41
43
struct TileInfo {
42
 
        uint x;
43
 
        uint y;
44
 
        Slope tileh;
45
 
        TileIndex tile;
46
 
        uint z;
 
44
        uint x;         ///< X position of the tile in unit coordinates
 
45
        uint y;         ///< Y position of the tile in unit coordinates
 
46
        Slope tileh;    ///< Slope of the tile
 
47
        TileIndex tile; ///< Tile index
 
48
        uint z;         ///< Height
47
49
};
48
50
 
 
51
/** Tile description for the 'land area information' tool */
49
52
struct TileDesc {
50
 
        StringID str;
51
 
        Owner owner;
52
 
        Date build_date;
53
 
        uint64 dparam[2];
 
53
        StringID str;           ///< Description of the tile
 
54
        Owner owner[4];         ///< Name of the owner(s)
 
55
        StringID owner_type[4]; ///< Type of each owner
 
56
        Date build_date;        ///< Date of construction of tile contents
 
57
        StringID station_class; ///< Class of station
 
58
        StringID station_name;  ///< Type of station within the class
 
59
        const char *grf;        ///< newGRF used for the tile contents
 
60
        uint64 dparam[2];       ///< Parameters of the \a str string
54
61
};
55
62
 
 
63
/**
 
64
 * Tile callback function signature for drawing a tile and its contents to the screen
 
65
 * @param ti Information about the tile to draw
 
66
 */
56
67
typedef void DrawTileProc(TileInfo *ti);
57
68
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
58
 
typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
 
69
typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags);
 
70
 
 
71
/**
 
72
 * Tile callback function signature for obtaining accepted carog of a tile
 
73
 * @param tile Tile queried for its accepted cargo
 
74
 * @param res  Storage destination of the cargo accepted
 
75
 */
59
76
typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
 
77
 
 
78
/**
 
79
 * Tile callback function signature for obtaining a tile description
 
80
 * @param tile Tile being queried
 
81
 * @param td   Storage pointer for returned tile description
 
82
 */
60
83
typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
61
84
 
62
85
/**
63
 
 * GetTileTrackStatusProcs return a value that contains the possible tracks
 
86
 * Tile callback function signature for getting the possible tracks
64
87
 * that can be taken on a given tile by a given transport.
 
88
 *
65
89
 * The return value contains the existing trackdirs and signal states.
66
90
 *
67
91
 * see track_func.h for usage of TrackStatus.
72
96
 * @return the track status information
73
97
 */
74
98
typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
 
99
 
 
100
/**
 
101
 * Tile callback function signature for obtaining the produced cargo of a tile.
 
102
 * @param tile Tile being queried
 
103
 * @param b    Destination array of produced cargo
 
104
 */
75
105
typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
76
 
typedef void ClickTileProc(TileIndex tile);
 
106
typedef bool ClickTileProc(TileIndex tile);
77
107
typedef void AnimateTileProc(TileIndex tile);
78
108
typedef void TileLoopProc(TileIndex tile);
79
 
typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
 
109
typedef void ChangeTileOwnerProc(TileIndex tile, Owner old_owner, Owner new_owner);
80
110
 
81
111
/** @see VehicleEnterTileStatus to see what the return values mean */
82
112
typedef VehicleEnterTileStatus VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
83
113
typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
84
114
 
85
115
/**
86
 
 * Called when a tile is affected by a terraforming operation.
87
 
 * The function has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype.
88
 
 * With DC_EXEC in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
 
116
 * Tile callback function signature of the terraforming callback.
 
117
 *
 
118
 * The function is called when a tile is affected by a terraforming operation.
 
119
 * It has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype.
 
120
 * With DC_EXEC in \a flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
89
121
 *
90
122
 * @note The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation.
91
123
 *
95
127
 * @param tileh_new Slope after terraforming.
96
128
 * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
97
129
 */
98
 
typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
 
130
typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new);
99
131
 
 
132
/**
 
133
 * Set of callback functions for performing tile operations of a given tile type.
 
134
 * @see TileType */
100
135
struct TileTypeProcs {
101
 
        DrawTileProc *draw_tile_proc;
 
136
        DrawTileProc *draw_tile_proc;                  ///< Called to render the tile and its contents to the screen
102
137
        GetSlopeZProc *get_slope_z_proc;
103
138
        ClearTileProc *clear_tile_proc;
104
 
        GetAcceptedCargoProc *get_accepted_cargo_proc;
105
 
        GetTileDescProc *get_tile_desc_proc;
106
 
        GetTileTrackStatusProc *get_tile_track_status_proc;
107
 
        ClickTileProc *click_tile_proc;
 
139
        GetAcceptedCargoProc *get_accepted_cargo_proc; ///< Return accepted cargo of the tile
 
140
        GetTileDescProc *get_tile_desc_proc;           ///< Get a description of a tile (for the 'land area information' tool)
 
141
        GetTileTrackStatusProc *get_tile_track_status_proc; ///< Get available tracks and status of a tile
 
142
        ClickTileProc *click_tile_proc;                ///< Called when tile is clicked
108
143
        AnimateTileProc *animate_tile_proc;
109
144
        TileLoopProc *tile_loop_proc;
110
145
        ChangeTileOwnerProc *change_tile_owner_proc;
111
 
        GetProducedCargoProc *get_produced_cargo_proc;
112
 
        VehicleEnterTileProc *vehicle_enter_tile_proc;
 
146
        GetProducedCargoProc *get_produced_cargo_proc; ///< Return produced cargo of the tile
 
147
        VehicleEnterTileProc *vehicle_enter_tile_proc; ///< Called when a vehicle enters a tile
113
148
        GetFoundationProc *get_foundation_proc;
114
 
        TerraformTileProc *terraform_tile_proc;
 
149
        TerraformTileProc *terraform_tile_proc;        ///< Called when a terraforming operation is about to take place
115
150
};
116
151
 
117
152
extern const TileTypeProcs * const _tile_type_procs[16];
118
153
 
119
154
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
 
155
VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y);
120
156
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
121
 
void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
 
157
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner);
122
158
void AnimateTile(TileIndex tile);
123
 
void ClickTile(TileIndex tile);
 
159
bool ClickTile(TileIndex tile);
124
160
void GetTileDesc(TileIndex tile, TileDesc *td);
125
161
 
126
162
#endif /* TILE_CMD_H */