Changeset - r21190:7bb64f2faa42
[Not reviewed]
master
0 4 0
frosch - 10 years ago 2014-01-26 13:50:10
frosch@openttd.org
(svn r26277) -Add [FS#5849]: Display speed limit also for road bridges in the TileInfo window.
4 files changed with 14 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -2538,24 +2538,25 @@ STR_LAND_AREA_INFORMATION_LOCAL_AUTHORIT
 
STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE                  :None
 
STR_LAND_AREA_INFORMATION_LANDINFO_COORDS                       :{BLACK}Coordinates: {LTBLUE}{NUM} x {NUM} x {NUM} ({RAW_STRING})
 
STR_LAND_AREA_INFORMATION_BUILD_DATE                            :{BLACK}Built: {LTBLUE}{DATE_LONG}
 
STR_LAND_AREA_INFORMATION_STATION_CLASS                         :{BLACK}Station class: {LTBLUE}{STRING}
 
STR_LAND_AREA_INFORMATION_STATION_TYPE                          :{BLACK}Station type: {LTBLUE}{STRING}
 
STR_LAND_AREA_INFORMATION_AIRPORT_CLASS                         :{BLACK}Airport class: {LTBLUE}{STRING}
 
STR_LAND_AREA_INFORMATION_AIRPORT_NAME                          :{BLACK}Airport name: {LTBLUE}{STRING}
 
STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME                      :{BLACK}Airport tile name: {LTBLUE}{STRING}
 
STR_LAND_AREA_INFORMATION_NEWGRF_NAME                           :{BLACK}NewGRF: {LTBLUE}{RAW_STRING}
 
STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED                        :{BLACK}Cargo accepted: {LTBLUE}
 
STR_LAND_AREA_INFORMATION_CARGO_EIGHTS                          :({COMMA}/8 {STRING})
 
STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT                      :{BLACK}Rail speed limit: {LTBLUE}{VELOCITY}
 
STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT                      :{BLACK}Road speed limit: {LTBLUE}{VELOCITY}
 

	
 
# Description of land area of different tiles
 
STR_LAI_CLEAR_DESCRIPTION_ROCKS                                 :Rocks
 
STR_LAI_CLEAR_DESCRIPTION_ROUGH_LAND                            :Rough land
 
STR_LAI_CLEAR_DESCRIPTION_BARE_LAND                             :Bare land
 
STR_LAI_CLEAR_DESCRIPTION_GRASS                                 :Grass
 
STR_LAI_CLEAR_DESCRIPTION_FIELDS                                :Fields
 
STR_LAI_CLEAR_DESCRIPTION_SNOW_COVERED_LAND                     :Snow-covered land
 
STR_LAI_CLEAR_DESCRIPTION_DESERT                                :Desert
 

	
 
STR_LAI_RAIL_DESCRIPTION_TRACK                                  :{STRING} track
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_SIGNALS              :{STRING} track with block signals
src/misc_gui.cpp
Show inline comments
 
@@ -48,25 +48,25 @@ static const NWidgetPart _nested_land_in
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_LI_BACKGROUND), EndContainer(),
 
};
 

	
 
static WindowDesc _land_info_desc(
 
	WDP_AUTO, "land_info", 0, 0,
 
	WC_LAND_INFO, WC_NONE,
 
	0,
 
	_nested_land_info_widgets, lengthof(_nested_land_info_widgets)
 
);
 

	
 
class LandInfoWindow : public Window {
 
	enum LandInfoLines {
 
		LAND_INFO_CENTERED_LINES   = 12,                       ///< Up to 12 centered lines
 
		LAND_INFO_CENTERED_LINES   = 32,                       ///< Up to 32 centered lines (arbitrary limit)
 
		LAND_INFO_MULTICENTER_LINE = LAND_INFO_CENTERED_LINES, ///< One multicenter line
 
		LAND_INFO_LINE_END,
 
	};
 

	
 
	static const uint LAND_INFO_LINE_BUFF_SIZE = 512;
 

	
 
public:
 
