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

Method IsChainInDepot

src/ground_vehicle.cpp:190–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188 */
189template <class T, VehicleType Type>
190bool GroundVehicle<T, Type>::IsChainInDepot() const
191{
192 const T *v = this->First();
193 /* Is the front engine stationary in the depot? */
194 static_assert((int)TRANSPORT_RAIL == (int)VEH_TRAIN);
195 static_assert((int)TRANSPORT_ROAD == (int)VEH_ROAD);
196 if (!IsDepotTypeTile(v->tile, (TransportType)Type) || v->cur_speed != 0) return false;
197
198 /* Check whether the rest is also already trying to enter the depot. */
199 for (; v != nullptr; v = v->Next()) {
200 if (!v->T::IsInDepot() || v->tile != this->tile) return false;
201 }
202
203 return true;
204}
205
206/* Instantiation for Train */
207template struct GroundVehicle<Train, VEH_TRAIN>;

Callers 11

CmdAutoreplaceVehicleFunction · 0.45
CheckIfShipNeedsServiceFunction · 0.45
CheckShipStayInDepotFunction · 0.45
CheckIfTrainNeedsServiceFunction · 0.45
CmdMassStartStopVehicleFunction · 0.45
CmdDepotMassAutoReplaceFunction · 0.45
DrawVehicleListItemsMethod · 0.45
IsInDepotMethod · 0.45

Calls 3

IsDepotTypeTileFunction · 0.85
FirstMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected