summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-02-02 19:22:35 +0000
committersmatz <smatz@openttd.org>2011-02-02 19:22:35 +0000
commit54161949d1f02a39dfe68812acda81b12d6940e8 (patch)
tree82c7fba27304b508338169c68bedc996f5414eff /src/saveload
parente846701b3ca83941bc305af4d4dbaf1b20c97ef3 (diff)
downloadopenttd-54161949d1f02a39dfe68812acda81b12d6940e8.tar.xz
(svn r21942) -Codechange: no need to convert GOINGUP/GOINGDOWN flags if they are cleared afterwards during savegame conversion
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 4c561d8de..05f15165f 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2242,20 +2242,6 @@ bool AfterLoadGame()
}
}
- if (IsSavegameVersionBefore(139)) {
- Train *t;
- FOR_ALL_TRAINS(t) {
- /* Copy old GOINGUP / GOINGDOWN flags. */
- if (HasBit(t->flags, 1)) {
- ClrBit(t->flags, 1);
- SetBit(t->gv_flags, GVF_GOINGUP_BIT);
- } else if (HasBit(t->flags, 2)) {
- ClrBit(t->flags, 2);
- SetBit(t->gv_flags, GVF_GOINGDOWN_BIT);
- }
- }
- }
-
if (IsSavegameVersionBefore(140)) {
Station *st;
FOR_ALL_STATIONS(st) {
@@ -2470,6 +2456,14 @@ bool AfterLoadGame()
switch (v->type) {
case VEH_TRAIN: {
Train *t = Train::From(v);
+
+ /* Clear old GOINGUP / GOINGDOWN flags.
+ * It was changed in savegame version 139, but savegame
+ * version 158 doesn't use these bits, so it doesn't hurt
+ * to clear them unconditionally. */
+ ClrBit(t->flags, 1);
+ ClrBit(t->flags, 2);
+
/* Clear both bits first. */
ClrBit(t->gv_flags, GVF_GOINGUP_BIT);
ClrBit(t->gv_flags, GVF_GOINGDOWN_BIT);