Changeset - r9714:24e754d1822b
[Not reviewed]
master
0 8 0
smatz - 16 years ago 2008-07-25 22:37:34
smatz@openttd.org
(svn r13830) -Feature: show additional NewGRF info in the Tile Info window for stations, houses and industries
8 files changed with 65 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -386,19 +386,24 @@ static void GetAcceptedCargo_Industry(Ti
 
	}
 
}
 

	
 
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)
 
{
 
	Industry *i = GetIndustryByTile(tile);
 
	const IndustrySpec *indspec = GetIndustrySpec(i->type);
src/lang/english.txt
Show inline comments
 
@@ -3123,12 +3123,16 @@ STR_B005_COAL_MINE_SUBSIDENCE_LEAVES    
 
STR_B006_FLOOD_VEHICLE_DESTROYED                                :{BLACK}{BIGFONT}Floods!{}At least {COMMA} missing, presumed dead after significant flooding!
 

	
 
STR_BRIBE_FAILED                                                :{WHITE}Your attempted bribe has been
 
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})
 
STR_PERFORMANCE_DETAIL_AMOUNT_INT                               :{BLACK}({COMMA}/{COMMA})
 
STR_PERFORMANCE_DETAIL_PERCENT                                  :{WHITE}{NUM}%
 
SET_PERFORMANCE_DETAIL_INT                                      :{BLACK}{NUM}
src/misc_gui.cpp
Show inline comments
 
@@ -70,13 +70,13 @@ static const WindowDesc _land_info_desc 
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
 
	_land_info_widgets,
 
};
 

	
 
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,
 

	
 
		LAND_INFO_LINE_BUFF_SIZE = 512,
 
	};
 

	
 
@@ -128,12 +128,17 @@ public:
 
		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.grf = NULL;
 

	
 
		GetAcceptedCargo(tile, ac);
 
		GetTileDesc(tile, &td);
 

	
 
		uint line_nr = 0;
 

	
 
		/* Tiletype */
 
@@ -183,12 +188,35 @@ public:
 
		if (td.build_date != INVALID_DATE) {
 
			SetDParam(0, td.build_date);
 
			GetString(this->landinfo_data[line_nr], STR_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_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';
 

	
 
		/* Cargo acceptance is displayed in a extra multiline */
 
		char *strp = GetString(this->landinfo_data[LAND_INFO_MULTICENTER_LINE], STR_01CE_CARGO_ACCEPTED, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
 
		bool found = false;
src/newgrf_station.cpp
Show inline comments
 
@@ -832,13 +832,13 @@ bool DrawStationTile(int x, int y, RailT
 
	}
 

	
 
	return true;
 
}
 

	
 

	
 
static const StationSpec* GetStationSpec(TileIndex t)
 
const StationSpec *GetStationSpec(TileIndex t)
 
{
 
	const Station* st;
 
	uint specindex;
 

	
 
	if (!IsCustomStationSpecIndex(t)) return NULL;
 

	
src/newgrf_station.h
Show inline comments
 
@@ -107,12 +107,13 @@ struct StationClass {
 
};
 

	
 
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);
 

	
 
void SetCustomStationSpec(StationSpec *statspec);
 
const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station);
src/station_cmd.cpp
Show inline comments
 
@@ -40,12 +40,13 @@
 
#include "vehicle_func.h"
 
#include "string_func.h"
 
#include "signal_func.h"
 
#include "oldpool_func.h"
 
#include "animated_tile_func.h"
 
#include "elrail_func.h"
 
#include "newgrf.h"
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
DEFINE_OLD_POOL_GENERIC(Station, Station)
 
DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop)
 
@@ -2309,12 +2310,24 @@ static void GetTileDesc_Station(TileInde
 
		/* Display a second owner */
 
		td->owner_type[1] = STR_ROAD_OWNER;
 
		td->owner[1] = OWNER_TOWN;
 
	}
 
	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();
 
		case STATION_RAIL:    str = STR_305E_RAILROAD_STATION; break;
 
		case STATION_AIRPORT:
 
			str = (IsHangar(tile) ? STR_305F_AIRCRAFT_HANGAR : STR_3060_AIRPORT);
src/tile_cmd.h
Show inline comments
 
@@ -49,12 +49,15 @@ struct TileInfo {
 

	
 
struct TileDesc {
 
	StringID str;
 
	Owner owner[4];
 
	StringID owner_type[4];
 
	Date build_date;
 
	StringID station_class;
 
	StringID station_name;
 
	const char *grf;
 
	uint64 dparam[2];
 
};
 

	
 
typedef void DrawTileProc(TileInfo *ti);
 
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
 
typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
src/town_cmd.cpp
Show inline comments
 
@@ -613,18 +613,25 @@ static void GetAcceptedCargo_Town(TileIn
 
		if (accepts[i] != CT_INVALID) ac[accepts[i]] = hs->cargo_acceptance[i];
 
	}
 
}
 

	
 
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;
 
}
 

	
 
static TrackStatus GetTileTrackStatus_Town(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
 
{
 
	/* not used */
0 comments (0 inline, 0 general)