# ai_waypointlist.cpp

Go to the documentation of this file.

    00001 /* $Id: ai_waypointlist.cpp 15519 2009-02-19 07:40:08Z yexo $ */
    00002
    00005 #include "ai_waypointlist.hpp"
    00006 #include "ai_vehicle.hpp"
    00007 #include "ai_waypoint.hpp"
    00008 #include "../../company_func.h"
    00009 #include "../../vehicle_base.h"
    00010 #include "../../waypoint.h"
    00011
    00012 AIWaypointList::AIWaypointList()
    00013 {
    00014   const Waypoint *wp;
    00015   FOR_ALL_WAYPOINTS(wp) {
    00016     if (wp->owner == _current_company) this->AddItem(wp->index);
    00017   }
    00018 }
    00019
    00020 AIWaypointList_Vehicle::AIWaypointList_Vehicle(VehicleID vehicle_id)
    00021 {
    00022   if (!AIVehicle::IsValidVehicle(vehicle_id)) return;
    00023
    00024   const Vehicle *v = ::GetVehicle(vehicle_id);
    00025
    00026   for (const Order *o = v->GetFirstOrder(); o != NULL; o = o->next) {
    00027     if (o->IsType(OT_GOTO_WAYPOINT)) this->AddItem(o->GetDestination());
    00028   }
    00029 }