Changeset - r9785:165707b7be50
[Not reviewed]
master
0 8 0
rubidium - 16 years ago 2008-08-02 22:47:34
rubidium@openttd.org
(svn r13927) -Add [YAPP]: Draw reserved tracks darker, toggeld by a patch setting. (michi_cc)
8 files changed with 65 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1136,6 +1136,7 @@ STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MAG
 
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_FIRST                      :First available
 
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_LAST                       :Last available
 
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MOST_USED                  :Most used
 
STR_CONFIG_PATCHES_SHOW_TRACK_RESERVATION                       :{LTBLUE}Show reserved tracks: {ORANGE}{STRING1}
 

	
 
STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE                  :{LTBLUE}Show building tools when no suitable vehicles are available: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_MAX_TRAINS                                   :{LTBLUE}Max trains per player: {ORANGE}{STRING1}
src/rail_cmd.cpp
Show inline comments
 
@@ -1688,6 +1688,29 @@ static void DrawTrackBits(TileInfo* ti, 
 
		if (track & TRACK_BIT_RIGHT) DrawGroundSprite(rti->base_sprites.single_e, PAL_NONE);
 
	}
 

	
 
	/* PBS debugging, draw reserved tracks darker */
 
	if (_settings_client.gui.show_track_reservation) {
 
		TrackBits pbs = GetTrackReservation(ti->tile);
 
		if (pbs & TRACK_BIT_X) {
 
			if (ti->tileh == SLOPE_FLAT || ti->tileh == SLOPE_ELEVATED) {
 
				DrawGroundSprite(rti->base_sprites.single_y, PALETTE_CRASH);
 
			} else {
 
				DrawGroundSprite(_track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.single_sloped - 20, PALETTE_CRASH);
 
			}
 
		}
 
		if (pbs & TRACK_BIT_Y) {
 
			if (ti->tileh == SLOPE_FLAT || ti->tileh == SLOPE_ELEVATED) {
 
				DrawGroundSprite(rti->base_sprites.single_x, PALETTE_CRASH);
 
			} else {
 
				DrawGroundSprite(_track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.single_sloped - 20, PALETTE_CRASH);
 
			}
 
		}
 
		if (pbs & TRACK_BIT_UPPER) AddSortableSpriteToDraw(rti->base_sprites.single_n, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + (ti->tileh & SLOPE_N ? 8 : 0));
 
		if (pbs & TRACK_BIT_LOWER) AddSortableSpriteToDraw(rti->base_sprites.single_s, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + (ti->tileh & SLOPE_S ? 8 : 0));
 
		if (pbs & TRACK_BIT_LEFT)  AddSortableSpriteToDraw(rti->base_sprites.single_w, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + (ti->tileh & SLOPE_W ? 8 : 0));
 
		if (pbs & TRACK_BIT_RIGHT) AddSortableSpriteToDraw(rti->base_sprites.single_e, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + (ti->tileh & SLOPE_E ? 8 : 0));
 
	}
 

	
 
	if (IsValidCorner(halftile_corner)) {
 
		DrawFoundation(ti, HalftileFoundation(halftile_corner));
 

	
 
@@ -1702,6 +1725,11 @@ static void DrawTrackBits(TileInfo* ti, 
 
			default: break;
 
		}
 
		DrawGroundSprite(image, pal, &(_halftile_sub_sprite[halftile_corner]));
 

	
 
		if (_settings_client.gui.show_track_reservation && IsSteepSlope(ti->tileh) && HasReservedTracks(ti->tile, CornerToTrackBits(halftile_corner))) {
 
			static const byte _corner_to_track_sprite[] = {3, 1, 2, 0};
 
			AddSortableSpriteToDraw(_corner_to_track_sprite[halftile_corner] + rti->base_sprites.single_n, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + 16);
 
		}
 
	}
 
}
 

	
 
@@ -1846,6 +1874,11 @@ default_waypoint:
 

	
 
		DrawGroundSprite(image, PAL_NONE);
 

	
 
		/* PBS debugging, draw reserved tracks darker */
 
		if (_settings_client.gui.show_track_reservation && GetDepotWaypointReservation(ti->tile)) {
 
			DrawGroundSprite(GetWaypointAxis(ti->tile) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH);
 
		}
 

	
 
		if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 

	
 
		foreach_draw_tile_seq(dtss, dts->seq) {
src/road_cmd.cpp
Show inline comments
 
@@ -1176,6 +1176,12 @@ static void DrawTile_Road(TileInfo *ti)
 
			}
 

	
 
			DrawGroundSprite(image, pal);
 

	
 
			/* PBS debugging, draw reserved tracks darker */
 
			if (_settings_client.gui.show_track_reservation && GetCrossingReservation(ti->tile)) {
 
				DrawGroundSprite(GetCrossingRoadAxis(ti->tile) == AXIS_Y ? GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_y : GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_x, PALETTE_CRASH);
 
			}
 

	
 
			if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
 
				DrawGroundSprite(SPR_TRAMWAY_OVERLAY + (GetCrossingRoadAxis(ti->tile) ^ 1), pal);
 
				DrawTramCatenary(ti, GetCrossingRoadBits(ti->tile));
