summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-02-26 12:15:01 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-09 01:24:24 +0100
commit2cfd2275df4639d7a29330726f5420e2432c63b1 (patch)
treeb9da3289d78d114c8a3ba3260291e0be4c914f4a /src/scripting
parent80f8af40b33b71f04ec71ff12cfbb2a21de61703 (diff)
downloadmanaserv-2cfd2275df4639d7a29330726f5420e2432c63b1.tar.gz
manaserv-2cfd2275df4639d7a29330726f5420e2432c63b1.tar.bz2
manaserv-2cfd2275df4639d7a29330726f5420e2432c63b1.tar.xz
manaserv-2cfd2275df4639d7a29330726f5420e2432c63b1.zip
Made the monster creation delayed, to avoid crashing.
Creation of monsters shouldn't be done during game state update. So we delay their insertion after the update to avoid a crash in debug builds and weird stuff happening in release builds. Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/lua.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 0189f8ed..70afc933 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -1011,11 +1011,7 @@ static int monster_create(lua_State *s)
Monster *q = new Monster(spec);
q->setMap(m);
q->setPosition(Point(x, y));
- if (!GameState::insertSafe(q))
- {
- LOG_WARN("Monster_Create failed to insert monster");
- return 0;
- }
+ GameState::enqueueInsert(q);
lua_pushlightuserdata(s, q);
return 1;