View/Edit #1247:find_room

Switch to edit mode.

Name(s): find_room
1:  placeSubStr = args[1]
2:  timeToLive = `args[2] - 1 ! ANY => this.search_threshold'
3:  placesVisited = `args[3] ! ANY => {}'
4:  matches = `args[4] ! ANY => {}'
5:  startPlace = `args[5] ! ANY => this:start_search()'
6:  exitsSoFar = `args[6] ! ANY => {"exit listing unimplemented at this point"}'
7:  if (timeToLive <= 0)
8:    return {placesVisited, matches, exitsSoFar}
9:  elseif (length(placeSubStr) < 3)
10:   return E_INVARG
11: else
12:   newMatches = {}
13:   if (index(`startPlace:title() ! ANY => ""', placeSubStr) && !(startPlace in newMatches))
14:     newMatches = {@newMatches, startPlace}
15:   endif
16:   newExitList = {}
17:   for exit in (startPlace:exits())
18:     if (index(`exit.dest.name ! ANY => ""', placeSubStr) && !(exit.dest in newMatches))
19:       newMatches = {@newMatches, exit.dest}
20:     endif
21:     if (!`exit.dest in placesVisited ! ANY => 1' && `exit.name in {"north", "south", "east", "west", "northwest", "southwest", "northeast", "southeast"} ! ANY => 0')
22:       {placesVisited, matchesFound, newExits} = this:find_room(args[1], timeToLive, {@placesVisited, startPlace}, newMatches, exit.dest, {@exitsSoFar, exit})
23:       newExitList = newExits
24:       newMatches = {@newMatches, @matchesFound}
25:     endif
26:     $command_utils:suspend_if_needed(0)
27:   endfor
28:   return {$list_utils:remove_duplicates(placesVisited), $list_utils:remove_duplicates(newMatches), exitsSoFar}
29: endif
30: "Last modified by Avenger (#8219) on Mon Sep  9 22:47:29 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]