# HG changeset patch # User celestar # Date 1144846240 0 # Node ID 42e939a5e21a95a6fa03d250ab012107f5c02894 # Parent a4e4b90a54f7ad7d73bda52f9e316670dd1f4e98 (svn r4384) -Codechange: rail drawing code -Added a function to obtain the axis of a waypoint -Moved the waypoint layout tables from the depot layout tables into an own one -Use GetRailTileSubtype diff -r a4e4b90a54f7 -r 42e939a5e21a rail_cmd.c --- a/rail_cmd.c Wed Apr 12 12:33:21 2006 +0000 +++ b/rail_cmd.c Wed Apr 12 12:50:40 2006 +0000 @@ -1304,7 +1304,7 @@ } else { /* draw depots / waypoints */ const DrawTrackSeqStruct *drss; - byte type = ti->map5 & 0x3F; // 0-3: depots, 4-5: waypoints + bool is_depot = GetRailTileSubtype(ti->tile) == RAIL_SUBTYPE_DEPOT; if (ti->tileh != 0) DrawFoundation(ti, ti->tileh); @@ -1316,7 +1316,7 @@ if (stat != NULL) { DrawTileSeqStruct const *seq; // emulate station tile - open with building - const DrawTileSprites *cust = &stat->renderdata[2 + (ti->map5 & 0x1)]; + const DrawTileSprites *cust = &stat->renderdata[2 + GetWaypointAxis(ti->tile)]; uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0); /* We don't touch the 0x8000 bit. In all this @@ -1346,7 +1346,7 @@ } } - drss = _track_depot_layout_table[type]; + drss = is_depot ? _track_depot_layout_table[GetRailDepotDirection(ti->tile)] : _track_waypoint_layout_table[GetWaypointAxis(ti->tile)]; image = drss++->image; /* @note This is kind of an ugly hack, as the PALETTE_MODIFIER_COLOR indicates @@ -1356,7 +1356,7 @@ // adjust ground tile for desert // (don't adjust for arctic depots, because snow in depots looks weird) // type >= 4 means waypoints - if (IsSnowRailGround(ti->tile) && (_opt.landscape == LT_DESERT || type >= 4)) { + if (IsSnowRailGround(ti->tile) && (_opt.landscape == LT_DESERT || !is_depot)) { if (image != SPR_FLAT_GRASS_TILE) { image += rti->snow_offset; // tile with tracks } else { @@ -1370,7 +1370,7 @@ for (; drss->image != 0; drss++) { DrawSpecialBuilding( - drss->image, type < 4 ? rti->total_offset : 0, ti, + drss->image, is_depot ? rti->total_offset : 0, ti, drss->subcoord_x, drss->subcoord_y, 0, drss->width, drss->height, 0x17 ); diff -r a4e4b90a54f7 -r 42e939a5e21a rail_map.h --- a/rail_map.h Wed Apr 12 12:33:21 2006 +0000 +++ b/rail_map.h Wed Apr 12 12:50:40 2006 +0000 @@ -144,6 +144,11 @@ CLRBIT(_m[t].m3, 4); } +static inline Axis GetWaypointAxis(TileIndex t) +{ + return HASBIT(_m[t].m5, 0) ? AXIS_Y : AXIS_X; +} + typedef enum SignalType { SIGTYPE_NORMAL = 0, // normal signal diff -r a4e4b90a54f7 -r 42e939a5e21a table/track_land.h --- a/table/track_land.h Wed Apr 12 12:33:21 2006 +0000 +++ b/table/track_land.h Wed Apr 12 12:50:40 2006 +0000 @@ -58,7 +58,9 @@ _track_depot_layout_table_1, _track_depot_layout_table_2, _track_depot_layout_table_3, +}; +static const DrawTrackSeqStruct* const _track_waypoint_layout_table[] = { _track_waypoint_table_0, _track_waypoint_table_1, };