mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-23 04:04:09 +01:00
Codechange: initialise instance members
This commit is contained in:
@@ -29,12 +29,6 @@ static const int MAX_GET_SETTING_OPS = 100000;
|
||||
/** All static information from an Script like name, version, etc. */
|
||||
class ScriptInfo : public SimpleCountedObject {
|
||||
public:
|
||||
ScriptInfo() :
|
||||
engine(nullptr),
|
||||
version(0),
|
||||
scanner(nullptr)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Get the Author of the script.
|
||||
*/
|
||||
@@ -136,23 +130,23 @@ public:
|
||||
virtual bool IsDeveloperOnly() const { return false; }
|
||||
|
||||
protected:
|
||||
class Squirrel *engine; ///< Engine used to register for Squirrel.
|
||||
HSQOBJECT SQ_instance; ///< The Squirrel instance created for this info.
|
||||
ScriptConfigItemList config_list; ///< List of settings from this Script.
|
||||
class Squirrel *engine = nullptr; ///< Engine used to register for Squirrel.
|
||||
HSQOBJECT SQ_instance{}; ///< The Squirrel instance created for this info.
|
||||
ScriptConfigItemList config_list{}; ///< List of settings from this Script.
|
||||
|
||||
private:
|
||||
std::string main_script; ///< The full path of the script.
|
||||
std::string tar_file; ///< If, which tar file the script was in.
|
||||
std::string author; ///< Author of the script.
|
||||
std::string name; ///< Full name of the script.
|
||||
std::string short_name; ///< Short name (4 chars) which uniquely identifies the script.
|
||||
std::string description; ///< Small description of the script.
|
||||
std::string date; ///< The date the script was written at.
|
||||
std::string instance_name; ///< Name of the main class in the script.
|
||||
int version; ///< Version of the script.
|
||||
std::string url; ///< URL of the script.
|
||||
std::string main_script{}; ///< The full path of the script.
|
||||
std::string tar_file{}; ///< If, which tar file the script was in.
|
||||
std::string author{}; ///< Author of the script.
|
||||
std::string name{}; ///< Full name of the script.
|
||||
std::string short_name{}; ///< Short name (4 chars) which uniquely identifies the script.
|
||||
std::string description{}; ///< Small description of the script.
|
||||
std::string date{}; ///< The date the script was written at.
|
||||
std::string instance_name{}; ///< Name of the main class in the script.
|
||||
int version = 0; ///< Version of the script.
|
||||
std::string url{}; ///< URL of the script.
|
||||
|
||||
class ScriptScanner *scanner; ///< ScriptScanner object that was used to scan this script info.
|
||||
class ScriptScanner *scanner = nullptr; ///< ScriptScanner object that was used to scan this script info.
|
||||
};
|
||||
|
||||
void Script_CreateDummyInfo(HSQUIRRELVM vm, const char *type, const char *dir);
|
||||
|
||||
@@ -49,18 +49,7 @@ static void PrintFunc(bool error_msg, const std::string &message)
|
||||
ScriptController::Print(error_msg, message);
|
||||
}
|
||||
|
||||
ScriptInstance::ScriptInstance(const char *APIName) :
|
||||
engine(nullptr),
|
||||
controller(nullptr),
|
||||
storage(nullptr),
|
||||
instance(nullptr),
|
||||
is_started(false),
|
||||
is_dead(false),
|
||||
is_save_data_on_stack(false),
|
||||
suspend(0),
|
||||
is_paused(false),
|
||||
in_shutdown(false),
|
||||
callback(nullptr)
|
||||
ScriptInstance::ScriptInstance(const char *APIName)
|
||||
{
|
||||
this->storage = new ScriptStorage();
|
||||
this->engine = new Squirrel(APIName);
|
||||
|
||||
@@ -252,8 +252,8 @@ public:
|
||||
void ReleaseSQObject(HSQOBJECT *obj);
|
||||
|
||||
protected:
|
||||
class Squirrel *engine; ///< A wrapper around the squirrel vm.
|
||||
std::string versionAPI; ///< Current API used by this script.
|
||||
class Squirrel *engine = nullptr; ///< A wrapper around the squirrel vm.
|
||||
std::string versionAPI{}; ///< Current API used by this script.
|
||||
|
||||
/**
|
||||
* Register all API functions to the VM.
|
||||
@@ -284,18 +284,18 @@ protected:
|
||||
virtual void LoadDummyScript() = 0;
|
||||
|
||||
private:
|
||||
class ScriptController *controller; ///< The script main class.
|
||||
class ScriptStorage *storage; ///< Some global information for each running script.
|
||||
SQObject *instance; ///< Squirrel-pointer to the script main class.
|
||||
class ScriptController *controller = nullptr; ///< The script main class.
|
||||
class ScriptStorage *storage = nullptr; ///< Some global information for each running script.
|
||||
SQObject *instance = nullptr; ///< Squirrel-pointer to the script main class.
|
||||
|
||||
bool is_started; ///< Is the scripts constructor executed?
|
||||
bool is_dead; ///< True if the script has been stopped.
|
||||
bool is_save_data_on_stack; ///< Is the save data still on the squirrel stack?
|
||||
int suspend; ///< The amount of ticks to suspend this script before it's allowed to continue.
|
||||
bool is_paused; ///< Is the script paused? (a paused script will not be executed until unpaused)
|
||||
bool in_shutdown; ///< Is this instance currently being destructed?
|
||||
Script_SuspendCallbackProc *callback; ///< Callback that should be called in the next tick the script runs.
|
||||
size_t last_allocated_memory; ///< Last known allocated memory value (for display for crashed scripts)
|
||||
bool is_started = false; ///< Is the scripts constructor executed?
|
||||
bool is_dead = false; ///< True if the script has been stopped.
|
||||
bool is_save_data_on_stack = false; ///< Is the save data still on the squirrel stack?
|
||||
int suspend = 0; ///< The amount of ticks to suspend this script before it's allowed to continue.
|
||||
bool is_paused = false; ///< Is the script paused? (a paused script will not be executed until unpaused)
|
||||
bool in_shutdown = false; ///< Is this instance currently being destructed?
|
||||
Script_SuspendCallbackProc *callback = nullptr; ///< Callback that should be called in the next tick the script runs.
|
||||
size_t last_allocated_memory = 0; ///< Last known allocated memory value (for display for crashed scripts)
|
||||
|
||||
/**
|
||||
* Call the script Load function if it exists and data was loaded
|
||||
|
||||
Reference in New Issue
Block a user