1 /* $Id: script_storage.hpp 26057 2013-11-23 13:12:19Z rubidium $ */
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file script_storage.hpp Defines ScriptStorage and includes all files required for it. */
12 #ifndef SCRIPT_STORAGE_HPP
13 #define SCRIPT_STORAGE_HPP
15 #include "../signs_func.h"
16 #include "../vehicle_func.h"
17 #include "../road_type.h"
19 #include "../goal_type.h"
20 #include "../story_type.h"
22 #include "table/strings.h"
26 * The callback function for Mode-classes.
28 typedef bool (ScriptModeProc
)();
31 * The storage for each script. It keeps track of important information.
34 friend class ScriptObject
;
36 ScriptModeProc
*mode
; ///< The current build mode we are int.
37 class ScriptObject
*mode_instance
; ///< The instance belonging to the current build mode.
38 CompanyID root_company
; ///< The root company, the company that the script really belongs to.
39 CompanyID company
; ///< The current company.
41 uint delay
; ///< The ticks of delay each DoCommand has.
42 bool allow_do_command
; ///< Is the usage of DoCommands restricted?
44 CommandCost costs
; ///< The costs the script is tracking.
45 Money last_cost
; ///< The last cost of the command.
46 uint last_error
; ///< The last error of the command.
47 bool last_command_res
; ///< The last result of the command.
49 VehicleID new_vehicle_id
; ///< The ID of the new Vehicle.
50 SignID new_sign_id
; ///< The ID of the new Sign.
51 GroupID new_group_id
; ///< The ID of the new Group.
52 GoalID new_goal_id
; ///< The ID of the new Goal.
53 StoryPageID new_story_page_id
; ///< The ID of the new StoryPage.
54 StoryPageID new_story_page_element_id
; ///< The ID of the new StoryPageElement.
56 std::vector
<int> callback_value
; ///< The values which need to survive a callback.
58 RoadType road_type
; ///< The current roadtype we build.
59 RailType rail_type
; ///< The current railtype we build.
61 void *event_data
; ///< Pointer to the event data storage.
62 void *log_data
; ///< Pointer to the log data storage.
68 root_company (INVALID_OWNER
),
69 company (INVALID_OWNER
),
71 allow_do_command (true),
72 /* costs (can't be set) */
74 last_error (STR_NULL
),
75 last_command_res (true),
80 new_story_page_id (0),
81 new_story_page_element_id(0),
82 /* calback_value (can't be set) */
83 road_type (INVALID_ROADTYPE
),
84 rail_type (INVALID_RAILTYPE
),
92 #endif /* SCRIPT_STORAGE_HPP */