From 5d2ed80c95673dc73f390c3b5d007caffc8bb17d Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 27 Dec 2023 20:25:38 +0000 Subject: [PATCH] Fix: Changing group parent did not properly update partially-default liveries. --- src/group_cmd.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp index a908fb830e..a96d65585c 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -466,10 +466,11 @@ CommandCost CmdAlterGroup(DoCommandFlag flags, AlterGroupMode mode, GroupID grou g->parent = (pg == nullptr) ? INVALID_GROUP : pg->index; GroupStatistics::UpdateAutoreplace(g->owner); - if (g->livery.in_use == 0) { + if (!HasBit(g->livery.in_use, 0) || !HasBit(g->livery.in_use, 1)) { + /* Update livery with new parent's colours if either colour is default. */ const Livery *livery = GetParentLivery(g); - g->livery.colour1 = livery->colour1; - g->livery.colour2 = livery->colour2; + if (!HasBit(g->livery.in_use, 0)) g->livery.colour1 = livery->colour1; + if (!HasBit(g->livery.in_use, 1)) g->livery.colour2 = livery->colour2; PropagateChildLivery(g, true); MarkWholeScreenDirty();