mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Move ScriptStorage constructor into source file, so private members can have partially incomplete types.
parent
af14809697
commit
b9f4ef3d78
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
|
ScriptStorage::ScriptStorage() = default;
|
||||||
ScriptStorage::~ScriptStorage()
|
ScriptStorage::~ScriptStorage()
|
||||||
{
|
{
|
||||||
/* Free our pointers */
|
/* Free our pointers */
|
||||||
|
|
|
@ -36,53 +36,35 @@ typedef bool (ScriptAsyncModeProc)();
|
||||||
class ScriptStorage {
|
class ScriptStorage {
|
||||||
friend class ScriptObject;
|
friend class ScriptObject;
|
||||||
private:
|
private:
|
||||||
ScriptModeProc *mode; ///< The current build mode we are int.
|
ScriptModeProc *mode = nullptr; ///< The current build mode we are int.
|
||||||
class ScriptObject *mode_instance; ///< The instance belonging to the current build mode.
|
class ScriptObject *mode_instance = nullptr; ///< The instance belonging to the current build mode.
|
||||||
ScriptAsyncModeProc *async_mode; ///< The current command async mode we are in.
|
ScriptAsyncModeProc *async_mode = nullptr; ///< The current command async mode we are in.
|
||||||
class ScriptObject *async_mode_instance; ///< The instance belonging to the current command async mode.
|
class ScriptObject *async_mode_instance = nullptr; ///< The instance belonging to the current command async mode.
|
||||||
CompanyID root_company; ///< The root company, the company that the script really belongs to.
|
CompanyID root_company = INVALID_OWNER; ///< The root company, the company that the script really belongs to.
|
||||||
CompanyID company; ///< The current company.
|
CompanyID company = INVALID_OWNER; ///< The current company.
|
||||||
|
|
||||||
uint delay; ///< The ticks of delay each DoCommand has.
|
uint delay = 1; ///< The ticks of delay each DoCommand has.
|
||||||
bool allow_do_command; ///< Is the usage of DoCommands restricted?
|
bool allow_do_command = true; ///< Is the usage of DoCommands restricted?
|
||||||
|
|
||||||
CommandCost costs; ///< The costs the script is tracking.
|
CommandCost costs; ///< The costs the script is tracking.
|
||||||
Money last_cost; ///< The last cost of the command.
|
Money last_cost = 0; ///< The last cost of the command.
|
||||||
ScriptErrorType last_error{}; ///< The last error of the command.
|
ScriptErrorType last_error{}; ///< The last error of the command.
|
||||||
bool last_command_res; ///< The last result of the command.
|
bool last_command_res = true; ///< The last result of the command.
|
||||||
|
|
||||||
CommandDataBuffer last_data; ///< The last data passed to a command.
|
CommandDataBuffer last_data; ///< The last data passed to a command.
|
||||||
Commands last_cmd; ///< The last cmd passed to a command.
|
Commands last_cmd = CMD_END; ///< The last cmd passed to a command.
|
||||||
CommandDataBuffer last_cmd_ret; ///< The extra data returned by the last command.
|
CommandDataBuffer last_cmd_ret; ///< The extra data returned by the last command.
|
||||||
|
|
||||||
std::vector<int> callback_value; ///< The values which need to survive a callback.
|
std::vector<int> callback_value; ///< The values which need to survive a callback.
|
||||||
|
|
||||||
RoadType road_type; ///< The current roadtype we build.
|
RoadType road_type = INVALID_ROADTYPE; ///< The current roadtype we build.
|
||||||
RailType rail_type; ///< The current railtype we build.
|
RailType rail_type = INVALID_RAILTYPE; ///< The current railtype we build.
|
||||||
|
|
||||||
void *event_data; ///< Pointer to the event data storage.
|
void *event_data = nullptr; ///< Event queue for this script.
|
||||||
ScriptLogTypes::LogData log_data;///< Log data storage.
|
ScriptLogTypes::LogData log_data; ///< Log data storage.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScriptStorage() :
|
ScriptStorage();
|
||||||
mode (nullptr),
|
|
||||||
mode_instance (nullptr),
|
|
||||||
async_mode (nullptr),
|
|
||||||
async_mode_instance (nullptr),
|
|
||||||
root_company (INVALID_OWNER),
|
|
||||||
company (INVALID_OWNER),
|
|
||||||
delay (1),
|
|
||||||
allow_do_command (true),
|
|
||||||
/* costs (can't be set) */
|
|
||||||
last_cost (0),
|
|
||||||
last_command_res (true),
|
|
||||||
last_cmd (CMD_END),
|
|
||||||
/* calback_value (can't be set) */
|
|
||||||
road_type (INVALID_ROADTYPE),
|
|
||||||
rail_type (INVALID_RAILTYPE),
|
|
||||||
event_data (nullptr)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
~ScriptStorage();
|
~ScriptStorage();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue