OpenTTD
script_storage.hpp
Go to the documentation of this file.
1 /* $Id$ */
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 
34 friend class ScriptObject;
35 private:
37  class ScriptObject *mode_instance;
40 
41  uint delay;
43 
46  uint last_error;
48 
50  uint32 last_p1;
51  uint32 last_p2;
52  uint32 last_cmd;
53 
60 
61  std::vector<int> callback_value;
62 
65 
66  void *event_data;
67  void *log_data;
68 
69 public:
70  ScriptStorage() :
71  mode (NULL),
72  mode_instance (NULL),
73  root_company (INVALID_OWNER),
74  company (INVALID_OWNER),
75  delay (1),
76  allow_do_command (true),
77  /* costs (can't be set) */
78  last_cost (0),
79  last_error (STR_NULL),
80  last_command_res (true),
81  last_tile (INVALID_TILE),
82  last_p1 (0),
83  last_p2 (0),
84  last_cmd (CMD_END),
85  new_vehicle_id (0),
86  new_sign_id (0),
87  new_group_id (0),
88  new_goal_id (0),
89  new_story_page_id (0),
90  new_story_page_element_id(0),
91  /* calback_value (can't be set) */
92  road_type (INVALID_ROADTYPE),
93  rail_type (INVALID_RAILTYPE),
94  event_data (NULL),
95  log_data (NULL)
96  { }
97 
98  ~ScriptStorage();
99 };
100 
101 #endif /* SCRIPT_STORAGE_HPP */
void * event_data
Pointer to the event data storage.
ScriptModeProc * mode
The current build mode we are int.
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:29
VehicleID new_vehicle_id
The ID of the new Vehicle.
uint16 GoalID
ID of a goal.
Definition: goal_type.h:34
TileIndex last_tile
The last tile passed to a command.
flag for invalid roadtype
Definition: road_type.h:27
bool() ScriptModeProc()
The callback function for Mode-classes.
GroupID new_group_id
The ID of the new Group.
Common return value for all commands.
Definition: command_type.h:25
RoadType
The different roadtypes we support.
Definition: road_type.h:22
GoalID new_goal_id
The ID of the new Goal.
uint32 last_cmd
The last cmd passed to a command.
CompanyID root_company
The root company, the company that the script really belongs to.
bool allow_do_command
Is the usage of DoCommands restricted?
bool last_command_res
The last result of the command.
uint32 VehicleID
The type all our vehicle IDs have.
Definition: vehicle_type.h:18
RailType rail_type
The current railtype we build.
CommandCost costs
The costs the script is tracking.
uint32 last_p1
The last p1 passed to a command.
CompanyID company
The current company.
uint delay
The ticks of delay each DoCommand has.
std::vector< int > callback_value
The values which need to survive a callback.
uint16 GroupID
Type for all group identifiers.
Definition: group_type.h:15
StoryPageID new_story_page_id
The ID of the new StoryPage.
uint32 last_p2
The last p2 passed to a command.
class ScriptObject * mode_instance
The instance belonging to the current build mode.
void * log_data
Pointer to the log data storage.
RoadType road_type
The current roadtype we build.
Must ALWAYS be on the end of this list!! (period)
Definition: command_type.h:335
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
StoryPageID new_story_page_element_id
The ID of the new StoryPageElement.
uint last_error
The last error of the command.
Money last_cost
The last cost of the command.
uint16 SignID
The type of the IDs of signs.
Definition: signs_type.h:16
SignID new_sign_id
The ID of the new Sign.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:85
Flag for invalid railtype.
Definition: rail_type.h:36
Owner
Enum for all companies/owners.
Definition: company_type.h:20
The storage for each script.
uint16 StoryPageID
ID of a story page.
Definition: story_type.h:18
An invalid owner.
Definition: company_type.h:31