diff --git a/code/components/citizen-server-impl/src/state/ServerGameState.cpp b/code/components/citizen-server-impl/src/state/ServerGameState.cpp index c894736b00..a025aba567 100644 --- a/code/components/citizen-server-impl/src/state/ServerGameState.cpp +++ b/code/components/citizen-server-impl/src/state/ServerGameState.cpp @@ -2657,11 +2657,18 @@ void ServerGameState::IterateTrainLink(const sync::SyncEntityPtr& initialTrain, { auto recurseTrain = [=](const fx::sync::SyncEntityPtr& train) { + // make sure we call for the train if its not the initial train, this should only ever happen of + // the function this is called on is a carriage instead of the train engine + if (train->handle != initialTrain->handle) + { + fn(const_cast(train)); + } for (auto link = GetNextTrain(this, train); link; link = GetNextTrain(this, link)) { // IterateTrainLink is expected to make sure that the initial train & the link trains are not called twice // since this could lead to double locking the client mutex in ReassignEntity - if (link->handle == initialTrain->handle) + // we also ignore the train sent via the call to `recurseTrain` as we should've called `fn` before here + if (link->handle == initialTrain->handle || link->handle == train->handle) { continue; }