//
// Not-All TADS 2.2 Utility by Andrew Pontious C 1997
//

// A very simple utility that allows you to excuse as
// many objects as you want from the objects that are
// tapped when you use the word 'all' with a verb.

// Many programmers complain that it's too easy for a
// player to type in "take all" or "smell all" or
// any other verb and find out about all the objects
// in a room, since each object would normally either
// get taken or smelled or give an error message.

// They have gotten around that cheat by not allowing
// players to use 'all' with certain verbs, but then
// the players complain that their actions are too
// restricted.

// This will satisfy both camps. "Take all," "smell
// all," and the rest will work, but for whatever
// hidden or special objects the programmer doesn't
// want to call attention to, s/he can merely add
// defaultexception to the definition of that object,
// as in:
//
// specialsword: item, defaultexception
//
// and it will no longer respond to "all," though
// it can still be accessed by name just fine, and
// the object will in no other way be affected.

// I discovered this workaround when programming
// my game Small World in 1996. I hope it is
// useful to other programmers. Thanks!
//
// Andrew Pontious
// 3/97
// [email protected]


/* parse using normal TADS operators */
#pragma C-


class defaultexception: object
;

// AllFixer

/*
* Used by deepverb and others to delete the unwanted objects below
* from the words used for commands where you specify "___ all".
* Is called from the .doDefault property.
*/

AllFixer: function( inlist )
       {
       local counter, outlist := [];

       for( counter := 1; counter <= length( inlist ); counter++ )
           {
           if( not isclass( inlist[ counter ], defaultexception ))
               outlist := outlist + inlist[ counter ];
           }
       return( outlist );
       }

modify class deepverb

   doDefault( actor, prep, iobj ) =
       {
       return( AllFixer( inherited.doDefault( actor, prep, iobj )));
       }

   // ioDefault doesn't need to be modified, since you can't use 'all'
   // with an indirect object anyway.
;

// These verbs all have their own definitions for doDefault, which supersede
// deepverb's. So we have to add our change to them, too.

modify dropVerb

   doDefault( actor, prep, iobj ) =
       {
       return( AllFixer( inherited.doDefault( actor, prep, iobj )));
       }
;

modify putVerb

   doDefault( actor, prep, iobj ) =
       {
       return( AllFixer( inherited.doDefault( actor, prep, iobj )));
       }
;

modify takeVerb

   doDefault( actor, prep, iobj ) =
       {
       return( AllFixer( inherited.doDefault( actor, prep, iobj )));
       }
;

modify getOutVerb

   doDefault( actor, prep, iobj ) =
       {
       return( AllFixer( inherited.doDefault( actor, prep, iobj )));
       }
;

modify giveVerb

   doDefault( actor, prep, iobj ) =
       {
       return( AllFixer( inherited.doDefault( actor, prep, iobj )));
       }
;

modify showVerb

   doDefault( actor, prep, iobj ) =
       {
       return( AllFixer( inherited.doDefault( actor, prep, iobj )));
       }
;