# ai_storage.hpp

Go to the documentation of this file.

    00001 /* $Id$ */
    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 AI_STORAGE_HPP
    00013 #define AI_STORAGE_HPP
    00014
    00015 #include "../signs_func.h"
    00016 #include "../vehicle_func.h"
    00017 #include "../road_type.h"
    00018 #include "../group.h"
    00019
    00020 #include "table/strings.h"
    00021 #include <vector>
    00022
    00026 typedef bool (AIModeProc)();
    00027
    00031 class AIStorage {
    00032 friend class AIObject;
    00033 private:
    00034   AIModeProc *mode;
    00035   class AIObject *mode_instance;
    00036
    00037   uint delay;
    00038   bool allow_do_command;
    00039
    00040   CommandCost costs;
    00041   Money last_cost;
    00042   uint last_error;
    00043   bool last_command_res;
    00044
    00045   VehicleID new_vehicle_id;
    00046   SignID new_sign_id;
    00047   TileIndex new_tunnel_endtile;
    00048   GroupID new_group_id;
    00049
    00050   std::vector<int> callback_value;
    00051
    00052   RoadType road_type;
    00053   RailType rail_type;
    00054
    00055   void *event_data;
    00056   void *log_data;
    00057
    00058 public:
    00059   AIStorage() :
    00060     mode              (NULL),
    00061     mode_instance     (NULL),
    00062     delay             (1),
    00063     allow_do_command  (true),
    00064     /* costs (can't be set) */
    00065     last_cost         (0),
    00066     last_error        (STR_NULL),
    00067     last_command_res  (true),
    00068     new_vehicle_id    (0),
    00069     new_sign_id       (0),
    00070     new_tunnel_endtile(INVALID_TILE),
    00071     new_group_id      (0),
    00072     /* calback_value (can't be set) */
    00073     road_type         (INVALID_ROADTYPE),
    00074     rail_type         (INVALID_RAILTYPE),
    00075     event_data        (NULL),
    00076     log_data          (NULL)
    00077   { }
    00078
    00079   ~AIStorage();
    00080 };
    00081
    00082 #endif /* AI_STORAGE_HPP */