Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing parserm.h

SearchScope (lines 3679-3746)

3679  #Endif; ! TARGET_
3680   
3681  ! ----------------------------------------------------------------------------
3682  !  SearchScope  domain1 domain2 context
3683  !
3684  !  Works out what objects are in scope (possibly asking an outside routine),
3685  !  but does not look at anything the player has typed.
3686  ! ----------------------------------------------------------------------------
3687   
3688  [ SearchScope domain1 domain2 context i;
3689      i = 0;
3690      !  Everything is in scope to the debugging commands
3691   
3692      #Ifdef DEBUG;
3693      if (scope_reason == PARSING_REASON
3694          && LanguageVerbIsDebugging(verb_word)) {
3695   
3696          #Ifdef TARGET_ZCODE;
3697          for (i=selfobj : i<=top_object : i++)
3698              if (i ofclass Object && (parent(i) == 0 || parent(i) ofclass Object))
3699                  PlaceInScope(i);
3700          #Ifnot; ! TARGET_GLULX
3701          objectloop (i)
3702              if (i ofclass Object && (parent(i) == 0 || parent(i) ofclass Object))
3703                  PlaceInScope(i);
3704          #Endif; ! TARGET_
3705          rtrue;
3706      }
3707      #Endif; ! DEBUG
3708   
3709      ! First, a scope token gets priority here:
3710   
3711      if (scope_token ~= 0) {
3712          scope_stage = 2;
3713          if (indirect(scope_token) ~= 0) rtrue;
3714      }
3715   
3716      ! Next, call any user-supplied routine adding things to the scope,
3717      ! which may circumvent the usual routines altogether if they return true:
3718   
3719      if (actor == domain1 or domain2 && InScope(actor) ~= 0) rtrue;
3720   
3721      ! Pick up everything in the location except the actor's possessions;
3722      ! then go through those.  (This ensures the actor's possessions are in
3723      ! scope even in Darkness.)
3724   
3725      if (context == MULTIINSIDE_TOKEN && advance_warning ~= -1) {
3726          if (IsSeeThrough(advance_warning) == 1)
3727             ScopeWithin(advance_warning, 0, context);
3728      }
3729      else {
3730          if (domain1 ~= 0 && domain1 has supporter or container)
3731              ScopeWithin_O(domain1, domain1, context);
3732          ScopeWithin(domain1, domain2, context);
3733          if (domain2 ~= 0 && domain2 has supporter or container)
3734              ScopeWithin_O(domain2, domain2, context);
3735          ScopeWithin(domain2, 0, context);
3736      }
3737   
3738      ! A special rule applies:
3739      ! in Darkness as in light, the actor is always in scope to himself.
3740   
3741      if (thedark == domain1 or domain2) {
3742          ScopeWithin_O(actor, actor, context);
3743          if (parent(actor) has supporter or container)
3744              ScopeWithin_O(parent(actor), parent(actor), context);
3745      }
3746  ];


Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.