Skip to content

Commit

Permalink
Merge pull request #1167 from CitiesSkylinesMods/bugfix/1148-cars-des…
Browse files Browse the repository at this point in the history
…paw-with-despawning-off

Cars and cargo trucks despawn despite the Despawning is off
  • Loading branch information
krzychu124 authored Oct 14, 2021
2 parents 3d127b9 + 99b435d commit 31a626b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TLM/TLM/Patch/PatchCommons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public static IEnumerable<CodeInstruction> ReplaceSimulationStepIsCongestedCheck

bool found = false;
foreach (CodeInstruction instruction in codes) {
if (!found && instruction.opcode.Equals(OpCodes.Brfalse_S)) {
if (!found && (instruction.opcode.Equals(OpCodes.Brfalse_S) || instruction.opcode.Equals(OpCodes.Brfalse))) {
found = true;
yield return instruction; // return found instruction
yield return new CodeInstruction(OpCodes.Ldsfld, _vehicleBehaviourManagerInstanceField); // loadInstFiled
yield return new CodeInstruction(OpCodes.Ldarg_2); // loadVehicleData
yield return new CodeInstruction(OpCodes.Callvirt, _mayDespawnMethod); // callMayDespawn
yield return instruction.Clone(); //brfalse_s clone including label!
yield return instruction.Clone(); //brfalse_s || brfalse - clone including label!
} else {
yield return instruction;
}
Expand Down

0 comments on commit 31a626b

Please sign in to comment.