From c8820824672e18e2edec9f54b5c5cce09d03911f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 27 Mar 2017 18:34:55 +0100 Subject: [PATCH] Chunnel: Fix swap of vehicle chunnel flag when reversing consist. --- src/train_cmd.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 679efbb188..dd5f70bf2f 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1635,8 +1635,10 @@ static void SwapTrainFlags(uint16 *swap_flag1, uint16 *swap_flag2) /* Clear the flags */ ClrBit(*swap_flag1, GVF_GOINGUP_BIT); ClrBit(*swap_flag1, GVF_GOINGDOWN_BIT); + ClrBit(*swap_flag1, GVF_CHUNNEL_BIT); ClrBit(*swap_flag2, GVF_GOINGUP_BIT); ClrBit(*swap_flag2, GVF_GOINGDOWN_BIT); + ClrBit(*swap_flag2, GVF_CHUNNEL_BIT); /* Reverse the rail-flags (if needed) */ if (HasBit(flag1, GVF_GOINGUP_BIT)) { @@ -1649,6 +1651,12 @@ static void SwapTrainFlags(uint16 *swap_flag1, uint16 *swap_flag2) } else if (HasBit(flag2, GVF_GOINGDOWN_BIT)) { SetBit(*swap_flag1, GVF_GOINGUP_BIT); } + if (HasBit(flag1, GVF_CHUNNEL_BIT)) { + SetBit(*swap_flag2, GVF_CHUNNEL_BIT); + } + if (HasBit(flag2, GVF_CHUNNEL_BIT)) { + SetBit(*swap_flag1, GVF_CHUNNEL_BIT); + } } /**