Fix 98ac75e: non deterministic handling of train crashes (#15338)

This commit is contained in:
Loïc Guilloux
2026-02-24 21:57:11 +01:00
committed by Peter Nelson
parent 79bf008514
commit f8e0a8a4eb
+4 -2
View File
@@ -3233,8 +3233,10 @@ static uint CheckTrainCollision(Vehicle *v, Train *t)
/* Happens when there is a train under bridge next to bridge head */
if (abs(v->z_pos - t->z_pos) > 5) return 0;
/* crash both trains */
return TrainCrashed(t) + TrainCrashed(coll);
/* Crash both trains. Two statements required to guarantee execution
* order because RandomRange() is involved. */
uint num_victims = TrainCrashed(t);
return num_victims + TrainCrashed(coll);
}
/**