mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r13830) -Feature: show additional NewGRF info in the Tile Info window for stations, houses and industries
This commit is contained in:
parent
ce7585101d
commit
05c2a8eba4
@ -389,13 +389,18 @@ static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
|
|||||||
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
||||||
{
|
{
|
||||||
const Industry *i = GetIndustryByTile(tile);
|
const Industry *i = GetIndustryByTile(tile);
|
||||||
|
const IndustrySpec *is = GetIndustrySpec(i->type);
|
||||||
|
|
||||||
td->owner[0] = i->owner;
|
td->owner[0] = i->owner;
|
||||||
td->str = GetIndustrySpec(i->type)->name;
|
td->str = is->name;
|
||||||
if (!IsIndustryCompleted(tile)) {
|
if (!IsIndustryCompleted(tile)) {
|
||||||
SetDParamX(td->dparam, 0, td->str);
|
SetDParamX(td->dparam, 0, td->str);
|
||||||
td->str = STR_2058_UNDER_CONSTRUCTION;
|
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)
|
static CommandCost ClearTile_Industry(TileIndex tile, byte flags)
|
||||||
|
@ -3126,6 +3126,10 @@ STR_BRIBE_FAILED :{WHITE}Your att
|
|||||||
STR_BRIBE_FAILED_2 :{WHITE}discovered by a regional investigator
|
STR_BRIBE_FAILED_2 :{WHITE}discovered by a regional investigator
|
||||||
STR_BUILD_DATE :{BLACK}Built: {LTBLUE}{DATE_LONG}
|
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 :{WHITE}Detailed performance rating
|
||||||
STR_PERFORMANCE_DETAIL_KEY :{BLACK}Detail
|
STR_PERFORMANCE_DETAIL_KEY :{BLACK}Detail
|
||||||
STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY :{BLACK}({CURRCOMPACT}/{CURRCOMPACT})
|
STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY :{BLACK}({CURRCOMPACT}/{CURRCOMPACT})
|
||||||
|
@ -73,7 +73,7 @@ static const WindowDesc _land_info_desc = {
|
|||||||
|
|
||||||
class LandInfoWindow : public Window {
|
class LandInfoWindow : public Window {
|
||||||
enum {
|
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_MULTICENTER_LINE = LAND_INFO_CENTERED_LINES, ///< One multicenter line
|
||||||
LAND_INFO_LINE_END,
|
LAND_INFO_LINE_END,
|
||||||
|
|
||||||
@ -131,6 +131,11 @@ public:
|
|||||||
td.owner[2] = OWNER_NONE;
|
td.owner[2] = OWNER_NONE;
|
||||||
td.owner[3] = OWNER_NONE;
|
td.owner[3] = OWNER_NONE;
|
||||||
|
|
||||||
|
td.station_class = STR_NULL;
|
||||||
|
td.station_name = STR_NULL;
|
||||||
|
|
||||||
|
td.grf = NULL;
|
||||||
|
|
||||||
GetAcceptedCargo(tile, ac);
|
GetAcceptedCargo(tile, ac);
|
||||||
GetTileDesc(tile, &td);
|
GetTileDesc(tile, &td);
|
||||||
|
|
||||||
@ -186,6 +191,29 @@ public:
|
|||||||
line_nr++;
|
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 */
|
/* Mark last line empty */
|
||||||
this->landinfo_data[line_nr][0] = '\0';
|
this->landinfo_data[line_nr][0] = '\0';
|
||||||
|
|
||||||
|
@ -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;
|
const Station* st;
|
||||||
uint specindex;
|
uint specindex;
|
||||||
|
@ -110,6 +110,7 @@ void ResetStationClasses();
|
|||||||
StationClassID AllocateStationClass(uint32 cls);
|
StationClassID AllocateStationClass(uint32 cls);
|
||||||
void SetStationClassName(StationClassID sclass, StringID name);
|
void SetStationClassName(StationClassID sclass, StringID name);
|
||||||
StringID GetStationClassName(StationClassID sclass);
|
StringID GetStationClassName(StationClassID sclass);
|
||||||
|
const StationSpec *GetStationSpec(TileIndex t);
|
||||||
|
|
||||||
uint GetNumStationClasses();
|
uint GetNumStationClasses();
|
||||||
uint GetNumCustomStations(StationClassID sclass);
|
uint GetNumCustomStations(StationClassID sclass);
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "oldpool_func.h"
|
#include "oldpool_func.h"
|
||||||
#include "animated_tile_func.h"
|
#include "animated_tile_func.h"
|
||||||
#include "elrail_func.h"
|
#include "elrail_func.h"
|
||||||
|
#include "newgrf.h"
|
||||||
|
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
@ -2312,6 +2313,18 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
|
|||||||
}
|
}
|
||||||
td->build_date = GetStationByTile(tile)->build_date;
|
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;
|
StringID str;
|
||||||
switch (GetStationType(tile)) {
|
switch (GetStationType(tile)) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
@ -52,6 +52,9 @@ struct TileDesc {
|
|||||||
Owner owner[4];
|
Owner owner[4];
|
||||||
StringID owner_type[4];
|
StringID owner_type[4];
|
||||||
Date build_date;
|
Date build_date;
|
||||||
|
StringID station_class;
|
||||||
|
StringID station_name;
|
||||||
|
const char *grf;
|
||||||
uint64 dparam[2];
|
uint64 dparam[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -616,12 +616,19 @@ static void GetAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac)
|
|||||||
|
|
||||||
static void GetTileDesc_Town(TileIndex tile, TileDesc *td)
|
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)) {
|
if (!IsHouseCompleted(tile)) {
|
||||||
SetDParamX(td->dparam, 0, td->str);
|
SetDParamX(td->dparam, 0, td->str);
|
||||||
td->str = STR_2058_UNDER_CONSTRUCTION;
|
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;
|
td->owner[0] = OWNER_TOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user