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

Function InsertInConsist

src/train_cmd.cpp:924–931  ·  view source on GitHub ↗

* Inserts a chain into the train at dst. * @param dst the place where to append after. * @param chain the chain to actually add. */

Source from the content-addressed store, hash-verified

922 * @param chain the chain to actually add.
923 */
924static void InsertInConsist(Train *dst, Train *chain)
925{
926 /* We do not want to add something in the middle of an articulated part. */
927 assert(dst != nullptr && (dst->Next() == nullptr || !dst->Next()->IsArticulatedPart()));
928
929 chain->Last()->SetNext(dst->Next());
930 dst->SetNext(chain);
931}
932
933/**
934 * Normalise the dual heads in the train, i.e. if one is

Callers 2

NormaliseDualHeadsFunction · 0.85
ArrangeTrainsFunction · 0.85

Calls 4

IsArticulatedPartMethod · 0.80
SetNextMethod · 0.80
NextMethod · 0.45
LastMethod · 0.45

Tested by

no test coverage detected