summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-06 22:30:36 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-06 22:30:36 +0000
commit77a4bc5aac541dd2e725690cd69611e0e9a7bf20 (patch)
tree10a5c55c589939f2d1b143474fb880d9b6dbcec3
parent9fd5f289345e41ab67ea5196dceb625b5a1b9c07 (diff)
downloadopenttd-77a4bc5aac541dd2e725690cd69611e0e9a7bf20.tar.xz
(svn r4761) - Newstations: support platform information in variable 10 (callback parameter 1) when building a station
-rw-r--r--newgrf_station.h3
-rw-r--r--station_cmd.c10
2 files changed, 10 insertions, 3 deletions
diff --git a/newgrf_station.h b/newgrf_station.h
index 5be5b669e..4ff686b37 100644
--- a/newgrf_station.h
+++ b/newgrf_station.h
@@ -96,6 +96,9 @@ void SetCustomStationSpec(StationSpec *statspec);
const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station);
const StationSpec *GetCustomStationSpecByGrf(uint32 grfid, byte localidx);
+/* Evaluate a tile's position within a station, and return the result a bitstuffed format. */
+uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, int y, bool centred);
+
/* Get sprite offset for a given custom station and station structure (may be
* NULL - that means we are in a build dialog). The station structure is used
* for variational sprite groups. */
diff --git a/station_cmd.c b/station_cmd.c
index 9605248f9..22c86c82a 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1068,6 +1068,7 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3
if (flags & DC_EXEC) {
TileIndexDiff tile_delta;
byte *layout_ptr;
+ byte numtracks_orig;
Track track;
// Now really clear the land below the station
@@ -1092,17 +1093,20 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3
layout_ptr = alloca(numtracks * plat_len);
GetStationLayout(layout_ptr, numtracks, plat_len, statspec);
+ numtracks_orig = numtracks;
+
do {
TileIndex tile = tile_org;
int w = plat_len;
do {
-
- MakeRailStation(tile, st->owner, st->index, axis, *layout_ptr++, GB(p2, 0, 4));
+ byte layout = *layout_ptr++;
+ MakeRailStation(tile, st->owner, st->index, axis, layout, GB(p2, 0, 4));
SetCustomStationSpecIndex(tile, specindex);
SetStationTileRandomBits(tile, GB(Random(), 0, 4));
if (statspec != NULL) {
- uint16 callback = GetStationCallback(CBID_STATION_TILE_LAYOUT, 0, 0, statspec, st, tile);
+ uint32 platinfo = GetPlatformInfo(axis, layout, plat_len, numtracks_orig, plat_len - w, numtracks_orig - numtracks, false);
+ uint16 callback = GetStationCallback(CBID_STATION_TILE_LAYOUT, platinfo, 0, statspec, st, tile);
if (callback != CALLBACK_FAILED && callback < 8) SetStationGfx(tile, callback);
}