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
 
@@ -2502,96 +2502,97 @@ STR_FUND_INDUSTRY_CAPTION               
 
STR_FUND_INDUSTRY_SELECTION_TOOLTIP                             :{BLACK}Choose the appropriate industry from this list
 
STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES                        :Many random industries
 
STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES_TOOLTIP                :{BLACK}Cover the map with randomly placed industries
 
STR_FUND_INDUSTRY_INDUSTRY_BUILD_COST                           :{BLACK}Cost: {YELLOW}{CURRENCY_LONG}
 
STR_FUND_INDUSTRY_PROSPECT_NEW_INDUSTRY                         :{BLACK}Prospect
 
STR_FUND_INDUSTRY_BUILD_NEW_INDUSTRY                            :{BLACK}Build
 
STR_FUND_INDUSTRY_FUND_NEW_INDUSTRY                             :{BLACK}Fund
 

	
 
# Industry cargoes window
 
STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION                           :{WHITE}Industry chain for {STRING} industry
 
STR_INDUSTRY_CARGOES_CARGO_CAPTION                              :{WHITE}Industry chain for {STRING} cargo
 
STR_INDUSTRY_CARGOES_PRODUCERS                                  :{WHITE}Producing industries
 
STR_INDUSTRY_CARGOES_CUSTOMERS                                  :{WHITE}Accepting industries
 
STR_INDUSTRY_CARGOES_HOUSES                                     :{WHITE}Houses
 
STR_INDUSTRY_CARGOES_INDUSTRY_TOOLTIP                           :{BLACK}Click at the industry to see its suppliers and customers
 
STR_INDUSTRY_CARGOES_CARGO_TOOLTIP                              :{BLACK}{STRING}{}Click at the cargo to see its suppliers and customers
 
STR_INDUSTRY_DISPLAY_CHAIN                                      :{BLACK}Display chain
 
STR_INDUSTRY_DISPLAY_CHAIN_TOOLTIP                              :{BLACK}Display cargo supplying and accepting industries
 
STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP                            :{BLACK}Link to smallmap
 
STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP_TOOLTIP                    :{BLACK}Select the displayed industries at the smallmap as well
 
STR_INDUSTRY_CARGOES_SELECT_CARGO                               :{BLACK}Select cargo
 
STR_INDUSTRY_CARGOES_SELECT_CARGO_TOOLTIP                       :{BLACK}Select the cargo you want to display
 
STR_INDUSTRY_CARGOES_SELECT_INDUSTRY                            :{BLACK}Select industry
 
STR_INDUSTRY_CARGOES_SELECT_INDUSTRY_TOOLTIP                    :{BLACK}Select the industry you want to display
 

	
 
# Land area window
 
STR_LAND_AREA_INFORMATION_CAPTION                               :{WHITE}Land Area Information
 
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A                     :{BLACK}Cost to clear: {LTBLUE}N/A
 
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR                         :{BLACK}Cost to clear: {RED}{CURRENCY_LONG}
 
STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED                  :{BLACK}Revenue when cleared: {LTBLUE}{CURRENCY_LONG}
 
STR_LAND_AREA_INFORMATION_OWNER_N_A                             :N/A
 
STR_LAND_AREA_INFORMATION_OWNER                                 :{BLACK}Owner: {LTBLUE}{STRING1}
 
STR_LAND_AREA_INFORMATION_ROAD_OWNER                            :{BLACK}Road owner: {LTBLUE}{STRING1}
 
STR_LAND_AREA_INFORMATION_TRAM_OWNER                            :{BLACK}Tramway owner: {LTBLUE}{STRING1}
 
STR_LAND_AREA_INFORMATION_RAIL_OWNER                            :{BLACK}Railway owner: {LTBLUE}{STRING1}
 
STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY                       :{BLACK}Local authority: {LTBLUE}{STRING1}
 
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
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRESIGNALS                  :{STRING} track with pre-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXITSIGNALS                 :{STRING} track with exit-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBOSIGNALS                :{STRING} track with combo-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PBSSIGNALS                  :{STRING} track with path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NOENTRYSIGNALS              :{STRING} track with one-way path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PRESIGNALS           :{STRING} track with block and pre-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_EXITSIGNALS          :{STRING} track with block and exit-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_COMBOSIGNALS         :{STRING} track with block and combo-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PBSSIGNALS           :{STRING} track with block and path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_NOENTRYSIGNALS       :{STRING} track with block and one-way path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_EXITSIGNALS             :{STRING} track with pre- and exit-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_COMBOSIGNALS            :{STRING} track with pre- and combo-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_PBSSIGNALS              :{STRING} track with pre- and path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_NOENTRYSIGNALS          :{STRING} track with pre- and one-way path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_COMBOSIGNALS           :{STRING} track with exit- and combo-signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_PBSSIGNALS             :{STRING} track with exit- and path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_NOENTRYSIGNALS         :{STRING} track with exit- and one-way path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBO_PBSSIGNALS            :{STRING} track with combo- and path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBO_NOENTRYSIGNALS        :{STRING} track with combo- and one-way path signals
 
STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PBS_NOENTRYSIGNALS          :{STRING} track with path and one-way path signals
 
STR_LAI_RAIL_DESCRIPTION_TRAIN_DEPOT                            :{STRING} train depot
 

	
 
STR_LAI_ROAD_DESCRIPTION_ROAD                                   :Road
 
STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS                 :Road with street lights
 
STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD                        :Tree-lined road
 
STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT                     :Road vehicle depot
 
STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING               :Road/rail level crossing
 
STR_LAI_ROAD_DESCRIPTION_TRAMWAY                                :Tramway
 

	
 
# Houses come directly from their building names
 
STR_LAI_TOWN_INDUSTRY_DESCRIPTION_UNDER_CONSTRUCTION            :{STRING} (under construction)
 

	
 
STR_LAI_TREE_NAME_TREES                                         :Trees
 
STR_LAI_TREE_NAME_RAINFOREST                                    :Rainforest
 
STR_LAI_TREE_NAME_CACTUS_PLANTS                                 :Cactus plants
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -12,97 +12,97 @@
 
#include "stdafx.h"
 
#include "debug.h"
 
#include "landscape.h"
 
#include "error.h"
 
#include "gui.h"
 
#include "command_func.h"
 
#include "company_func.h"
 
#include "town.h"
 
#include "string_func.h"
 
#include "company_base.h"
 
#include "texteff.hpp"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "querystring_gui.h"
 
#include "core/geometry_func.hpp"
 
#include "newgrf_debug.h"
 

	
 
#include "widgets/misc_widget.h"
 

	
 
#include "table/strings.h"
 

	
 
/** Method to open the OSK. */
 
enum OskActivation {
 
	OSKA_DISABLED,           ///< The OSK shall not be activated at all.
 
	OSKA_DOUBLE_CLICK,       ///< Double click on the edit box opens OSK.
 
	OSKA_SINGLE_CLICK,       ///< Single click after focus click opens OSK.
 
	OSKA_IMMEDIATELY,        ///< Focusing click already opens OSK.
 
};
 

	
 

	
 
static const NWidgetPart _nested_land_info_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_DEBUGBOX, COLOUR_GREY),
 
	EndContainer(),
 
	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
 
	{
 
		if (widget != WID_LI_BACKGROUND) return;
 

	
 
		uint y = r.top + WD_TEXTPANEL_TOP;
 
		for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) {
 
			if (StrEmpty(this->landinfo_data[i])) break;
 

	
 
			DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING, SA_HOR_CENTER);
 
			y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
 
			if (i == 0) y += 4;
 
		}
 

	
 
		if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) {
 
			SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
 
			DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, r.bottom - WD_TEXTPANEL_BOTTOM, STR_JUST_RAW_STRING, TC_FROMSTRING, SA_CENTER);
 
		}
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget != WID_LI_BACKGROUND) return;
 

	
 
		size->height = WD_TEXTPANEL_TOP + WD_TEXTPANEL_BOTTOM;
 
		for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) {
 
			if (StrEmpty(this->landinfo_data[i])) break;
 

	
 
			uint width = GetStringBoundingBox(this->landinfo_data[i]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
 
			size->width = max(size->width, width);
 

	
 
			size->height += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
 
			if (i == 0) size->height += 4;
 
		}
 

	
 
		if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) {
 
			uint width = GetStringBoundingBox(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
 
			size->width = max(size->width, min(300u, width));
 
			SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
 
@@ -114,96 +114,97 @@ public:
 
	{
 
		this->InitNested();
 

	
 
#if defined(_DEBUG)
 
#	define LANDINFOD_LEVEL 0
 
#else
 
#	define LANDINFOD_LEVEL 1
 
#endif
 
		DEBUG(misc, LANDINFOD_LEVEL, "TILE: %#x (%i,%i)", tile, TileX(tile), TileY(tile));
 
		DEBUG(misc, LANDINFOD_LEVEL, "type_height  = %#x", _m[tile].type_height);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m1           = %#x", _m[tile].m1);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m2           = %#x", _m[tile].m2);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m3           = %#x", _m[tile].m3);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m4           = %#x", _m[tile].m4);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m5           = %#x", _m[tile].m5);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m6           = %#x", _m[tile].m6);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m7           = %#x", _me[tile].m7);
 
#undef LANDINFOD_LEVEL
 
	}
 

	
 
	virtual void OnInit()
 
	{
 
		Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 

	
 
		/* Because build_date is not set yet in every TileDesc, we make sure it is empty */
 
		TileDesc td;
 

	
 
		td.build_date = INVALID_DATE;
 

	
 
		/* Most tiles have only one owner, but
 
		 *  - drivethrough roadstops can be build on town owned roads (up to 2 owners) and
 
		 *  - roads can have up to four owners (railroad, road, tram, 3rd-roadtype "highway").
 
		 */
 
		td.owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER; // At least one owner is displayed, though it might be "N/A".
 
		td.owner_type[1] = STR_NULL;       // STR_NULL results in skipping the owner
 
		td.owner_type[2] = STR_NULL;
 
		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]));
 
		line_nr++;
 

	
 
		/* Up to four owners */
 
		for (uint i = 0; i < 4; i++) {
 
			if (td.owner_type[i] == STR_NULL) continue;
 

	
 
			SetDParam(0, STR_LAND_AREA_INFORMATION_OWNER_N_A);
 
			if (td.owner[i] != OWNER_NONE && td.owner[i] != OWNER_WATER) GetNameOfOwner(td.owner[i], tile);
 
			GetString(this->landinfo_data[line_nr], td.owner_type[i], lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Cost to clear/revenue when cleared */
 
		StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
 
		Company *c = Company::GetIfValid(_local_company);
 
		if (c != NULL) {
 
			Money old_money = c->money;
 
			c->money = INT64_MAX;
 
			assert(_current_company == _local_company);
 
			CommandCost costclear = DoCommand(tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR);
 
			c->money = old_money;
 
			if (costclear.Succeeded()) {
 
				Money cost = costclear.GetCost();
 
				if (cost < 0) {
 
					cost = -cost; // Negate negative cost to a positive revenue
 
					str = STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED;
 
				} else {
 
					str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR;
 
				}
 
				SetDParam(0, cost);
 
			}
 
		}
 
		GetString(this->landinfo_data[line_nr], str, lastof(this->landinfo_data[line_nr]));
 
		line_nr++;
 

	
 
		/* Location */
 
@@ -229,96 +230,103 @@ public:
 
		if (td.build_date != INVALID_DATE) {
 
			SetDParam(0, td.build_date);
 
			GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_BUILD_DATE, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Station class */
 
		if (td.station_class != STR_NULL) {
 
			SetDParam(0, td.station_class);
 
			GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_CLASS, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Station type name */
 
		if (td.station_name != STR_NULL) {
 
			SetDParam(0, td.station_name);
 
			GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_TYPE, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Airport class */
 
		if (td.airport_class != STR_NULL) {
 
			SetDParam(0, td.airport_class);
 
			GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_CLASS, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Airport name */
 
		if (td.airport_name != STR_NULL) {
 
			SetDParam(0, td.airport_name);
 
			GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_NAME, lastof(this->landinfo_data[line_nr]));
 
			line_nr++;
 
		}
 

	
 
		/* Airport tile name */
 
		if (td.airport_tile_name != STR_NULL) {
 
			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';
 

	
 
		/* Cargo acceptance is displayed in a extra multiline */
 
		char *strp = GetString(this->landinfo_data[LAND_INFO_MULTICENTER_LINE], STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
 
		bool found = false;
 

	
 
		for (CargoID i = 0; i < NUM_CARGO; ++i) {
 
			if (acceptance[i] > 0) {
 
				/* Add a comma between each item. */
 
				if (found) {
 
					*strp++ = ',';
 
					*strp++ = ' ';
 
				}
 
				found = true;
 

	
 
				/* If the accepted value is less than 8, show it in 1/8:ths */
 
				if (acceptance[i] < 8) {
 
					SetDParam(0, acceptance[i]);
 
					SetDParam(1, CargoSpec::Get(i)->name);
 
					strp = GetString(strp, STR_LAND_AREA_INFORMATION_CARGO_EIGHTS, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
 
				} else {
 
					strp = GetString(strp, CargoSpec::Get(i)->name, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
 
				}
 
			}
 
		}
 
		if (!found) this->landinfo_data[LAND_INFO_MULTICENTER_LINE][0] = '\0';
 
	}
 

	
 
	virtual bool IsNewGRFInspectable() const
 
	{
 
		return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), this->tile);
 
	}
 

	
 
	virtual void ShowNewGRFInspectWindow() const
 
	{
 
		::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile);
 
	}
 

	
src/tile_cmd.h
Show inline comments
 
@@ -17,97 +17,98 @@
 
#include "cargo_type.h"
 
#include "track_type.h"
 
#include "tile_map.h"
 

	
 
/** The returned bits of VehicleEnterTile. */
 
enum VehicleEnterTileStatus {
 
	VETS_ENTERED_STATION  = 1, ///< The vehicle entered a station
 
	VETS_ENTERED_WORMHOLE = 2, ///< The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/tunnel)
 
	VETS_CANNOT_ENTER     = 3, ///< The vehicle cannot enter the tile
 

	
 
	/**
 
	 * Shift the VehicleEnterTileStatus this many bits
 
	 * to the right to get the station ID when
 
	 * VETS_ENTERED_STATION is set
 
	 */
 
	VETS_STATION_ID_OFFSET = 8,
 
	VETS_STATION_MASK      = 0xFFFF << VETS_STATION_ID_OFFSET,
 

	
 
	/** Bit sets of the above specified bits */
 
	VETSB_CONTINUE         = 0,                          ///< The vehicle can continue normally
 
	VETSB_ENTERED_STATION  = 1 << VETS_ENTERED_STATION,  ///< The vehicle entered a station
 
	VETSB_ENTERED_WORMHOLE = 1 << VETS_ENTERED_WORMHOLE, ///< The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/tunnel)
 
	VETSB_CANNOT_ENTER     = 1 << VETS_CANNOT_ENTER,     ///< The vehicle cannot enter the tile
 
};
 
DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus)
 

	
 
/** Tile information, used while rendering the tile */
 
struct TileInfo {
 
	uint x;         ///< X position of the tile in unit coordinates
 
	uint y;         ///< Y position of the tile in unit coordinates
 
	Slope tileh;    ///< Slope of the tile
 
	TileIndex tile; ///< Tile index
 
	int z;          ///< Height
 
};
 

	
 
/** Tile description for the 'land area information' tool */
 
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
 
 * @param tile            Tile queried for its accepted cargo
 
 * @param acceptance      Storage destination of the cargo acceptance in 1/8
 
 * @param always_accepted Bitmask of always accepted cargo types
 
 */
 
typedef void AddAcceptedCargoProc(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted);
 

	
 
/**
 
 * Tile callback function signature for obtaining a tile description
 
 * @param tile Tile being queried
 
 * @param td   Storage pointer for returned tile description
 
 */
 
typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
 

	
 
/**
 
 * Tile callback function signature for getting the possible tracks
 
 * that can be taken on a given tile by a given transport.
 
 *
 
 * The return value contains the existing trackdirs and signal states.
 
 *
 
 * see track_func.h for usage of TrackStatus.
 
 *
 
 * @param tile     the tile to get the track status from
 
 * @param mode     the mode of transportation
 
 * @param sub_mode used to differentiate between different kinds within the mode
 
 * @return the track status information
 
 */
 
typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
 

	
 
/**
 
 * Tile callback function signature for obtaining the produced cargo of a tile.
 
 * @param tile      Tile being queried
 
 * @param produced  Destination array for produced cargo
 
 */
 
typedef void AddProducedCargoProc(TileIndex tile, CargoArray &produced);
 
typedef bool ClickTileProc(TileIndex tile);
 
typedef void AnimateTileProc(TileIndex tile);
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -1518,96 +1518,98 @@ static int GetSlopePixelZ_TunnelBridge(T
 

	
 
static Foundation GetFoundation_TunnelBridge(TileIndex tile, Slope tileh)
 
{
 
	return IsTunnel(tile) ? FOUNDATION_NONE : GetBridgeFoundation(tileh, DiagDirToAxis(GetTunnelBridgeDirection(tile)));
 
}
 

	
 
static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td)
 
{
 
	TransportType tt = GetTunnelBridgeTransportType(tile);
 

	
 
	if (IsTunnel(tile)) {
 
		td->str = (tt == TRANSPORT_RAIL) ? STR_LAI_TUNNEL_DESCRIPTION_RAILROAD : STR_LAI_TUNNEL_DESCRIPTION_ROAD;
 
	} else { // IsBridge(tile)
 
		td->str = (tt == TRANSPORT_WATER) ? STR_LAI_BRIDGE_DESCRIPTION_AQUEDUCT : GetBridgeSpec(GetBridgeType(tile))->transport_name[tt];
 
	}
 
	td->owner[0] = GetTileOwner(tile);
 

	
 
	Owner road_owner = INVALID_OWNER;
 
	Owner tram_owner = INVALID_OWNER;
 
	RoadTypes rts = GetRoadTypes(tile);
 
	if (HasBit(rts, ROADTYPE_ROAD)) road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
 
	if (HasBit(rts, ROADTYPE_TRAM)) tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
 

	
 
	/* Is there a mix of owners? */
 
	if ((tram_owner != INVALID_OWNER && tram_owner != td->owner[0]) ||
 
			(road_owner != INVALID_OWNER && road_owner != td->owner[0])) {
 
		uint i = 1;
 
		if (road_owner != INVALID_OWNER) {
 
			td->owner_type[i] = STR_LAND_AREA_INFORMATION_ROAD_OWNER;
 
			td->owner[i] = road_owner;
 
			i++;
 
		}
 
		if (tram_owner != INVALID_OWNER) {
 
			td->owner_type[i] = STR_LAND_AREA_INFORMATION_TRAM_OWNER;
 
			td->owner[i] = tram_owner;
 
		}
 
	}
 

	
 
	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) */
 
			int z = IsBridge(tile) ? GetTileMaxZ(tile) : GetTileZ(tile);
 
			if (snow_or_desert != (z > GetSnowLine())) {
 
				SetTunnelBridgeSnowOrDesert(tile, !snow_or_desert);
 
				MarkTileDirtyByTile(tile);
 
			}
 
			break;
 
		}
 

	
 
		case LT_TROPIC:
 
			if (GetTropicZone(tile) == TROPICZONE_DESERT && !snow_or_desert) {
 
				SetTunnelBridgeSnowOrDesert(tile, true);
 
				MarkTileDirtyByTile(tile);
 
			}
 
			break;
 

	
 
		default:
 
			break;
 
	}
 
}
 

	
 
static TrackStatus GetTileTrackStatus_TunnelBridge(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
 
{
 
	TransportType transport_type = GetTunnelBridgeTransportType(tile);
 
	if (transport_type != mode || (transport_type == TRANSPORT_ROAD && (GetRoadTypes(tile) & sub_mode) == 0)) return 0;
 

	
 
	DiagDirection dir = GetTunnelBridgeDirection(tile);
 
	if (side != INVALID_DIAGDIR && side != ReverseDiagDir(dir)) return 0;
 
	return CombineTrackStatus(TrackBitsToTrackdirBits(DiagDirToDiagTrackBits(dir)), TRACKDIR_BIT_NONE);
 
}
 

	
 
static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner new_owner)
 
{
 
	TileIndex other_end = GetOtherTunnelBridgeEnd(tile);
 
	/* Set number of pieces to zero if it's the southern tile as we
 
	 * don't want to update the infrastructure counts twice. */
 
	uint num_pieces = tile < other_end ? (GetTunnelBridgeLength(tile, other_end) + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR : 0;
0 comments (0 inline, 0 general)