/[enigma]/enigma/data/levels/ralf_sokoban.lua
ViewVC logotype

Diff of /enigma/data/levels/ralf_sokoban.lua

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by reallysoft, Sun Mar 30 20:15:49 2003 UTC revision 1.8 by reallysoft, Thu Apr 10 22:03:08 2003 UTC
# Line 315  function is_in_restricted_area(p) Line 315  function is_in_restricted_area(p)
315     return 2 -- unknown     return 2 -- unknown
316  end  end
317    
318    maxoxyds = 999
319    
320  function install_oxyds(w,h) -- uses Nat's method (see nat7.lua)  function install_oxyds(w,h) -- uses Nat's method (see nat7.lua)
321     for x=1,w do     for x=1,w do
322        for y=1,h do        for y=1,h do
# Line 403  function install_oxyds(w,h) -- uses Nat' Line 405  function install_oxyds(w,h) -- uses Nat'
405     end     end
406    
407     -- delete superfluous oxyds     -- delete superfluous oxyds
408     while ((positions>triggers) or (mod(positions,2)==1)) do     while ((positions>triggers) or (positions>maxoxyds) or (mod(positions,2)==1)) do
409        tremove(position,random(1,positions));        tremove(position,random(1,positions));
410        positions = positions - 1        positions = positions - 1
411     end     end
# Line 412  function install_oxyds(w,h) -- uses Nat' Line 414  function install_oxyds(w,h) -- uses Nat'
414        error("No oxyds.")        error("No oxyds.")
415     end     end
416    
417       if (maxoxyds>positions) then
418          maxoxyds = positions
419       end
420    
421     -- now really set oxyds     -- now really set oxyds
422     for p=1,positions do     for p=1,positions do
423        local xd,yd = position[p][1],position[p][2]        local xd,yd = position[p][1],position[p][2]
# Line 486  end Line 492  end
492    
493  function play_sokoban(level,num)  function play_sokoban(level,num)
494     local w,h = get_map_size(level)     local w,h = get_map_size(level)
495     local tries = 100     local tries = 80
496     local ok = 0     local ok = 0
497    
498     while (tries > 0 and ok == 0) do     while ((tries > 0) and (maxoxyds > 0) and (ok == 0)) do
499        init(num-1)        init(num-1)
500        randomseed(enigma.GetTicks())        randomseed(enigma.GetTicks())
501        --   rs_create_world(level,cells,spacecell,spacecell)        --   rs_create_world(level,cells,spacecell,spacecell)
# Line 520  function play_sokoban(level,num) Line 526  function play_sokoban(level,num)
526        ok = correct_door_positions()        ok = correct_door_positions()
527        if (ok == 0) then debug("re-initializing.."); end        if (ok == 0) then debug("re-initializing.."); end
528        tries = tries - 1        tries = tries - 1
529          if (maxoxyds > 2) then
530             maxoxyds = maxoxyds - 1
531          end
532     end     end
533    
534     if (ok==0) then     if (ok==0) then

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26