MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / tryFindStationAt

Function tryFindStationAt

src/OpenLoco/src/Vehicles/VehicleHead.cpp:6229–6246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6227 }
6228
6229 static StationId tryFindStationAt(VehicleBogie* bogie)
6230 {
6231 auto direction = bogie->trackAndDirection.track.cardinalDirection();
6232 auto trackId = bogie->trackAndDirection.track.id();
6233
6234 auto tile = TileManager::get(World::Pos2{ bogie->tileX, bogie->tileY });
6235 auto* elStation = tile.trainStation(trackId, direction, bogie->tileBaseZ);
6236 if (elStation == nullptr)
6237 {
6238 return StationId::null;
6239 }
6240 if (elStation->isAiAllocated() || elStation->isGhost())
6241 {
6242 return StationId::null;
6243 }
6244
6245 return elStation->stationId();
6246 }
6247
6248 bool VehicleHead::hasAnyCargo()
6249 {

Callers 1

Calls 7

trainStationMethod · 0.80
isAiAllocatedMethod · 0.80
stationIdMethod · 0.80
getFunction · 0.50
cardinalDirectionMethod · 0.45
idMethod · 0.45
isGhostMethod · 0.45

Tested by

no test coverage detected