diff options
author | rubidium <rubidium@openttd.org> | 2010-08-28 18:28:34 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-28 18:28:34 +0000 |
commit | e0ba6550d2885ccfade874679fa792648df416f5 (patch) | |
tree | bdb38086be6f15051871ce66bb6c325a4fba2d3f /src/saveload | |
parent | b376f8ae15a053c3a8f54431517da0c235f45489 (diff) | |
download | openttd-e0ba6550d2885ccfade874679fa792648df416f5.tar.xz |
(svn r20658) -Codechange: add the colour of an object to the object instance
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/afterload.cpp | 9 | ||||
-rw-r--r-- | src/saveload/object_sl.cpp | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 95a379c9d..f636c0cc8 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -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(); diff --git a/src/saveload/object_sl.cpp b/src/saveload/object_sl.cpp index 6218eea1e..586c12a33 100644 --- a/src/saveload/object_sl.cpp +++ b/src/saveload/object_sl.cpp @@ -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() }; |