diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-02 18:32:22 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-02 22:54:16 +0200 |
commit | b93032e49cd69da178984f9912205d182f12f61e (patch) | |
tree | 2caae8f9db5776a39a731e8fb82ed30ec7fb6b06 /src/script.hpp | |
parent | 6abcd7d52cda334c58ec999d212491fc24f13c9d (diff) |
now call script update
Diffstat (limited to 'src/script.hpp')
-rw-r--r-- | src/script.hpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/script.hpp b/src/script.hpp index 5f657e28..b67553ec 100644 --- a/src/script.hpp +++ b/src/script.hpp @@ -1,4 +1,5 @@ #pragma once +#include "script-enums.hpp" #include "compat/defs.hpp" #include <memory> @@ -7,11 +8,6 @@ namespace floormat struct object; struct Ns; -enum class script_lifecycle : uint8_t -{ - no_init, initializing, created, destroying, torn_down, COUNT, -}; - struct base_script { fm_DECLARE_DELETED_COPY_ASSIGNMENT(base_script); @@ -23,19 +19,11 @@ struct base_script static StringView state_name(script_lifecycle x); }; -enum class script_destroy_reason : uint8_t -{ - quit, // game is being shut down - kill, // object is being deleted from the gameworld - unassign, // script is unassigned from object - COUNT, -}; - template<typename S, typename Obj> class Script final { S* ptr; - script_lifecycle state; + script_lifecycle _state; void _assert_state(script_lifecycle s, const char* file, int line); static S* make_empty(); @@ -55,7 +43,9 @@ public: // [torn-down] -> do_ensure_torn_down() -> [torn-down] // * -> do_error_unwind() -> [torn-down] // [torn-down] -> ~script() + // [no-init] -> ~script() // for tests + script_lifecycle state() const; S* operator->(); void do_create(S* ptr); |