# order_func.h

Go to the documentation of this file.

    00001 /* $Id: order_func.h 14803 2009-01-03 13:52:06Z rubidium $ */
    00002
    00005 #ifndef ORDER_FUNC_H
    00006 #define ORDER_FUNC_H
    00007
    00008 #include "order_type.h"
    00009 #include "vehicle_type.h"
    00010 #include "tile_type.h"
    00011 #include "group_type.h"
    00012 #include "date_type.h"
    00013
    00014 struct BackuppedOrders {
    00015   BackuppedOrders() : order(NULL), name(NULL) { }
    00016   ~BackuppedOrders() { free(order); free(name); }
    00017
    00018   VehicleID clone;
    00019   VehicleOrderID orderindex;
    00020   GroupID group;
    00021   Order *order;
    00022   uint16 service_interval;
    00023   char *name;
    00024 };
    00025
    00026 extern TileIndex _backup_orders_tile;
    00027 extern BackuppedOrders _backup_orders_data;
    00028
    00029 void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *order = &_backup_orders_data);
    00030 void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *order = &_backup_orders_data);
    00031
    00032 /* Functions */
    00033 void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination);
    00034 void InvalidateVehicleOrder(const Vehicle *v, int data);
    00035 bool VehicleHasDepotOrders(const Vehicle *v);
    00036 void CheckOrders(const Vehicle*);
    00037 void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false);
    00038 bool ProcessOrders(Vehicle *v);
    00039 bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth = 0);
    00040 VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v);
    00041
    00042 void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int width);
    00043
    00044 #define MIN_SERVINT_PERCENT  5
    00045 #define MAX_SERVINT_PERCENT 90
    00046 #define MIN_SERVINT_DAYS    30
    00047 #define MAX_SERVINT_DAYS   800
    00048
    00056 Date GetServiceIntervalClamped(uint index);
    00057
    00058 #endif /* ORDER_FUNC_H */