diff options
-rw-r--r-- | src/lang/english.txt | 1 | ||||
-rw-r--r-- | src/misc_gui.cpp | 8 | ||||
-rw-r--r-- | src/rail_cmd.cpp | 7 | ||||
-rw-r--r-- | src/road_cmd.cpp | 4 | ||||
-rw-r--r-- | src/station_cmd.cpp | 3 | ||||
-rw-r--r-- | src/tile_cmd.h | 1 | ||||
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 12 |
7 files changed, 36 insertions, 0 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index 9cd6458d4..b87288228 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2131,6 +2131,7 @@ STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME :{BLACK}Airport 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} # Description of land area of different tiles STR_LAI_CLEAR_DESCRIPTION_ROCKS :Rocks diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index e6d9ad0c0..477c187ba 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -159,6 +159,7 @@ public: td.station_class = STR_NULL; td.station_name = STR_NULL; td.airport_tile_name = STR_NULL; + td.rail_speed = 0; td.grf = NULL; @@ -252,6 +253,13 @@ public: 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++; + } + /* NewGRF name */ if (td.grf != NULL) { SetDParamStr(0, td.grf); diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 7440f86ac..71a5f3dde 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2575,6 +2575,8 @@ static bool ClickTile_Track(TileIndex tile) static void GetTileDesc_Track(TileIndex tile, TileDesc *td) { + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile)); + td->rail_speed = rti->max_speed; td->owner[0] = GetTileOwner(tile); switch (GetRailTileType(tile)) { case RAIL_TILE_NORMAL: @@ -2648,6 +2650,11 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td) case RAIL_TILE_DEPOT: td->str = STR_LAI_RAIL_DESCRIPTION_TRAIN_DEPOT; + if (td->rail_speed > 0) { + td->rail_speed = min(td->rail_speed, 61); + } else { + td->rail_speed = 61; + } break; default: diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 5f985babc..f70808d67 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1531,6 +1531,10 @@ static void GetTileDesc_Road(TileIndex tile, TileDesc *td) rail_owner = GetTileOwner(tile); if (HasBit(rts, ROADTYPE_ROAD)) road_owner = GetRoadOwner(tile, ROADTYPE_ROAD); if (HasBit(rts, ROADTYPE_TRAM)) tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM); + + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile)); + td->rail_speed = rti->max_speed; + break; } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 956079d42..31c15aaed 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2800,6 +2800,9 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td) td->grf = gc->GetName(); } } + + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile)); + td->rail_speed = rti->max_speed; } if (IsAirport(tile)) { diff --git a/src/tile_cmd.h b/src/tile_cmd.h index 630da4e0f..a5ea8b9a7 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -60,6 +60,7 @@ struct TileDesc { 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 }; /** diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 5bf567eda..6c9f978d8 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1332,6 +1332,18 @@ static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td) 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; + } + } + } } |