diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-04-27 23:05:34 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-04-27 23:05:34 +0200 |
commit | 8418c7ba9a8528e6491903e532ae8bc4a3ffa223 (patch) | |
tree | 1d252b740b0f919da888edcadc599bbde8d545c9 /source/Root.cpp | |
parent | Noise3D: Fixed composition when reusing the buffer (caused chopped trees) (diff) | |
download | cuberite-8418c7ba9a8528e6491903e532ae8bc4a3ffa223.tar cuberite-8418c7ba9a8528e6491903e532ae8bc4a3ffa223.tar.gz cuberite-8418c7ba9a8528e6491903e532ae8bc4a3ffa223.tar.bz2 cuberite-8418c7ba9a8528e6491903e532ae8bc4a3ffa223.tar.lz cuberite-8418c7ba9a8528e6491903e532ae8bc4a3ffa223.tar.xz cuberite-8418c7ba9a8528e6491903e532ae8bc4a3ffa223.tar.zst cuberite-8418c7ba9a8528e6491903e532ae8bc4a3ffa223.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Root.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/Root.cpp b/source/Root.cpp index ea33afe7e..1e7f48cc9 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -349,6 +349,18 @@ bool cRoot::ForEachWorld(cWorldListCallback & a_Callback) void cRoot::TickWorlds(float a_Dt) { + // Execute any pending commands: + AStringVector PendingCommands; + { + cCSLock Lock(m_CSPendingCommands); + std::swap(PendingCommands, m_PendingCommands); + } + for (AStringVector::iterator itr = PendingCommands.begin(), end = PendingCommands.end(); itr != end; ++itr) + { + DoExecuteConsoleCommand(*itr); + } + + // Tick the worlds: for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) { itr->second->Tick(a_Dt); @@ -361,6 +373,17 @@ void cRoot::TickWorlds(float a_Dt) void cRoot::ExecuteConsoleCommand(const AString & a_Cmd) { + // Put the command into a queue (Alleviates FS #363): + cCSLock Lock(m_CSPendingCommands); + m_PendingCommands.push_back(a_Cmd); +} + + + + + +void cRoot::DoExecuteConsoleCommand(const AString & a_Cmd) +{ LOG("Executing console command: \"%s\"", a_Cmd.c_str()); m_Server->ExecuteConsoleCommand(a_Cmd); |