mirror of https://github.com/OpenTTD/OpenTTD
Add: station variable 6C for wider ID detection
parent
1a6655bd1b
commit
43a2448858
|
@ -199,6 +199,17 @@ uint32_t RoadStopScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] u
|
||||||
return 0xFFFE;
|
return 0xFFFE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 16 bit road stop ID of nearby tiles, without GRFID check */
|
||||||
|
case 0x6C: {
|
||||||
|
TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
|
||||||
|
|
||||||
|
if (!IsAnyRoadStopTile(nearby_tile)) return 0xFFFFFFFF;
|
||||||
|
if (!IsCustomRoadStopSpecIndex(nearby_tile)) return 0xFFFE;
|
||||||
|
|
||||||
|
const auto &sm = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)];
|
||||||
|
return sm.localidx;
|
||||||
|
}
|
||||||
|
|
||||||
case 0xF0: return this->st == nullptr ? 0 : this->st->facilities; // facilities
|
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
|
case 0xFA: return ClampTo<uint16_t>((this->st == nullptr ? TimerGameCalendar::date : this->st->build_date) - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // build date
|
||||||
|
|
|
@ -393,6 +393,16 @@ TownScopeResolver *StationResolverObject::GetTown()
|
||||||
return 0xFFFE;
|
return 0xFFFE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 0x6C: { // 16 bit Station ID of nearby tiles, without GRFID check
|
||||||
|
TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
|
||||||
|
|
||||||
|
if (!HasStationTileRail(nearby_tile)) return 0xFFFFFFFF;
|
||||||
|
if (!IsCustomStationSpecIndex(nearby_tile)) return 0xFFFE;
|
||||||
|
|
||||||
|
const auto &sm = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)];
|
||||||
|
return sm.localidx;
|
||||||
|
}
|
||||||
|
|
||||||
/* General station variables */
|
/* General station variables */
|
||||||
case 0x82: return 50;
|
case 0x82: return 50;
|
||||||
case 0x84: return this->st->string_id;
|
case 0x84: return this->st->string_id;
|
||||||
|
|
|
@ -132,6 +132,7 @@ static const NIVariable _niv_stations[] = {
|
||||||
NIV(0x69, "information about cargo accepted in the past"),
|
NIV(0x69, "information about cargo accepted in the past"),
|
||||||
NIV(0x6A, "GRFID of nearby station tiles"),
|
NIV(0x6A, "GRFID of nearby station tiles"),
|
||||||
NIV(0x6B, "station ID of nearby tiles"),
|
NIV(0x6B, "station ID of nearby tiles"),
|
||||||
|
NIV(0x6C, "station ID of nearby tiles even if not from the same GRF"),
|
||||||
NIV_END()
|
NIV_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -691,6 +692,7 @@ static const NIVariable _nif_roadstops[] = {
|
||||||
NIV(0x69, "information about cargo accepted in the past"),
|
NIV(0x69, "information about cargo accepted in the past"),
|
||||||
NIV(0x6A, "GRFID of nearby road stop tiles"),
|
NIV(0x6A, "GRFID of nearby road stop tiles"),
|
||||||
NIV(0x6B, "road stop ID of nearby tiles"),
|
NIV(0x6B, "road stop ID of nearby tiles"),
|
||||||
|
NIV(0x6C, "road stop ID of nearby tiles even if not from the same GRF"),
|
||||||
NIV_END(),
|
NIV_END(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue