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.
This commit is contained in:
@@ -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) {
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../group.h"
|
||||
#include "../company_base.h"
|
||||
|
||||
#include "saveload.h"
|
||||
|
||||
@@ -23,6 +24,9 @@ static const SaveLoad _group_desc[] = {
|
||||
SLE_VAR(Group, owner, SLE_UINT8),
|
||||
SLE_VAR(Group, vehicle_type, SLE_UINT8),
|
||||
SLE_VAR(Group, replace_protection, SLE_BOOL),
|
||||
SLE_CONDVAR(Group, livery.in_use, SLE_UINT8, 205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, livery.colour1, SLE_UINT8, 205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, livery.colour2, SLE_UINT8, 205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, parent, SLE_UINT16, 189, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
@@ -47,6 +51,12 @@ static void Load_GRPS()
|
||||
SlObject(g, _group_desc);
|
||||
|
||||
if (IsSavegameVersionBefore(189)) g->parent = INVALID_GROUP;
|
||||
|
||||
if (IsSavegameVersionBefore(205)) {
|
||||
const Company *c = Company::Get(g->owner);
|
||||
g->livery.colour1 = c->livery[LS_DEFAULT].colour1;
|
||||
g->livery.colour2 = c->livery[LS_DEFAULT].colour2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -274,8 +274,9 @@
|
||||
* 202 #6867 Increase industry cargo slots to 16 in, 16 out
|
||||
* 203 #7072 Add path cache for ships
|
||||
* 204 #7065 Add extra rotation stages for ships.
|
||||
* 205 #7108 Livery storage change and group liveries.
|
||||
*/
|
||||
extern const uint16 SAVEGAME_VERSION = 204; ///< Current savegame version of OpenTTD.
|
||||
extern const uint16 SAVEGAME_VERSION = 205; ///< Current savegame version of OpenTTD.
|
||||
|
||||
SavegameType _savegame_type; ///< type of savegame we are loading
|
||||
FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop.
|
||||
|
Reference in New Issue
Block a user