diff options
-rw-r--r-- | src/industry_cmd.cpp | 7 | ||||
-rw-r--r-- | src/lang/english.txt | 4 | ||||
-rw-r--r-- | src/misc_gui.cpp | 30 | ||||
-rw-r--r-- | src/newgrf_station.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_station.h | 1 | ||||
-rw-r--r-- | src/station_cmd.cpp | 13 | ||||
-rw-r--r-- | src/tile_cmd.h | 3 | ||||
-rw-r--r-- | src/town_cmd.cpp | 9 |
8 files changed, 65 insertions, 4 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 67b2790e6..88d85486e 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -389,13 +389,18 @@ static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) static void GetTileDesc_Industry(TileIndex tile, TileDesc *td) { const Industry *i = GetIndustryByTile(tile); + const IndustrySpec *is = GetIndustrySpec(i->type); td->owner[0] = i->owner; - td->str = GetIndustrySpec(i->type)->name; + td->str = is->name; if (!IsIndustryCompleted(tile)) { SetDParamX(td->dparam, 0, td->str); td->str = STR_2058_UNDER_CONSTRUCTION; } + + if (is->grf_prop.grffile != NULL) { + td->grf = GetGRFConfig(is->grf_prop.grffile->grfid)->name; + } } static CommandCost ClearTile_Industry(TileIndex tile, byte flags) diff --git a/src/lang/english.txt b/src/lang/english.txt index c3b57570b..3b0b9dd97 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3126,6 +3126,10 @@ STR_BRIBE_FAILED :{WHITE}Your att STR_BRIBE_FAILED_2 :{WHITE}discovered by a regional investigator STR_BUILD_DATE :{BLACK}Built: {LTBLUE}{DATE_LONG} +STR_TILEDESC_STATION_CLASS :{BLACK}Station class: {LTBLUE}{STRING} +STR_TILEDESC_STATION_TYPE :{BLACK}Station type: {LTBLUE}{STRING} +STR_TILEDESC_NEWGRF_NAME :{BLACK}NewGRF: {LTBLUE}{RAW_STRING} + STR_PERFORMANCE_DETAIL :{WHITE}Detailed performance rating STR_PERFORMANCE_DETAIL_KEY :{BLACK}Detail STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY :{BLACK}({CURRCOMPACT}/{CURRCOMPACT}) diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 69f2d10b0..00ccd5c2b 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -73,7 +73,7 @@ static const WindowDesc _land_info_desc = { class LandInfoWindow : public Window { enum { - LAND_INFO_CENTERED_LINES = 9, ///< Up to 9 centered lines + LAND_INFO_CENTERED_LINES = 12, ///< Up to 12 centered lines LAND_INFO_MULTICENTER_LINE = LAND_INFO_CENTERED_LINES, ///< One multicenter line LAND_INFO_LINE_END, @@ -131,6 +131,11 @@ public: td.owner[2] = OWNER_NONE; td.owner[3] = OWNER_NONE; + td.station_class = STR_NULL; + td.station_name = STR_NULL; + + td.grf = NULL; + GetAcceptedCargo(tile, ac); GetTileDesc(tile, &td); @@ -186,6 +191,29 @@ public: line_nr++; } + /* Station class */ + if (td.station_class != STR_NULL) { + SetDParam(0, td.station_class); + GetString(this->landinfo_data[line_nr], STR_TILEDESC_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_TILEDESC_STATION_TYPE, 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_TILEDESC_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'; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 6a978ac63..52a8c344a 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -835,7 +835,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID } -static const StationSpec* GetStationSpec(TileIndex t) +const StationSpec *GetStationSpec(TileIndex t) { const Station* st; uint specindex; diff --git a/src/newgrf_station.h b/src/newgrf_station.h index 124e71b56..5d42cde72 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -110,6 +110,7 @@ void ResetStationClasses(); StationClassID AllocateStationClass(uint32 cls); void SetStationClassName(StationClassID sclass, StringID name); StringID GetStationClassName(StationClassID sclass); +const StationSpec *GetStationSpec(TileIndex t); uint GetNumStationClasses(); uint GetNumCustomStations(StationClassID sclass); diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index a14c7e35a..0fc0a14df 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -43,6 +43,7 @@ #include "oldpool_func.h" #include "animated_tile_func.h" #include "elrail_func.h" +#include "newgrf.h" #include "table/sprites.h" #include "table/strings.h" @@ -2312,6 +2313,18 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td) } td->build_date = GetStationByTile(tile)->build_date; + const StationSpec *spec = GetStationSpec(tile); + + if (spec != NULL) { + td->station_class = GetStationClassName(spec->sclass); + td->station_name = spec->name; + + if (spec->grffile != NULL) { + const GRFConfig *gc = GetGRFConfig(spec->grffile->grfid); + td->grf = gc->name; + } + } + StringID str; switch (GetStationType(tile)) { default: NOT_REACHED(); diff --git a/src/tile_cmd.h b/src/tile_cmd.h index e25f210cc..ad3935b02 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -52,6 +52,9 @@ struct TileDesc { Owner owner[4]; StringID owner_type[4]; Date build_date; + StringID station_class; + StringID station_name; + const char *grf; uint64 dparam[2]; }; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 00236df3c..4d5917562 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -616,12 +616,19 @@ static void GetAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac) static void GetTileDesc_Town(TileIndex tile, TileDesc *td) { - td->str = GetHouseSpecs(GetHouseType(tile))->building_name; + const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile)); + + td->str = hs->building_name; if (!IsHouseCompleted(tile)) { SetDParamX(td->dparam, 0, td->str); td->str = STR_2058_UNDER_CONSTRUCTION; } + if (hs->grffile != NULL) { + const GRFConfig *gc = GetGRFConfig(hs->grffile->grfid); + td->grf = gc->name; + } + td->owner[0] = OWNER_TOWN; } |