@@ -2526,48 +2526,49 @@ STR_INDUSTRY_CARGOES_SELECT_INDUSTRY_TOO
# 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
@@ -36,49 +36,49 @@ enum OskActivation {
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])) {
@@ -138,48 +138,49 @@ public:
/* 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]));
@@ -253,48 +254,55 @@ public:
/* 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]));
/* 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]));
/* 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]));
/* 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]));
/* 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]));
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;
@@ -41,49 +41,50 @@ enum VehicleEnterTileStatus {
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);
@@ -1542,48 +1542,50 @@ static void GetTileDesc_TunnelBridge(Til
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);
Status change: