summaryrefslogtreecommitdiff
path: root/src/saveload/company_sl.cpp
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-01-31 13:57:44 +0000
committerIngo von Borstel <github@planetmaker.de>2019-01-31 14:57:44 +0100
commit23960d0f2c82a634e0ca1be720c229ac22f14962 (patch)
tree7a7c75a5e7ae19943377756d49c477d759873d3b /src/saveload/company_sl.cpp
parentba38a7ca652c00a1d0851f4d97f0b7d360df853c (diff)
downloadopenttd-23960d0f2c82a634e0ca1be720c229ac22f14962.tar.xz
Feature: Group liveries, and livery window usability enhancements. (#7108)
* Change: Replace checkbox in livery selection window with Default option in drop down selection. This reduces clutter in the UI and allows for primary/secondary colours to independently follow the default scheme if desired. * Feature: Add vehicle group liveries.
Diffstat (limited to 'src/saveload/company_sl.cpp')
-rw-r--r--src/saveload/company_sl.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index ce388e214..1782e7c28 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -403,7 +403,7 @@ static const SaveLoad _company_ai_build_rec_desc[] = {
};
static const SaveLoad _company_livery_desc[] = {
- SLE_CONDVAR(Livery, in_use, SLE_BOOL, 34, SL_MAX_VERSION),
+ SLE_CONDVAR(Livery, in_use, SLE_UINT8, 34, SL_MAX_VERSION),
SLE_CONDVAR(Livery, colour1, SLE_UINT8, 34, SL_MAX_VERSION),
SLE_CONDVAR(Livery, colour2, SLE_UINT8, 34, SL_MAX_VERSION),
SLE_END()
@@ -443,9 +443,18 @@ static void SaveLoad_PLYR_common(Company *c, CompanyProperties *cprops)
/* Write each livery entry. */
int num_liveries = IsSavegameVersionBefore(63) ? LS_END - 4 : (IsSavegameVersionBefore(85) ? LS_END - 2: LS_END);
+ bool update_in_use = IsSavegameVersionBefore(205);
if (c != NULL) {
for (i = 0; i < num_liveries; i++) {
SlObject(&c->livery[i], _company_livery_desc);
+ if (update_in_use && i != LS_DEFAULT) {
+ if (c->livery[i].in_use == 0) {
+ c->livery[i].colour1 = c->livery[LS_DEFAULT].colour1;
+ c->livery[i].colour2 = c->livery[LS_DEFAULT].colour2;
+ } else {
+ c->livery[i].in_use = 3;
+ }
+ }
}
if (num_liveries < LS_END) {