summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-11 20:34:16 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-11 20:34:16 +0000
commitce9f2fe82364224d8081f5a5ac43e19152e33500 (patch)
tree0cfaa224bb5153de119f9d01928afb07925e0481
parent388c7df1d7f1ac75eadecf30ac7241da6b47fb8c (diff)
downloadopenttd-ce9f2fe82364224d8081f5a5ac43e19152e33500.tar.xz
(svn r3166) Constify read-only accesses of custom stations
-rw-r--r--newgrf.c4
-rw-r--r--rail_cmd.c6
-rw-r--r--station_cmd.c6
-rw-r--r--waypoint.c4
4 files changed, 10 insertions, 10 deletions
diff --git a/newgrf.c b/newgrf.c
index 11c0b0748..f66cec1f5 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -869,13 +869,13 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
FOR_EACH_OBJECT {
StationSpec *stat = &_cur_grffile->stations[stid + i];
byte srcid = grf_load_byte(&buf);
- StationSpec *srcstat = &_cur_grffile->stations[srcid];
+ const StationSpec *srcstat = &_cur_grffile->stations[srcid];
int t;
stat->tiles = srcstat->tiles;
for (t = 0; t < stat->tiles; t++) {
DrawTileSprites *dts = &stat->renderdata[t];
- DrawTileSprites *sdts = &srcstat->renderdata[t];
+ const DrawTileSprites *sdts = &srcstat->renderdata[t];
DrawTileSeqStruct const *sdtss = sdts->seq;
int seq_count = 0;
diff --git a/rail_cmd.c b/rail_cmd.c
index c6e49a8fc..1faeaa720 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1518,12 +1518,12 @@ static void DrawTile_Track(TileInfo *ti)
if (IsRailWaypoint(m5) && HASBIT(_m[ti->tile].m3, 4)) {
// look for customization
- StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _m[ti->tile].m4);
+ const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _m[ti->tile].m4);
- if (stat) {
+ if (stat != NULL) {
DrawTileSeqStruct const *seq;
// emulate station tile - open with building
- DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
+ const DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0);
/* We don't touch the 0x8000 bit. In all this
diff --git a/station_cmd.c b/station_cmd.c
index ec643fcf7..f46bd19a6 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -903,7 +903,7 @@ static inline byte *CreateMulti(byte *layout, int n, byte b)
}
// stolen from TTDPatch
-static void GetStationLayout(byte *layout, int numtracks, int plat_len, StationSpec *spec)
+static void GetStationLayout(byte *layout, int numtracks, int plat_len, const StationSpec *spec)
{
if (spec != NULL && spec->lengths >= plat_len &&
spec->platforms[plat_len - 1] >= numtracks &&
@@ -1033,7 +1033,7 @@ int32 CmdBuildRailroadStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
TileIndexDiff tile_delta;
byte *layout_ptr;
StationID station_index = st->index;
- StationSpec *statspec;
+ const StationSpec *statspec;
// Now really clear the land below the station
// It should never return CMD_ERROR.. but you never know ;)
@@ -2139,7 +2139,7 @@ static void DrawTile_Station(TileInfo *ti)
if (_m[ti->tile].m3 & 0x10) {
// look for customization
- StationSpec *statspec = GetCustomStation(STAT_CLASS_DFLT, _m[ti->tile].m4);
+ const StationSpec *statspec = GetCustomStation(STAT_CLASS_DFLT, _m[ti->tile].m4);
//debug("Cust-o-mized %p", statspec);
diff --git a/waypoint.c b/waypoint.c
index 23e1ceaad..c93492b7c 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -375,9 +375,9 @@ extern uint16 _custom_sprites_base;
/* Draw a waypoint */
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
{
- StationSpec *stat;
+ const StationSpec *stat;
uint32 relocation;
- DrawTileSprites *cust;
+ const DrawTileSprites *cust;
DrawTileSeqStruct const *seq;
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
uint32 ormod, img;