summaryrefslogtreecommitdiff
path: root/src/vehiclelist.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2008-08-20 01:29:05 +0000
committerbelugas <belugas@openttd.org>2008-08-20 01:29:05 +0000
commit77ee09921217eac1540b82978178779eb839d08e (patch)
tree814ce35d6f66a7d5595be82243f5c4ba1bcdef9f /src/vehiclelist.cpp
parentbd6ef958e7f1073dfe9ea8b15c2877a0f9362251 (diff)
downloadopenttd-77ee09921217eac1540b82978178779eb839d08e.tar.xz
(svn r14104) -Feature: Add a window for waypoints, allowing to view all the trains having the selected waypoint in their orders.
Changing its name is also supported from the same new window. Gui based on work done by Satyap, on FS#2025.
Diffstat (limited to 'src/vehiclelist.cpp')
-rw-r--r--src/vehiclelist.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vehiclelist.cpp b/src/vehiclelist.cpp
index 2341a31ad..14798b655 100644
--- a/src/vehiclelist.cpp
+++ b/src/vehiclelist.cpp
@@ -67,6 +67,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
* <li>VLW_STANDARD: not used<li>
* <li>VLW_DEPOT_LIST: TileIndex of the depot/hangar to make the list for</li>
* <li>VLW_GROUP_LIST: index of group to generate a list for</li>
+ * <li>VLM_WAYPOINT_LIST: index of waypoint to generate a list for</li>
* </ul>
* @param window_type The type of window the list is for, using the VLW_ flags in vehicle_gui.h
*/
@@ -122,6 +123,21 @@ void GenerateVehicleSortList(VehicleList *list, VehicleType type, PlayerID owner
}
break;
+ case VLM_WAYPOINT_LIST:
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == type && v->IsPrimaryVehicle()) {
+ const Order *order;
+
+ FOR_VEHICLE_ORDERS(v, order) {
+ if (order->IsType(OT_GOTO_WAYPOINT) && order->GetDestination() == index) {
+ *list->Append() = v;
+ break;
+ }
+ }
+ }
+ }
+ break;
+
case VLW_GROUP_LIST:
FOR_ALL_VEHICLES(v) {
if (v->type == type && v->IsPrimaryVehicle() &&