diff options
author | rubidium <rubidium@openttd.org> | 2010-12-13 21:55:06 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-12-13 21:55:06 +0000 |
commit | 6d831906a3da98d357149c6a56915f9fb06b417b (patch) | |
tree | 9ec530e4aa2fc575810b39481d15e329eb201cbb /src/train_cmd.cpp | |
parent | 55a0e31c44f178d2f77049eace489838d97e7ef0 (diff) | |
download | openttd-6d831906a3da98d357149c6a56915f9fb06b417b.tar.xz |
(svn r21508) -Codechange: move the code to handle the pathfinder's "path found" status to a separate function
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r-- | src/train_cmd.cpp | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 824745ec6..b1119d8ee 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2408,32 +2408,7 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir, Track next_track = DoTrainPathfind(v, new_tile, dest_enterdir, tracks, &path_not_found, do_track_reservation, &res_dest); if (new_tile == tile) best_track = next_track; - - /* handle "path not found" state */ - if (path_not_found) { - /* PF didn't find the route */ - 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_vehicle_warn && v->owner == _local_company) { - SetDParam(0, v->index); - AddVehicleNewsItem( - STR_NEWS_VEHICLE_IS_LOST, - NS_ADVICE, - v->index - ); - } - } - } else { - /* route found, is the train marked with "path not found" flag? */ - if (HasBit(v->vehicle_flags, VF_PATHFINDER_LOST)) { - /* clear the flag as the PF's problem was solved */ - ClrBit(v->vehicle_flags, VF_PATHFINDER_LOST); - /* can we also delete the "News" item somehow? */ - } - } + v->HandlePathfindingResult(!path_not_found); } /* No track reservation requested -> finished. */ |