Changeset - r28654:152d7a3266c4
[Not reviewed]
master
0 3 0
kiwitreekor - 10 months ago 2024-02-03 10:17:49
kiwitreekor@gmail.com
Add: Station variable 6B to get extended station id of nearby tiles (#10953)
3 files changed with 35 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_roadstop.cpp
Show inline comments
 
@@ -171,6 +171,23 @@ uint32_t RoadStopScopeResolver::GetVaria
 
			return ssl.grfid;
 
		}
 

	
 
		/* 16 bit road stop ID of nearby tiles */
 
		case 0x6B: {
 
			TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
 

	
 
			if (!IsRoadStopTile(nearby_tile)) return 0xFFFFFFFF;
 
			if (!IsCustomRoadStopSpecIndex(nearby_tile)) return 0xFFFE;
 

	
 
			uint32_t grfid = this->st->roadstop_speclist[GetCustomRoadStopSpecIndex(this->tile)].grfid;
 

	
 
			const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)];
 
			if (ssl.grfid == grfid) {
 
				return ssl.localidx;
 
			}
 

	
 
			return 0xFFFE;
 
		}
 

	
 
		case 0xF0: return this->st == nullptr ? 0 : this->st->facilities; // facilities
 

	
 
		case 0xFA: return ClampTo<uint16_t>((this->st == nullptr ? TimerGameCalendar::date : this->st->build_date) - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // build date
src/newgrf_station.cpp
Show inline comments
 
@@ -376,6 +376,22 @@ TownScopeResolver *StationResolverObject
 
			return ssl.grfid;
 
		}
 

	
 
		case 0x6B: { // 16 bit Station ID of nearby tiles
 
			TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
 

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

	
 
			uint32_t grfid = this->st->speclist[GetCustomStationSpecIndex(this->tile)].grfid;
 

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

	
 
			return 0xFFFE;
 
		}
 

	
 
		/* General station variables */
 
		case 0x82: return 50;
 
		case 0x84: return this->st->string_id;
src/table/newgrf_debug_data.h
Show inline comments
 
@@ -131,6 +131,7 @@ static const NIVariable _niv_stations[] 
 
	NIV(0x68, "station info of nearby tiles"),
 
	NIV(0x69, "information about cargo accepted in the past"),
 
	NIV(0x6A, "GRFID of nearby station tiles"),
 
	NIV(0x6B, "station ID of nearby tiles"),
 
	NIV_END()
 
};
 

	
 
@@ -689,6 +690,7 @@ static const NIVariable _nif_roadstops[]
 
	NIV(0x68, "road stop info of nearby tiles"),
 
	NIV(0x69, "information about cargo accepted in the past"),
 
	NIV(0x6A, "GRFID of nearby road stop tiles"),
 
	NIV(0x6B, "road stop ID of nearby tiles"),
 
	NIV_END(),
 
};
 

	
0 comments (0 inline, 0 general)