From 857b8b045b8fea9d2c77e12d4f4fc309c0912f53 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sun, 16 Apr 2006 17:29:37 +0000 Subject: [PATCH] (svn r4450) - NewStations, rename *CustomStationSprite() to *CustomStationSpecIndex() to reflect their use, and alter the test for determining if a station has customised graphics. --- docs/landscape.html | 3 +-- docs/landscape_grid.html | 2 +- station_cmd.c | 6 +++--- station_map.h | 11 +++++------ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/landscape.html b/docs/landscape.html index b28a8932fc..3e3d51a605 100644 --- a/docs/landscape.html +++ b/docs/landscape.html @@ -381,8 +381,7 @@ exit towards: 47 - NE, 48 - SE, 49 - SW, 4A
  • m1: owner of the station
  • m2: index into the array of stations
  • m3 bits 0..3: track type for railway stations, must be 0 for all the other stations
  • -
  • m3 bit 4 = use custom sprite (valid only railway stations FOR NOW)
  • -
  • m4 = custom station id
  • +
  • m4 = custom station id; 0 means standard graphics
  • diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html index 910f028b97..f1e985eed0 100644 --- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -145,7 +145,7 @@ the array so you can quickly see what is used and what is not. station XXXX XXXX XXXX XXXX XXXX XXXX - OOOX XXXX + OOOO XXXX XXXX XXXX XXXX XXXX XXXX XXXX diff --git a/station_cmd.c b/station_cmd.c index 117a0944c3..b07d2c5702 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -1061,7 +1061,7 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3 MakeRailStation(tile, st->owner, st->index, axis, *layout_ptr++, GB(p2, 0, 4)); - if (HASBIT(p2, 4)) SetCustomStationSprite(tile, GB(p2, 8, 8)); + if (HASBIT(p2, 4)) SetCustomStationSpecIndex(tile, GB(p2, 8, 8)); tile += tile_delta; } while (--w); @@ -1934,9 +1934,9 @@ static void DrawTile_Station(TileInfo *ti) if (ti->tileh != 0 && !IsDock(ti->tile)) DrawFoundation(ti, ti->tileh); - if (IsCustomStationSprite(ti->tile)) { + if (IsCustomStationSpecIndex(ti->tile)) { // look for customization - const StationSpec *statspec = GetCustomStation(STAT_CLASS_DFLT, GetCustomStationSprite(ti->tile)); + const StationSpec *statspec = GetCustomStation(STAT_CLASS_DFLT, GetCustomStationSpecIndex(ti->tile)); //debug("Cust-o-mized %p", statspec); diff --git a/station_map.h b/station_map.h index 8e07fd49e1..847b028d8f 100644 --- a/station_map.h +++ b/station_map.h @@ -218,20 +218,19 @@ static inline TileIndexDiffC GetDockOffset(TileIndex t) return dock_offset[GetDockDirection(t)]; } -static inline bool IsCustomStationSprite(TileIndex t) +static inline bool IsCustomStationSpecIndex(TileIndex t) { assert(IsTileType(t, MP_STATION)); - return HASBIT(_m[t].m3, 4); + return _m[t].m4 != 0; } -static inline void SetCustomStationSprite(TileIndex t, byte sprite) +static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex) { assert(IsTileType(t, MP_STATION)); - SETBIT(_m[t].m3, 4); - _m[t].m4 = sprite; + _m[t].m4 = specindex; } -static inline uint GetCustomStationSprite(TileIndex t) +static inline uint GetCustomStationSpecIndex(TileIndex t) { assert(IsTileType(t, MP_STATION)); return _m[t].m4;