Question: Is there a trick to determine whether we´re on a station tile drawn in x- or y-direction? I´d need this info to override the tile type of certain tiles by CB24.
regards
Michael
Question about station tile orientation
Moderator: Graphics Moderators
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: Question about station tile orientation
In theory that would be the lowest bit of the T component of vars 4x. In CB 24, var 10 is supposed to contain the same info as 41 normally would, but unfortunately OTTD always sets the T components to 0 in this case. I guess it would be possible to change that to 0/1 according to axis, but I don't know if any NewGRF might depend on it being 0.
Basically:
-- Michael Lutz
Basically:
Code: Select all
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 180a25d..a1a62de 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1275,7 +1275,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
if (statspec != NULL) {
/* Use a fixed axis for GetPlatformInfo as our platforms / numtracks are always the right way around */
- uint32 platinfo = GetPlatformInfo(AXIS_X, 0, plat_len, numtracks_orig, plat_len - w, numtracks_orig - numtracks, false);
+ uint32 platinfo = GetPlatformInfo(AXIS_X, axis, plat_len, numtracks_orig, plat_len - w, numtracks_orig - numtracks, false);
/* As the station is not yet completely finished, the station does not yet exist. */
uint16 callback = GetStationCallback(CBID_STATION_TILE_LAYOUT, platinfo, 0, statspec, NULL, tile);
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: Question about station tile orientation
Thanks for the quick reply.Michi_cc wrote: In theory that would be the lowest bit of the T component of vars 4x.
But not only in "theory", it´s in the specs:
I only wonder about that restriction?nfo spec wrote: T Tile type: the current tile type; only valid for callback 14
I´d very much support this proposal.Michi_cc wrote: In CB 24, var 10 is supposed to contain the same info as 41 normally would, but unfortunately OTTD always sets the T components to 0 in this case.
I guess it would be possible to change that to 0/1 according to axis,
Hm. I´ve never used it myself for this purpose. I have taken a look now into CanStations and ISR, and both are using CB24. CanStations only by returning fixed tile type numbers, and ISR using indeed CB24 accessing var10, but obviously not checking T.Michi_cc wrote: but I don't know if any NewGRF might depend on it being 0.
regards
Michael
Re: Question about station tile orientation
No idea. I don't see anything in OTTD source code that would preclude using it anywhere a real station tile is present. It's obviously not usable for things that are called before construction. Unless TTDPatch is implemented vastly different I'd guess this is simply a stale sentence in the docs.michael blunck wrote:I only wonder about that restriction?
-- Michael Lutz
Re: Question about station tile orientation
TTDP resolves the "T" part using a global variable "curstattiletype", not by accessing the map.
This variable is only assigned when resolving CB 14. So, yes, for TTDP it only works for CB 14, in other cases it returns the value from the last CB 14 to any station tile (probably some other tile). (though I have no idea why TTDP does it this way)
Anyway, TTDP CB 24 also fills the "T" part in var10 (with the value which would be used if the CB fails), so OTTD should do the same.
This variable is only assigned when resolving CB 14. So, yes, for TTDP it only works for CB 14, in other cases it returns the value from the last CB 14 to any station tile (probably some other tile). (though I have no idea why TTDP does it this way)
Anyway, TTDP CB 24 also fills the "T" part in var10 (with the value which would be used if the CB fails), so OTTD should do the same.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Who is online
Users browsing this forum: No registered users and 16 guests