Changeset - r24076:79e963b54e98
[Not reviewed]
master
0 2 0
kiwitreekor - 5 years ago 2020-01-29 20:23:23
kiwitreekor@gmail.com
Add: [NewGRF] Station variable 6A, querying GRFID of nearby station tiles (#7956)
2 files changed with 11 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_station.cpp
Show inline comments
 
@@ -365,12 +365,22 @@ TownScopeResolver *StationResolverObject
 
				const StationSpecList ssl = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)];
 
				res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ssl.localidx;
 
			}
 
			return res;
 
		}
 

	
 
		case 0x6A: { // GRFID of nearby station tiles
 
			TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
 

	
 
			if (!HasStationTileRail(nearby_tile)) return 0xFFFFFFFF;
 
			if (!IsCustomStationSpecIndex(nearby_tile)) return 0;
 

	
 
			const StationSpecList ssl = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)];
 
			return ssl.grfid;
 
		}
 

	
 
		/* General station variables */
 
		case 0x82: return 50;
 
		case 0x84: return this->st->string_id;
 
		case 0x86: return 0;
 
		case 0xF0: return this->st->facilities;
 
		case 0xFA: return Clamp(this->st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535);
src/table/newgrf_debug_data.h
Show inline comments
 
@@ -124,12 +124,13 @@ static const NIVariable _niv_stations[] 
 
	NIV(0x64, "information about last vehicle picking cargo up"),
 
	NIV(0x65, "amount of cargo acceptance"),
 
	NIV(0x66, "animation frame of nearby tile"),
 
	NIV(0x67, "land info of nearby tiles"),
 
	NIV(0x68, "station info of nearby tiles"),
 
	NIV(0x69, "information about cargo accepted in the past"),
 
	NIV(0x6A, "GRFID of nearby station tiles"),
 
	NIV_END()
 
};
 

	
 
class NIHStation : public NIHelper {
 
	bool IsInspectable(uint index) const override        { return GetStationSpec(index) != nullptr; }
 
	uint GetParent(uint index) const override            { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
0 comments (0 inline, 0 general)