MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetVehicleTrackdir

Method GetVehicleTrackdir

src/ship_cmd.cpp:287–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287Trackdir Ship::GetVehicleTrackdir() const
288{
289 if (this->vehstatus.Test(VehState::Crashed)) return INVALID_TRACKDIR;
290
291 if (this->IsInDepot()) {
292 /* We'll assume the ship is facing outwards */
293 return DiagDirToDiagTrackdir(GetShipDepotDirection(this->tile));
294 }
295
296 if (this->state == TRACK_BIT_WORMHOLE) {
297 /* ship on aqueduct, so just use its direction and assume a diagonal track */
298 return DiagDirToDiagTrackdir(DirToDiagDir(this->direction));
299 }
300
301 return TrackDirectionToTrackdir(FindFirstTrack(this->state), this->direction);
302}
303
304void Ship::MarkDirty()
305{

Callers 12

CheckShipStayInDepotFunction · 0.45
CmdBuildSingleSignalFunction · 0.45
FollowTrainReservationFunction · 0.45
FreeTrainReservationFunction · 0.45
RestoreTrainReservationFunction · 0.45
CreateRandomPathMethod · 0.45
CheckShipReverseMethod · 0.45
YapfShipChooseTrackFunction · 0.45
YapfTrainCheckReverseFunction · 0.45

Calls 7

IsInDepotMethod · 0.95
DiagDirToDiagTrackdirFunction · 0.85
GetShipDepotDirectionFunction · 0.85
DirToDiagDirFunction · 0.85
TrackDirectionToTrackdirFunction · 0.85
FindFirstTrackFunction · 0.85
TestMethod · 0.80

Tested by

no test coverage detected