View/Edit #1247:path_between

Switch to edit mode.

Name(s): path_between
1:  "Copied from Room Database (#73):path_between by Slacker (#55) Sep  9 22:48:32 2002"
2:  "Copied from MattC (#9466):path_between Jun 12 19:26:06 1999"
3:  ":path_between(SRC, DEST, OBJ) => {exit1, exit2, ...}"
4:  ""
5:  "Determines a path from SRC room to DEST room for OBJ, if one exists.  Returns simply a list of exits or E_NACC if none exists."
6:  {src, dest, object} = args
7:  if (src == dest)
8:    return {}
9:  elseif (!valid(src) || !valid(dest))
10:   raise(E_INVARG)
11: endif
12: stack = {src}
13: pstack = {{}}
14: ostack = {}
15: opstack = {}
16: while (1)
17:   end = length(stack)
18:   ostack[1..0] = stack
19:   opstack[1..0] = pstack
20:   stack = {}
21:   pstack = {}
22:   for i in [1..end]
23:     o = ostack[i]
24:     path = opstack[i]
25:     for e in (`o:exits() ! ANY => {}')
26:       suspend(0)
27:       "      if ((($room_db:valid_exit(e) && $get_property(e, \"obvious\")) && `$call_verb(e, \"is_unlocked_for\", {object}) ! ANY') && `(d = `$call_verb(e, \"real_dest\", {}) ! ANY => $get_property(e, \"dest\")'):acceptable(object) ! ANY')"
28:       if (1)
29:         d = `$call_verb(e, "real_dest", {}) ! ANY => $get_property(e, "dest")'
30:         npath = {@path, e}
31:         if (d == dest)
32:           return npath
33:         endif
34:         if (!(d in ostack) && !(d in stack))
35:           stack[1..0] = {d}
36:           pstack[1..0] = {npath}
37:         endif
38:       endif
39:       $command_utils:suspend_if_needed()
40:     endfor
41:     $command_utils:suspend_if_needed()
42:   endfor
43:   if (!stack)
44:     return E_NACC
45:   endif
46: endwhile
47: "Last modified by Avenger (#8219) on Mon Sep  9 22:57:21 2002 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Avenger (#8219)

You are not logged in.

[home | help | who | search | setup | code]