script_storage.hpp

Go to the documentation of this file.
00001 /* $Id: script_storage.hpp 23632 2011-12-19 21:05:25Z truebrain $ */
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 SCRIPT_STORAGE_HPP
00013 #define SCRIPT_STORAGE_HPP
00014 
00015 #include "../signs_func.h"
00016 #include "../vehicle_func.h"
00017 #include "../road_type.h"
00018 #include "../group.h"
00019 #include "../goal_type.h"
00020 
00021 #include "table/strings.h"
00022 #include <vector>
00023 
00027 typedef bool (ScriptModeProc)();
00028 
00032 class ScriptStorage {
00033 friend class ScriptObject;
00034 private:
00035   ScriptModeProc *mode;             
00036   class ScriptObject *mode_instance; 
00037   CompanyID root_company;          
00038   CompanyID company;               
00039 
00040   uint delay;                      
00041   bool allow_do_command;           
00042 
00043   CommandCost costs;               
00044   Money last_cost;                 
00045   uint last_error;                 
00046   bool last_command_res;           
00047 
00048   VehicleID new_vehicle_id;        
00049   SignID new_sign_id;              
00050   GroupID new_group_id;            
00051   GoalID new_goal_id;              
00052 
00053   std::vector<int> callback_value; 
00054 
00055   RoadType road_type;              
00056   RailType rail_type;              
00057 
00058   void *event_data;                
00059   void *log_data;                  
00060 
00061 public:
00062   ScriptStorage() :
00063     mode              (NULL),
00064     mode_instance     (NULL),
00065     root_company      (INVALID_OWNER),
00066     company           (INVALID_OWNER),
00067     delay             (1),
00068     allow_do_command  (true),
00069     /* costs (can't be set) */
00070     last_cost         (0),
00071     last_error        (STR_NULL),
00072     last_command_res  (true),
00073     new_vehicle_id    (0),
00074     new_sign_id       (0),
00075     new_group_id      (0),
00076     /* calback_value (can't be set) */
00077     road_type         (INVALID_ROADTYPE),
00078     rail_type         (INVALID_RAILTYPE),
00079     event_data        (NULL),
00080     log_data          (NULL)
00081   { }
00082 
00083   ~ScriptStorage();
00084 };
00085 
00086 #endif /* SCRIPT_STORAGE_HPP */