	char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE];
 
	TileIndex tile;
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
@@ -150,24 +150,25 @@ public:
 
		td.owner_type[3] = STR_NULL;
 
		td.owner[0] = OWNER_NONE;
 
		td.owner[1] = OWNER_NONE;
 
		td.owner[2] = OWNER_NONE;
 
		td.owner[3] = OWNER_NONE;
 

	
 
		td.station_class = STR_NULL;
 
		td.station_name = STR_NULL;
 
		td.airport_class = STR_NULL;
 
		td.airport_name = STR_NULL;
 
		td.airport_tile_name = STR_NULL;
 
		td.rail_speed = 0;
 
		td.road_speed = 0;
 

	
 
		td.grf = NULL;
 

	
 
		CargoArray acceptance;
 
		AddAcceptedCargo(tile, acceptance, NULL);
 
		GetTileDesc(tile, &td);
 

	
 
		uint line_nr = 0;
 

	
 
		/* Tiletype */
 
		SetDParam(0, td.dparam[0]);
 
		GetString(this->landinfo_data[line_nr], td.str, lastof(this->landinfo_data[line_nr]));
 
@@ -265,24 +266,31 @@ public:
 
			SetDParam(0, td.airport_tile_name);
 
			GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Rail speed limit */
 
		if (td.rail_speed != 0) {
 
			SetDParam(0, td.rail_speed);
 
			GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Road speed limit */
 
		if (td.road_speed != 0) {
 
			SetDParam(0, td.road_speed);
 
			GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* NewGRF name */
 
		if (td.grf != NULL) {
 
			SetDParamStr(0, td.grf);
 
			GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_NEWGRF_NAME, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		assert(line_nr < LAND_INFO_CENTERED_LINES);
 

	
 
		/* Mark last line empty */
 
		this->landinfo_data[line_nr][0] = '\0';
 

	
src/tile_cmd.h
Show inline comments
 
@@ -53,25 +53,26 @@ struct TileInfo {
 
struct TileDesc {
 
	StringID str;               ///< Description of the tile
 
	Owner owner[4];             ///< Name of the owner(s)
 
	StringID owner_type[4];     ///< Type of each owner
 
	Date build_date;            ///< Date of construction of tile contents
 
	StringID station_class;     ///< Class of station
 
	StringID station_name;      ///< Type of station within the class
 
	StringID airport_class;     ///< Name of the airport class
 
	StringID airport_name;      ///< Name of the airport
 
	StringID airport_tile_name; ///< Name of the airport tile
 
	const char *grf;            ///< newGRF used for the tile contents
 
	uint64 dparam[2];           ///< Parameters of the \a str string
 
	uint16 rail_speed;          ///< Speed limit of rail
 
	uint16 rail_speed;          ///< Speed limit of rail (bridges and track)
 
	uint16 road_speed;          ///< Speed limit of road (bridges)
 
};
 

	
 
/**
 
 * Tile callback function signature for drawing a tile and its contents to the screen
 
 * @param ti Information about the tile to draw
 
 */
 
typedef void DrawTileProc(TileInfo *ti);
 
typedef int GetSlopeZProc(TileIndex tile, uint x, uint y);
 
typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags);
 

	
 
/**
 
 * Tile callback function signature for obtaining cargo acceptance of a tile
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -1554,24 +1554,26 @@ static void GetTileDesc_TunnelBridge(Til
 
	}
 

	
 
	if (tt == TRANSPORT_RAIL) {
 
		const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
 
		td->rail_speed = rti->max_speed;
 

	
 
		if (!IsTunnel(tile)) {
 
			uint16 spd = GetBridgeSpec(GetBridgeType(tile))->speed;
 
			if (td->rail_speed == 0 || spd < td->rail_speed) {
 
				td->rail_speed = spd;
 
			}
 
		}
 
	} else if (tt == TRANSPORT_ROAD && !IsTunnel(tile)) {
 
		td->road_speed = GetBridgeSpec(GetBridgeType(tile))->speed;
 
	}
 
}
 

	
 

	
 
static void TileLoop_TunnelBridge(TileIndex tile)
 
{
 
	bool snow_or_desert = HasTunnelBridgeSnowOrDesert(tile);
 
	switch (_settings_game.game_creation.landscape) {
 
		case LT_ARCTIC: {
 
			/* As long as we do not have a snow density, we want to use the density
 
			 * from the entry edge. For tunnels this is the lowest point for bridges the highest point.
 
			 * (Independent of foundations) */
0 comments (0 inline, 0 general)