summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Josep <juanjo.ng.83@gmail.com>2019-01-12 18:04:04 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-01-12 17:04:04 +0000
commit96854b2b8bea85926113326e1fd37ee357f7e59e (patch)
tree56a7c6de71e0b8708bfc7140a12c51c48eee55c9
parent0f9d1019e64db8fe2413ee730d99aa48c078da6c (diff)
downloadopenttd-96854b2b8bea85926113326e1fd37ee357f7e59e.tar.xz
Codechange #5859: Simplify CheckTrainStayInDepot() (#7045)
-rw-r--r--src/train_cmd.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index c8387d0a9..01aa946ed 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2149,12 +2149,10 @@ static bool CheckTrainStayInDepot(Train *v)
seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
}
- /* We are leaving a depot, but have to go to the exact same one; re-enter */
+ /* We are leaving a depot, but have to go to the exact same one; re-enter. */
if (v->current_order.IsType(OT_GOTO_DEPOT) && v->tile == v->dest_tile) {
- /* We need to have a reservation for this to work. */
- if (HasDepotReservation(v->tile)) return true;
- SetDepotReservation(v->tile, true);
- VehicleEnterDepot(v);
+ /* Service when depot has no reservation. */
+ if (!HasDepotReservation(v->tile)) VehicleEnterDepot(v);
return true;
}