summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-13 21:52:39 +0000
committerrubidium <rubidium@openttd.org>2010-12-13 21:52:39 +0000
commit49a77e89c425c37eb4c6bb4bf9e942bd75a48d57 (patch)
treeeebb3a1f7f349404435949a411fb4072e4914da9 /src
parenta2b50b05c14a27ecbd63026b17b87582bc955305 (diff)
downloadopenttd-49a77e89c425c37eb4c6bb4bf9e942bd75a48d57.tar.xz
(svn r21504) -Codechange: move the "lost" bit from the train's flags to vehicle flags
Diffstat (limited to 'src')
-rw-r--r--src/saveload/afterload.cpp11
-rw-r--r--src/train.h3
-rw-r--r--src/train_cmd.cpp10
-rw-r--r--src/vehicle_base.h1
4 files changed, 17 insertions, 8 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 6e95f5a90..4bd466e1e 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2392,6 +2392,17 @@ bool AfterLoadGame()
}
}
+ if (IsSavegameVersionBefore(156)) {
+ /* The train's pathfinder lost flag got moved. */
+ Train *t;
+ FOR_ALL_TRAINS(t) {
+ if (!HasBit(t->flags, 5)) continue;
+
+ ClrBit(t->flags, 5);
+ SetBit(t->vehicle_flags, VF_PATHFINDER_LOST);
+ }
+ }
+
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();
diff --git a/src/train.h b/src/train.h
index 57d040b18..4e0bc10de 100644
--- a/src/train.h
+++ b/src/train.h
@@ -30,9 +30,6 @@ enum VehicleRailFlags {
/* used to reverse the visible direction of the vehicle */
VRF_REVERSE_DIRECTION = 4,
- /* used to mark train as lost because PF can't find the route */
- VRF_NO_PATH_TO_DESTINATION = 5,
-
/* used to mark that electric train engine is allowed to run on normal rail */
VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6,
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 46bbb1d8f..0d42cb47d 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2412,9 +2412,9 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir,
/* handle "path not found" state */
if (path_not_found) {
/* PF didn't find the route */
- if (!HasBit(v->flags, VRF_NO_PATH_TO_DESTINATION)) {
- /* it is first time the problem occurred, set the "path not found" flag */
- SetBit(v->flags, VRF_NO_PATH_TO_DESTINATION);
+ if (!HasBit(v->vehicle_flags, VF_PATHFINDER_LOST)) {
+ /* It is first time the problem occurred, set the "lost" flag. */
+ SetBit(v->vehicle_flags, VF_PATHFINDER_LOST);
/* and notify user about the event */
AI::NewEvent(v->owner, new AIEventVehicleLost(v->index));
if (_settings_client.gui.lost_train_warn && v->owner == _local_company) {
@@ -2428,9 +2428,9 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir,
}
} else {
/* route found, is the train marked with "path not found" flag? */
- if (HasBit(v->flags, VRF_NO_PATH_TO_DESTINATION)) {
+ if (HasBit(v->vehicle_flags, VF_PATHFINDER_LOST)) {
/* clear the flag as the PF's problem was solved */
- ClrBit(v->flags, VRF_NO_PATH_TO_DESTINATION);
+ ClrBit(v->vehicle_flags, VF_PATHFINDER_LOST);
/* can we also delete the "News" item somehow? */
}
}
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index 4dfa4e6f1..f0cd76628 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -44,6 +44,7 @@ enum VehicleFlags {
VF_AUTOFILL_TIMETABLE, ///< Whether the vehicle should fill in the timetable automatically.
VF_AUTOFILL_PRES_WAIT_TIME, ///< Whether non-destructive auto-fill should preserve waiting times
VF_STOP_LOADING, ///< Don't load anymore during the next load cycle.
+ VF_PATHFINDER_LOST, ///< Vehicle's pathfinder is lost.
};
/** Bit numbers used to indicate which of the #NewGRFCache values are valid. */