From 2cfd2275df4639d7a29330726f5420e2432c63b1 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Sat, 26 Feb 2011 12:15:01 +0100 Subject: 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. --- src/scripting/lua.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/scripting/lua.cpp') 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; -- cgit v1.2.3-70-g09d2