script_storage.hpp

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