diff --git a/nwn_script_comp.nim b/nwn_script_comp.nim index 6246b3c..c3aa8e8 100644 --- a/nwn_script_comp.nim +++ b/nwn_script_comp.nim @@ -150,16 +150,14 @@ proc serviceRmDemand(rm: ResMan, resref: ResRef, searchPath: seq[RMSearchPathEnt of pcFile: resContainerCache[q[1]] = newResFile(q[1]) else: continue containers.add resContainerCache[q[1]] + + containers &= rm.containers + for c in containers: - rm.add(c) - defer: - for c in containers: - rm.del(c) + if c.contains(resref): + return c.demand(resref).readAll - if not rm.contains(resref): - return "" - else: - return rm.demand(resref).readAll + return "" var chDemandResRef: Channel[tuple[ resref: ResRef,