diff options
author | glx22 <glx22@users.noreply.github.com> | 2019-09-07 18:37:01 +0200 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2019-09-07 17:37:01 +0100 |
commit | b3fd7879596defeb6af78acb4ea45e4418821bdf (patch) | |
tree | 08b94b2cd65012e573b0e8c94196daab5aab12ba /src/script/api/script_object.hpp | |
parent | 381c2a45875206afe43241d0c76619638cf613fc (diff) | |
download | openttd-b3fd7879596defeb6af78acb4ea45e4418821bdf.tar.xz |
Fix #7188: check the validity of command callback for scripts (#7701)
Diffstat (limited to 'src/script/api/script_object.hpp')
-rw-r--r-- | src/script/api/script_object.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/api/script_object.hpp b/src/script/api/script_object.hpp index 55dd5e39b..fba4b69f2 100644 --- a/src/script/api/script_object.hpp +++ b/src/script/api/script_object.hpp @@ -74,6 +74,16 @@ protected: static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = nullptr, Script_SuspendCallbackProc *callback = nullptr); /** + * Store the latest command executed by the script. + */ + static void SetLastCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd); + + /** + * Check if it's the latest command executed by the script. + */ + static bool CheckLastCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd); + + /** * Sets the DoCommand costs counter to a value. */ static void SetDoCommandCosts(Money value); |