diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | data/scripts/libtmw.lua | 12 |
2 files changed, 15 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2007-08-29 Guillaume Melquiond <guillaume.melquiond@gmail.com> + + * data/scripts/libtmw.lua: Fixed race condition between quest_reply and + npc_next. + 2007-08-28 Guillaume Melquiond <guillaume.melquiond@gmail.com> * src/account-server/storage.hpp, src/account-server/dalstoragesql.hpp, 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. |