src/settings.cpp
Show inline comments
 
@@ -1789,6 +1789,7 @@ const SettingDesc _patch_settings[] = {
 
	 SDTC_BOOL(gui.bridge_pillars,                       S,  0,  true,                        STR_NULL,                                       NULL),
 
	 SDTC_BOOL(gui.auto_euro,                            S,  0,  true,                        STR_NULL,                                       NULL),
 
	  SDTC_VAR(gui.news_message_timeout,      SLE_UINT8, S,  0,     2,        1,      255, 0, STR_NULL,                                       NULL),
 
	 SDTC_BOOL(gui.show_track_reservation,               S,  0, false,                        STR_CONFIG_PATCHES_SHOW_TRACK_RESERVATION,      RedrawScreen),
 

	
 
#ifdef ENABLE_NETWORK
 
	  SDTC_VAR(network.sync_freq,            SLE_UINT16,C|S,NO,   100,        0,      100, 0, STR_NULL,                                       NULL),
src/settings_gui.cpp
Show inline comments
 
@@ -613,6 +613,7 @@ static const char *_patches_ui[] = {
 
	"gui.timetable_in_ticks",
 
	"gui.default_rail_type",
 
	"gui.always_build_infrastructure",
 
	"gui.show_track_reservation",
 
};
 

	
 
static const char *_patches_construction[] = {
src/settings_type.h
Show inline comments
 
@@ -79,6 +79,7 @@ struct GUISettings {
 
	int16  autorenew_months;                 ///< how many months from EOL of vehicles should autorenew trigger for new companies?
 
	int32  autorenew_money;                  ///< how much money before autorenewing for new companies?
 
	byte   news_message_timeout;             ///< how much longer than the news message "age" should we keep the message in the history
 
	bool   show_track_reservation;           ///< highlight reserved tracks.
 
};
 

	
 
/** Settings related to currency/unit systems. */
src/station_cmd.cpp
Show inline comments
 
@@ -2215,6 +2215,12 @@ static void DrawTile_Station(TileInfo *t
 
			image += total_offset;
 
		}
 
		DrawGroundSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE);
 

	
 
		/* PBS debugging, draw reserved tracks darker */
 
		if (_settings_client.gui.show_track_reservation && IsRailwayStation(ti->tile) && GetRailwayStationReservation(ti->tile)) {
 
			const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
 
			DrawGroundSprite(GetRailStationAxis(ti->tile) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH);
 
		}
 
	}
 

	
 
	if (IsRailwayStation(ti->tile) && HasCatenaryDrawn(GetRailType(ti->tile)) && IsStationTileElectrifiable(ti->tile)) DrawCatenary(ti);
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -887,6 +887,13 @@ static void DrawTile_TunnelBridge(TileIn
 

	
 
		image += tunnelbridge_direction * 2;
 
		DrawGroundSprite(image, PAL_NONE);
 

	
 
		/* PBS debugging, draw reserved tracks darker */
 
		if (_settings_client.gui.show_track_reservation && (transport_type == TRANSPORT_RAIL && GetTunnelBridgeReservation(ti->tile))) {
 
			const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
 
			DrawGroundSprite(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH);
 
		}
 

	
 
		if (transport_type == TRANSPORT_ROAD) {
 
			RoadTypes rts = GetRoadTypes(ti->tile);
 

	
 
@@ -963,6 +970,15 @@ static void DrawTile_TunnelBridge(TileIn
 
		/* Bridge heads are drawn solid no matter how invisibility/transparency is set */
 
		AddSortableSpriteToDraw(psid->sprite, psid->pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z);
 

	
 
		if (_settings_client.gui.show_track_reservation && transport_type == TRANSPORT_RAIL && GetTunnelBridgeReservation(ti->tile)) {
 
			const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
 
			if (HasBridgeFlatRamp(ti->tileh, DiagDirToAxis(tunnelbridge_direction))) {
 
				AddSortableSpriteToDraw(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + 8);
 
			} else {
 
				AddSortableSpriteToDraw(rti->base_sprites.single_sloped + tunnelbridge_direction, PALETTE_CRASH, ti->x, ti->y, 16, 16, 8, ti->z);
 
			}
 
		}
 

	
 
		if (transport_type == TRANSPORT_ROAD) {
 
			RoadTypes rts = GetRoadTypes(ti->tile);
 

	
0 comments (0 inline, 0 general)