OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

script_storage.hpp
Go to the documentation of this file.
1 /* $Id: script_storage.hpp 26057 2013-11-23 13:12:19Z rubidium $ */
2
3 /*
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/>.
8 */
9
12 #ifndef SCRIPT_STORAGE_HPP
13 #define SCRIPT_STORAGE_HPP
14
15 #include "../signs_func.h"
16 #include "../vehicle_func.h"
17 #include "../road_type.h"
18 #include "../group.h"
19 #include "../goal_type.h"
20 #include "../story_type.h"
21
22 #include "table/strings.h"
23 #include <vector>
24
28 typedef bool (ScriptModeProc)();
29
33 class ScriptStorage {
34 friend class ScriptObject;
35 private:
36 ScriptModeProc *mode;
37 class ScriptObject *mode_instance;
38 CompanyID root_company;
39 CompanyID company;
40
41 uint delay;
42 bool allow_do_command;
43
44 CommandCost costs;
45 Money last_cost;
46 uint last_error;
47 bool last_command_res;
48
49 VehicleID new_vehicle_id;
50 SignID new_sign_id;
51 GroupID new_group_id;
52 GoalID new_goal_id;
53 StoryPageID new_story_page_id;
54 StoryPageID new_story_page_element_id;
55
56 std::vector<int> callback_value;
57
58 RoadType road_type;
59 RailType rail_type;
60
61 void *event_data;
62 void *log_data;
63
64 public:
65 ScriptStorage() :
66 mode (NULL),
67 mode_instance (NULL),
68 root_company (INVALID_OWNER),
69 company (INVALID_OWNER),
70 delay (1),
71 allow_do_command (true),
72 /* costs (can't be set) */
73 last_cost (0),
74 last_error (STR_NULL),
75 last_command_res (true),
76 new_vehicle_id (0),
77 new_sign_id (0),
78 new_group_id (0),
79 new_goal_id (0),
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),
85 event_data (NULL),
86 log_data (NULL)
87 { }
88
89 ~ScriptStorage();
90 };
91
92 #endif /* SCRIPT_STORAGE_HPP */