summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-29 05:41:34 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-29 05:41:34 +0000
commitc02585787deadc6ef738239b72512d787a7abc62 (patch)
treeb8af9164b774f49fe5ed47747b6260f717c85e65 /data
parente678c7cc1574d5739f83da2b0d493b44e3a7a42e (diff)
downloadmanaserv-c02585787deadc6ef738239b72512d787a7abc62.tar.gz
manaserv-c02585787deadc6ef738239b72512d787a7abc62.tar.bz2
manaserv-c02585787deadc6ef738239b72512d787a7abc62.tar.xz
manaserv-c02585787deadc6ef738239b72512d787a7abc62.zip
Fixed race condition between quest_reply and npc_next.
Diffstat (limited to 'data')
-rw-r--r--data/scripts/libtmw.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/data/scripts/libtmw.lua b/data/scripts/libtmw.lua
index 3189da6a..b2c22c68 100644
--- a/data/scripts/libtmw.lua
+++ b/data/scripts/libtmw.lua
@@ -131,9 +131,17 @@ end
-- Checks that the NPC expects it, and processes the respective coroutine.
function npc_next(npc, ch)
local w = states[ch]
- if not (w and w[1] == npc and w[3] == 1 and process_npc(w)) then
- states[ch] = nil
+ if w then
+ local w3 = w[3]
+ if w3 == 4 then
+ w[3] = 3
+ return
+ end
+ if w3 == 1 and process_npc(w) then
+ return
+ end
end
+ states[ch] = nil
end
-- Called by the game whenever a player selects a particular reply.