Codechange: Use helper function for company recolour offset (#14740)

This commit is contained in:
Rito12
2025-11-03 13:25:32 +01:00
committed by dP
parent c83537a484
commit 4623aa81f6
3 changed files with 15 additions and 7 deletions

View File

@@ -97,8 +97,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
if (owner == OWNER_NONE) {
o->colour = Random();
} else {
const Livery &l = Company::Get(owner)->livery[0];
o->colour = l.colour1 + l.colour2 * 16;
o->colour = Company::Get(owner)->GetCompanyRecolourOffset(LS_DEFAULT);
}
/* If the object wants only one colour, then give it that colour. */
@@ -193,8 +192,7 @@ void UpdateObjectColours(const Company *c)
/* Using the object colour callback, so not using company colour. */
if (spec->callback_mask.Test(ObjectCallbackMask::Colour)) continue;
const Livery &l = c->livery[0];
obj->colour = (spec->flags.Test(ObjectFlag::Uses2CC) ? (l.colour2 * 16) : 0) + l.colour1;
obj->colour = c->GetCompanyRecolourOffset(LS_DEFAULT, spec->flags.Test(ObjectFlag::Uses2CC));
}
}