summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-30 21:14:07 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-30 21:14:07 +0200
commit08214457a089264b3d8491bafcbbdcdbafb49e61 (patch)
treec59a3613d0bad34498dc95c84964d973f6876180
parent36611913651e26bcb580e7cca28b396a38a7f0fc (diff)
downloadmanaserv-08214457a089264b3d8491bafcbbdcdbafb49e61.tar.gz
manaserv-08214457a089264b3d8491bafcbbdcdbafb49e61.tar.bz2
manaserv-08214457a089264b3d8491bafcbbdcdbafb49e61.tar.xz
manaserv-08214457a089264b3d8491bafcbbdcdbafb49e61.zip
Made the monster removal not using queues to avoid a crash.
A race condition on the being pointer could happen when the being queue was highly requested. IMHO, using queues to add being but remove them directly is the way to go. Resolves: Mana-Mantis #384
-rw-r--r--src/scripting/lua.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 75a8ca2c..579ae13a 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -1156,14 +1156,14 @@ static int monster_change_anger(lua_State *s)
*/
static int monster_remove(lua_State *s)
{
- bool monsterEnqueued = false;
+ bool monsterRemoved = false;
Monster *m = getMonster(s, 1);
if (m)
{
- GameState::enqueueRemove(m);
- monsterEnqueued = true;
+ GameState::remove(m);
+ monsterRemoved = true;
}
- lua_pushboolean(s, monsterEnqueued);
+ lua_pushboolean(s, monsterRemoved);
return 1;
}