(svn r20658) -Codechange: add the colour of an object to the object instance
This commit is contained in:
@@ -2279,6 +2279,15 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
/* Add (random) colour to all objects. */
|
||||
if (CheckSavegameVersion(148)) {
|
||||
Object *o;
|
||||
FOR_ALL_OBJECTS(o) {
|
||||
Owner owner = GetTileOwner(o->location.tile);
|
||||
o->colour = (owner == OWNER_NONE) ? Random() & 0xF : Company::Get(owner)->livery->colour1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Road stops is 'only' updating some caches */
|
||||
AfterLoadRoadStops();
|
||||
AfterLoadLabelMaps();
|
||||
|
@@ -22,6 +22,7 @@ static const SaveLoad _object_desc[] = {
|
||||
SLE_VAR(Object, location.h, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_REF(Object, town, REF_TOWN),
|
||||
SLE_VAR(Object, build_date, SLE_UINT32),
|
||||
SLE_CONDVAR(Object, colour, SLE_UINT8, 148, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
Reference in New Issue
Block a user