@@ -25,6 +25,7 @@ distribution.
2525#pragma once
2626
2727#include " Console.h"
28+ #include " CoreDefs.h"
2829#include " Export.h"
2930#include " Hooks.h"
3031
@@ -76,31 +77,6 @@ namespace DFHack
7677 struct Hide ;
7778 }
7879
79- enum command_result
80- {
81- CR_LINK_FAILURE = -3 , // RPC call failed due to I/O or protocol error
82- CR_NEEDS_CONSOLE = -2 , // Attempt to call interactive command without console
83- CR_NOT_IMPLEMENTED = -1 , // Command not implemented, or plugin not loaded
84- CR_OK = 0 , // Success
85- CR_FAILURE = 1 , // Failure
86- CR_WRONG_USAGE = 2 , // Wrong arguments or ui state
87- CR_NOT_FOUND = 3 // Target object not found (for RPC mainly)
88- };
89-
90- enum state_change_event
91- {
92- SC_UNKNOWN = -1 ,
93- SC_WORLD_LOADED = 0 ,
94- SC_WORLD_UNLOADED = 1 ,
95- SC_MAP_LOADED = 2 ,
96- SC_MAP_UNLOADED = 3 ,
97- SC_VIEWSCREEN_CHANGED = 4 ,
98- SC_CORE_INITIALIZED = 5 ,
99- SC_BEGIN_UNLOAD = 6 ,
100- SC_PAUSED = 7 ,
101- SC_UNPAUSED = 8
102- };
103-
10480 class DFHACK_EXPORT PerfCounters
10581 {
10682 public:
@@ -244,7 +220,10 @@ namespace DFHack
244220
245221 PerfCounters perf_counters;
246222
247- lua_State* getLuaState () { return State; }
223+ lua_State* getLuaState (bool bypass_assertion = false ) {
224+ assert (bypass_assertion || isSuspended ());
225+ return State;
226+ }
248227
249228 private:
250229 DFHack::Console con;
@@ -400,9 +379,11 @@ namespace DFHack
400379 if (!owns_lock ())
401380 return ;
402381 /* Restore core owner to previous value */
403- core.ownerThread .store (tid, std::memory_order_release);
404382 if (tid == std::thread::id{})
405383 Lua::Core::Reset (core.getConsole (), " suspend" );
384+ core.ownerThread .store (tid, std::memory_order_release);
385+ // if (tid == std::thread::id{})
386+ // Lua::Core::Reset(core.getConsole(), "suspend");
406387 parent_t::unlock ();
407388 }
408389
0 commit comments