diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-04-19 00:53:30 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-06-01 21:35:13 +0200 |
commit | 1c0ba07c3cb4f393b56063e2d631fbb2d73219b1 (patch) | |
tree | 899bd53ad86d592f8cc0ff5c5e29214f9d243619 /src/script/script_instance.hpp | |
parent | 764497206ab9457ab5dff3ea7851546da9259cc4 (diff) | |
download | openttd-1c0ba07c3cb4f393b56063e2d631fbb2d73219b1.tar.xz |
Add: [Script] Native priority queue; useful e.g. for pathfinders.
Diffstat (limited to 'src/script/script_instance.hpp')
-rw-r--r-- | src/script/script_instance.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/script/script_instance.hpp b/src/script/script_instance.hpp index e5024c80b..c097e0eb7 100644 --- a/src/script/script_instance.hpp +++ b/src/script/script_instance.hpp @@ -200,6 +200,17 @@ public: size_t GetAllocatedMemory() const; + /** + * Indicate whether this instance is currently being destroyed. + */ + inline bool InShutdown() const { return this->in_shutdown; } + + /** + * Decrease the ref count of a squirrel object. + * @param obj The object to release. + **/ + void ReleaseSQObject(HSQOBJECT *obj); + protected: class Squirrel *engine; ///< A wrapper around the squirrel vm. const char *versionAPI; ///< Current API used by this script. @@ -242,6 +253,7 @@ private: 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) |