File diff r18299:b635b66c1adb → r18300:87ebd90f3b7f
src/table/newgrf_debug_data.h
Show inline comments
 
@@ -208,97 +208,97 @@ static const NICallback _nic_industrytil
 
	NICIT(CBID_INDTILE_DRAW_FOUNDATIONS, CBM_INDT_DRAW_FOUNDATIONS),
 
	NICIT(CBID_INDTILE_AUTOSLOPE,        CBM_INDT_AUTOSLOPE),
 
	NIC_END()
 
};
 

	
 
static const NIVariable _niv_industrytiles[] = {
 
	NIV(0x40, "construction state of tile"),
 
	NIV(0x41, "ground type"),
 
	NIV(0x42, "current town zone in nearest town"),
 
	NIV(0x43, "relative position"),
 
	NIV(0x44, "animation frame"),
 
	NIV(0x60, "land info of nearby tiles"),
 
	NIV(0x61, "animation stage of nearby tiles"),
 
	NIV(0x62, "get industry or airport tile ID at offset"),
 
	NIV_END()
 
};
 

	
 
class NIHIndustryTile : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
 
	const void *GetInstance(uint index)const             { return NULL; }
 
	const void *GetSpec(uint index) const                { return GetIndustryTileSpec(GetIndustryGfx(index)); }
 
	void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_INDUSTRY_NAME, GetIndustryIndex(index), index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile->grfid : 0; }
 
	void Resolve(ResolverObject *ro, uint32 index) const { extern void GetIndustryTileResolver(ResolverObject *ro, uint index); GetIndustryTileResolver(ro, index); }
 
};
 

	
 
static const NIFeature _nif_industrytile = {
 
	NULL,
 
	_nic_industrytiles,
 
	_niv_industrytiles,
 
	new NIHIndustryTile(),
 
};
 

	
 

	
 
/*** NewGRF industries ***/
 

	
 
static const NIProperty _nip_industries[] = {
 
	NIP(0x10, Industry, produced_cargo[0], NIT_CARGO, "produced cargo 0"),
 
	NIP(0x10, Industry, produced_cargo[1], NIT_CARGO, "produced cargo 1"),
 
	NIP(0x11, Industry, accepts_cargo[0],  NIT_CARGO, "accepted cargo 0"),
 
	NIP(0x11, Industry, accepts_cargo[1],  NIT_CARGO, "accepted cargo 1"),
 
	NIP(0x11, Industry, accepts_cargo[2],  NIT_CARGO, "accepted cargo 2"),
 
	NIP_END()
 
};
 

	
 
#define NICI(cb_id, bit) NIC(cb_id, IndustrySpec, callback_mask, bit)
 
static const NICallback _nic_industries[] = {
 
	NICI(CBID_INDUSTRY_AVAILABLE,            CBM_IND_AVAILABLE),
 
	NICI(CBID_INDUSTRY_PROBABILITY,          CBM_IND_PROBABILITY),
 
	NICI(CBID_INDUSTRY_LOCATION,             CBM_IND_LOCATION),
 
	NICI(CBID_INDUSTRY_PRODUCTION_CHANGE,    CBM_IND_PRODUCTION_CHANGE),
 
	NICI(CBID_INDUSTRY_MONTHLYPROD_CHANGE,   CBM_IND_MONTHLYPROD_CHANGE),
 
	NICI(CBID_INDUSTRY_CARGO_SUFFIX,         CBM_IND_CARGO_SUFFIX),
 
	NICI(CBID_INDUSTRY_FUND_MORE_TEXT,       CBM_IND_FUND_MORE_TEXT),
 
	NICI(CBID_INDUSTRY_WINDOW_MORE_TEXT,     CBM_IND_WINDOW_MORE_TEXT),
 
	NICI(CBID_INDUSTRY_SPECIAL_EFFECT,       CBM_IND_SPECIAL_EFFECT),
 
	NICI(CBID_INDUSTRY_REFUSE_CARGO,         CBM_IND_REFUSE_CARGO),
 
	NICI(CBID_INDUSTRY_DECIDE_COLOUR,        CBM_IND_DECIDE_COLOUR),
 
	NICI(CBID_INDUSTRY_INPUT_CARGO_TYPES,    CBM_IND_INPUT_CARGO_TYPES),
 
	NICI(CBID_INDUSTRY_OUTPUT_CARGO_TYPES,   CBM_IND_OUTPUT_CARGO_TYPES),
 
	NIC_END()
 
};
 

	
 
static const NIVariable _niv_industries[] = {
 
	NIV(0x40, "waiting cargo 0"),
 
	NIV(0x41, "waiting cargo 1"),
 
	NIV(0x42, "waiting cargo 2"),
 
	NIV(0x43, "distance to closest dry/land tile"),
 
	NIV(0x44, "layout number"),
 
	NIV(0x45, "player info"),
 
	NIV(0x46, "industry construction date"),
 
	NIV(0x60, "get industry tile ID at offset"),
 
	NIV(0x61, "get random tile bits at offset"),
 
	NIV(0x62, "land info of nearby tiles"),
 
	NIV(0x63, "animation stage of nearby tiles"),
 
	NIV(0x64, "distance on nearest industry with given type"),
 
	NIV(0x65, "get town zone and Manhattan distance of closest town"),
 
	NIV(0x66, "get square of Euclidean distance of closes town"),
 
	NIV(0x67, "count of industry and distance of closest instance"),
 
	NIV(0x68, "count of industry and distance of closest instance with layout filter"),
 
	NIV_END()
 
};
 

	
 
class NIHIndustry : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
 
	const void *GetInstance(uint index)const             { return Industry::Get(index); }
 
	const void *GetSpec(uint index) const                { return GetIndustrySpec(Industry::Get(index)->type); }
 
	void SetStringParameters(uint index) const           { this->SetSimpleStringParameters(STR_INDUSTRY_NAME, index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile->grfid : 0; }
 
	void Resolve(ResolverObject *ro, uint32 index) const { extern void GetIndustryResolver(ResolverObject *ro, uint index); GetIndustryResolver(ro, index); }
 
	uint GetPSASize(uint index, uint32 grfid) const      { return cpp_lengthof(PersistentStorage, storage); }
 

	
 
	int32 *GetPSAFirstPosition(uint index, uint32 grfid) const
 
	{
 
		Industry *i = (Industry *)this->GetInstance(index);
 
		if (i->psa == NULL) return NULL;