# order_func.h

Go to the documentation of this file.

    00001 /* $Id: order_func.h 18809 2010-01-15 16:41:15Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef ORDER_FUNC_H
    00013 #define ORDER_FUNC_H
    00014
    00015 #include "order_type.h"
    00016 #include "vehicle_type.h"
    00017 #include "tile_type.h"
    00018 #include "group_type.h"
    00019 #include "company_type.h"
    00020
    00021 struct BackuppedOrders {
    00022   BackuppedOrders() : order(NULL), name(NULL) { }
    00023   ~BackuppedOrders() { free(order); free(name); }
    00024
    00025   VehicleID clone;
    00026   VehicleOrderID orderindex;
    00027   GroupID group;
    00028   Order *order;
    00029   uint16 service_interval;
    00030   char *name;
    00031 };
    00032
    00033 extern TileIndex _backup_orders_tile;
    00034 extern BackuppedOrders _backup_orders_data;
    00035
    00036 void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *order = &_backup_orders_data);
    00037 void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *order = &_backup_orders_data);
    00038
    00039 /* Functions */
    00040 void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination);
    00041 void InvalidateVehicleOrder(const Vehicle *v, int data);
    00042 bool VehicleHasDepotOrders(const Vehicle *v);
    00043 void CheckOrders(const Vehicle*);
    00044 void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false);
    00045 bool ProcessOrders(Vehicle *v);
    00046 bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth = 0);
    00047 VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v);
    00048
    00049 void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int middle, int right);
    00050
    00051 #define MIN_SERVINT_PERCENT  5
    00052 #define MAX_SERVINT_PERCENT 90
    00053 #define MIN_SERVINT_DAYS    30
    00054 #define MAX_SERVINT_DAYS   800
    00055
    00063 uint16 GetServiceIntervalClamped(uint interval, CompanyID company_id);
    00064
    00065 #endif /* ORDER_FUNC_H */