*
* Modification History
*
* Where a contibutor's code has been included, the contributor's
* name appears in an accompanying comment.
*
* When someone reports a bug and I fix it, I now label the explanation
* of the fix in the modification history with the bug reporter's name.
*
* If you have contributed and I have left your name off, send me
* mail and I'll add you.  I do not intened to slight anyone, but
* I do make mistakes.
*
* Initials:
*      dmb     David M. Baggett
*      djh     David Haire
*
*-------------------------------------------------------------------------
*
*  9-Nov-93    dmb     Started.
* 16-Feb-94    dmb     Deemed worthy of "version 1.0" monnicker.
* 28-Feb-94    dmb     Got rid of vocabulary in classes.  Having them
*                      there confuses the disambiguator, thereby
*                      causing "Which button do you mean, the launch button,
*                      or the launch button?" type problems.
* 13-Mar-94    dmb     Extended verb requirements to include prep.
*  1-Jun-94    dmb     Changed listcontentsX -- added "alwaysname" method
*                      to listable sounds, etc. so that things that
*                      don't appear in visual listings can still be
*                      named (instead of being referred to as "something").
* 22-Aug-94    dmb     A few minor bugs fixed.
*  5-Sep-94    dmb     Added 'inside' and 'outside' to inPrep and outPrep.
*                      Added doEnter and doExit to Chair and Ledge.
*                      Added _here_ parameter to listcontentsX to fix
*                      bug with Nestedroom.
*  6-Sep-94    dmb     Changed the definition of doDefault and ioDefault
*                      in Verb to handle Nestedrooms better.
*                      Updated some verb's vocabulary to extend the set of
*                      prepositions allowed.  (E.g.: lookinVerb)
*  7-Sep-94    dmb     Added global.searchisexamine.
* 13-Sep-94    dmb     Revised Chair and Stool again.
* 18-Sep-94    dmb     Moved some code from init to userinit. This code
*                      handles the standard game start tasks, like
*                      printing the room description for the player's
*                      initial location.  The old code didn't work with
*                      initial locations that were Nestedrooms -- the
*                      new code does.
*
*                      As a result, the procedure now is to *replace*
*                      userpreinit and userinit -- before they weren't
*                      provided at all.  Second, there is no requirement
*                      that the starting location be called "startroom";
*                      the default userinit routine just looks at the
*                      location, locationtype, and position fields of
*                      Me to figure out where the player starts out.
*                      [v1.1]
* 24-Sep-94    dmb     Added doAction = 'Lock' to lockVerb.
*                      Added doAction = 'Unlock' to unlockVerb.
*                      Changed "I can't imagine what you're referring to."
*                      in Verb.cantReach to "You don't know what that is."
*                      Changed Thing.isknownto slightly.
*                      Changed Player.passgen to better handle "actor, take
*                      item from me" and related commands.
*                      Added allowedverbs to Distant.
*                      Added roomdescprop to Ground, Walls, and Ceiling.
*                      Fixed bugs in Attachpoint that prevented plugable
*                      and tieable from working properly.
*                      Put commas in lists where necessary to disambiguate
*                      & operator, for TADS 2.2.
*                      [v1.1.1]
* 28-Sep-94    dmb     Removed no-longer-needed XOuthide function.
*                      Debugverbs are now disabled unless global.playtesting
*                      is set to true.  Cleaned up the standard Debugverbs
*                      a bit.
*                      Updated maxinlist and mininlist to return nil when
*                      given an empty list or nil.
*                      Improved comments in the first third of the file.
*                      [v1.1.2]
*  1-Oct-94    dmb     Added code to print "(trying to ___ the ___ first)"
*                      when a verb requirement fails.  E.g.,:
*
*                              >eat key
*                              (trying to take the key first)
*
*                              The key is stuck in the lock.
*
*                      [v1.1.3]
* 11-Oct-94    dmb     Separated out most of the code in die and moved
*                      it to end, which is useful for demos, where you
*                      have to end the game, but not because of player
*                      death.
* 12-Oct-94    dmb     Spell-checked all double quoted text and fixed
*                      the typos.
*
*                      Added a check for global.silentincscore to incscore.
*                      By setting global.silentincscore to true, you can
*                      disable the WorldClass default behavior, which is
*                      to tell the player when his score has gone up.
*
*                      Made changes to allow footnotes with predefined
*                      numbers (i.e., hardcoded footnum values) to
*                      coexist peacefully with footnotes numbered at
*                      run-time.  (Previously, the run-time footnote
*                      number could assign a number that was already used
*                      by a "hand-numbered" footnote.)
*
*                      Added methods smellaround, listenaround and
*                      feelaround to Room.  Nestedroom overrides these.
*                      These are called when the player types "smell"
*                      "listen" and "feel" (or "feel around") without
*                      a direct object.  This change fixes a bug, where
*                      listable sounds etc. would not get listed if
*                      the player "listen"'ed while in/on a Nestedroom.
*
*                      Added new class Floor, for use when you want
*                      to do something fancy with the floor that Ground
*                      can't handle.  Ground now inherits from Floor.
*                      Added roomdescprop to Everywhere.
*
*                      Nestedroom now passes ground, ceiling, and walls
*                      methods to its parent location.  I.e., Nestedrooms
*                      have the same ground, ceiling, and walls as their
*                      containing Rooms.
*                      [v1.1.4]
* 16-Oct-94    dmb     Fixed a bug where "if (isclass(obj, Floor))"
*                      was run in verDoTakeX even if obj was nil.
*                      Corrected bogus reference to global.turnsofar.
*                      Changed note function to return the empty
*                      string so it can be used in <<...>> expressions
*                      within double quotes.
*                      [v1.1.5]
* 25-Oct-94    dmb     Added verDoBreak to Thing.  Fixed a typo in
*                      Thing.verIoCleanwith. [Tom Koelman]
*                      [v1.1.6]
*  2-Nov-94    dmb     Fixed a typo in Ledge.doEnter. [Duncan Anker]
*  5-Nov-94    dmb     Added eatdesc to Edible.
*                      Added pullable and moveable to Switch.
*                      Added &cantouch to global.senses -- this is
*                      the list of senses used when an action fails,
*                      so that WorldClass can say "(trying to X the Y)"
*                      to let the player know which "atomic" action
*                      failed.
*                      Added a clause to Item.doTake to allow the
*                      command "take X" or "take X <prep> Y" when the
*                      actor already has the Item, but the Item is not
*                      in the player's top level contents (i.e., not
*                      merely in a container the actor's carrying).
*
*                      *** Last version for TADS 2.1 ***
*
*                      [v1.1.7]
*  6-Nov-94    dmb     Changed Room.statusLine to elide status lines
*                      that are longer than global.statuslinewidth
*                      with an ellipsis.
*                      Added [ver]DoClose [ver]DoOpen to Desk.
*                      [v1.1.8]
*  7-Nov-94    dmb     Added check for obj = nil in Thing.blocksreach.
*                      Added actor parameter to Edible.eatdesc.
*                      Further revised Edible, and similarly revised
*                      Drinkable.
*                      Added multisdesc to Thing -- this just prints
*                      the sdesc text highlighted.
*                      Added #pragma C- at top of file.
*                      Added any = either to specialWords.
*                      Added Thing.construct and Thing.destruct to
*                      support dynamic objects.
*  9-Nov-94    dmb     Removed actor parameter from message printed
*                      by Thing.verDoLookon to eliminate incorrect
*                      reflexives.
*                      Added to comment preceding Desk.
*                      Cleaned up Verb.checkCommon a bit.
*                      Corrected capitalization error in
*                      swVerb. [Paul Gilbert]
* 11-Nov-94    dmb     Created CASE_INSENSITIVE flag.  (But you can't
*                      actually compile this file in case insensitive
*                      mode yet.)
*
*                      Added support for indistinguishable objects:
*                      - Thing.listprops ........ created
*                      - Thing.listdesc ......... modified
*                      - Thing.listpluraldesc ... created
*                      - Thing.pluraldesc ....... created
*                      - listcontentsX .......... modified
*                      - indistinguishable ...... created
*                      - saynum ................. created
*
*                      NOTE: Users must override pluraldesc for
*                      words like "box", "watch", etc. whose plurals
*                      are not formed by appending an "s".
*
*                      Two Things are indistinguishable (and will hence
*                      be listed as a unit with prepended number) if
*                      both have the same immediate superclass and
*                      both have isequivalent set to true.  (Actually,
*                      it's not quite this simple -- look at the
*                      indistinguishable function for details.)
*
*                      NOTE: There seems to be a bug in TADS that prevents
*                      the new code from being very useful.  So don't
*                      expect it to work right just yet.
*
*                      Removed old listcontents code.  (This code is now
*                      archived in the 1.1.7 freeze code.)
*                      Added a comment explaining Thing.seecontX and related
*                      methods.
*                      [v1.2.0]
* 12-Nov-94    dmb     Added nondeterministic = true to global to make
*                      the random number functions really random by
*                      default.
*
*                      New feature: You can now use Thing.movingout and
*                      Thing.movingin to monitor movement of objects
*                      in and out of containers.  This makes it
*                      easy to define, for example, a magic box that
*                      curses every item moved into it (by any means),
*                      or a pedestal that triggers a trap when enough
*                      weight is taken off of it.
*
*                      Note also that Thing.moveinto now returns a
*                      boolean indicating whether or not it succeeded.
*                      This is just for robustness; you should not
*                      have moveinto fail for any reason but an error.
*
*                      Implementing this feature involved the following
*                      changes:
*
*                      - Thing.movingin ............ created
*                      - Thing.movingout ........... created
*                      - Thing.moveinto ............ modifie
*                      - Thing.notifycontainers .... created
*                      - Holder.ioPutX ............. modified
*                      - Attachable.moveinto ....... modified
*                      - Attachable.doAttachto ..... modified
*                      - Clothing.moveinto ......... modified
*                      - Clothing.doWear ........... modified
*                      - Actor.moveinto ............ modified
*                      - Chair, Ledge, Stool:
*                           doEnter, doGeton ....... modified
*
*                      Added verDoLock and verDoUnlock to Thing.
*                      Changed the Lockable class to support these
*                      new methods.  IMPORTANT:  Previously, setting
*                      key = nil in Lockable meant that the Lockable
*                      could not be unlocked or locked.  Now this
*                      means that the Lockable *can* be locked and
*                      unlocked, and without any key.
*                      [v1.3.0]
* 13-Nov-94    dmb     Fixed a bug in Thing.construct. [Mike Roberts]
* 15-Nov-94    dmb     Fixed verSouthwest -> verGoSouthwest and
*                      verDown -> verGoDown.
* 19-Nov-94    dmb     Fixed a typo in Actor.speech_handler.
*                      [Adam Thornton]
* 21-Nov-94    dmb     Fixed a serious bug in Thing.moveinto.
*                      [v1.3.1]
*  7-Jan-95    dmb     Moved meat of preparse into WorldClassPreparse.
*                      [v1.3.2]
* 10-Feb-95    dmb     Added call to upper() in indistinguishable
*                      to make the comparison ignore case.
*                      [Carl Muckenhoupt].  [v1.3.3]
*  2-May-95    dmb     Trivial change to warnsave for better formatting.
*                      [v1.3.4]
* 25-Apr-96    dmb     Typo in Door fixed. [v1.3.5]
* 15-Nov-96    dmb     Fixed a bug in Clothing.doWear. [Patrick Kellum]
*                      [v1.3.6]
*  7-Apr-97    dmb   Fixed a typo affected doors that can be locked with
*                no key.  [Shay Caron]
* 21-Jul-98    djh     Unofficially took over maintenance from dmb.
*                      Fixed a bug in listcontentsX that listed more than
*                      one indistinguishable item with 'is here.' if nothing
*                      else was listed in the room.
* 25-Jul-98    djh     It's now official.
*                      Fixed another bug in listcontentsX. If there were more
*                      than one set of indistinguishable items to be listed,
*                      they were being listed with the wrong quantities.
*                      [v1.3.7]
*  2-Aug-98    djh     Replaced all occurrences of 'Me' with the TADS
*                      2.2.4 function parserGetMe().
*                      Added new functions initRestore() and initCommon(). Any
*                      game-specific initialisation should be placed in
*                      initCommon() rather than in userinit(). Note that
*                      contrary to the TADS release notes, initRestore() is
*                      called AFTER init() rather than instead of it, unless the
*                      game is compiled with the '-ds' option.
*                      Moved code from userinit() into gameinit(). All
*                      userinit() does now is call gameinit(). If you replace
*                      userinit(), you should ensure that your replacement
*                      either calls gameinit() or provides the same
*                      functionality.
*                      Moved code from restoreVerb.soloaction into
*                      mainRestore(). This function is called both by the
*                      restore command and when a save game is specified on the
*                      command line.
*                      Added HTML enabling hook to init().
*                      Modified Room.statusLine for HTML compatibility.
*  7-Aug-98    djh     Added version tracking information to the library.
*                      [Jeff Laing]
*                      All WorldClass extension modules should contain an entry
*                      called xxxVersion, where xxx is a unique identifier for
*                      the extension module. This should have a class of
*                      versionTag, and should contain three properties:
*                              id: A double-quoted string giving the module's
*                              version and date.
*                              author: The name of the person who created the
*                              module.
*                              func: A short description or title of the module.
*                      The versionTag for the version tracking routines has been
*                      included in WorldClass, so you can use that as a
*                      template.
*                      Added direction lists to global to enable modules such as
*                      'actors' and 'goto' to access them without having to
*                      ensure that they are defined. Useful if you want to
*                      include both of these modules.
*                      Added global.justTesting. Functions that call verGoX and
*                      goX direction methods in order to determine if travel is
*                      possible in a certain direction should set this flag to
*                      'true', and reset it to 'nil' when finished. Direction
*                      methods (goX) should check the value of
*                      global.justTesting before modifying the game state in any
*                      other manner than moving the actor to a new location.
*                      Added the autosave function that was written by Paul
*                      Gilbert. This routine replaces the warnsave function.
*                      By default, autosave will be off. It can be turned on/off
*                      with the command 'autosave on' or 'autosave off', and the
*                      time between saves can be set with 'autosave xx', where
*                      xx is the number of WorldClass ticks between saves. It
*                      will ask for a filename the first time, and then use that
*                      continually.
*                      Added 'look out of' and 'look out' to the verb list for
*                      lookthroughVerb.
* 11-Aug-98    djh     Added HTML hook to change the display colors when
*                      the player enters a particular room. The property
*                      'bgcolor' controls the background color in each room, and
*                      the property 'textcolor' controls the foreground color.
*                      If one of these properties is not defined, the relevant
*                      default color will be used.
*                      Fixed bug in Item.verDoPutX that returned an "object
*                      required" error if the player entered "put" with no
*                      direct or indirect objects. [Shay Caron]
*                      Fixed bug in Ledge that prevented you from lying on the
*                      ledge if you were already sitting on it, and vice versa.
*                      [Shay Caron]
*                      Fixed bug in Floor that told the player "You can't get
*                      off of (the player's location)." when he or she was
*                      standing and tried to get on the ground. [Shay Caron]
*                      Corrected typo in verDoAskFor that printed the indirect
*                      object in "You can't ask (x) for anything." (Should be
*                      the direct object). [Shay Caron]
*                      Fixed bug in 'give x to y' which produced the message
*                      "You can't do that, because you can't put anything the
*                      (y)." (Missing preposition)
* 13-Aug-98    djh     Added code to prevent the room description from
*                      being displayed by actor.travelto(room) unless the actor
*                      doing the travelling is the player (parserGetMe()).
*                      [Jason Noble]
*                      Added commandPrompt() and commandAfterRead() functions.
*                      All the former does at present is turn emboldening on and
*                      display the '>' prompt before the command is entered, and
*                      the latter turns emboldening off again after the command
*                      has been entered. Replace these functions with your own
*                      as required.
*                      Rewrote the initRestore() routine so that it will not
*                      duplicate work performed by init() if it is called after
*                      init(). The property global.initcalled is used to check
*                      whether the init() function has been called. When the
*                      runtime is fixed so that initRestore() is called instead
*                      of init() when a saved game is specified on the command
*                      line, this property may be used to determine whether a
*                      saved game was restored at startup, if required
*                      (initcalled will be nil).
* 19-Aug-98    djh     Added preparseCmd function. This function simply
*                      calls another function (WorldClassPreparseCmd), which
*                      will convert commands in the form "tell <actor> to
*                      <command>" and "ask <actor> to <command>" to the standard
*                      format "<actor>,<command>". To include your own code in
*                      preparseCmd, simply replace it and call
*                      WorldClassPreparseCmd after your code.
* 20-Aug-98    djh     Fixed minor typo in 'maxinlist' and 'mininlist'.
*                      Minor alteration to listcontentsX to list fixtures and
*                      actors separately. The listing of actors is now no longer
*                      dependent on the listing of fixtures.
*                      Various cosmetic changes to 'Thing', primarily to shorten
*                      the listing.
*                      Added class 'Qopenable' for an Openable that does not
*                      list its contents in a room description.
*                      Corrected typo in Player.sleepmessage.
*                      Added 'get outfromunderneath' as a synonym of
*                      getoutfromunderVerb.
*                      Added more synonyms to climbVerb.
*                      Added 'desc' property to verbs that have a plural that
*                      isn't simply a case of adding an 's'.
*                      Added 'Openwith' action to openVerb to allow "open <x>
*                      with <y>".
*                      [v1.4.0]
*
* 18-Jan-99    djh     It's been a while. I've been kinda busy.
*                      Moved versioninfo() from init() into gameinit(), so that
*                      it is displayed after the introduction. As gameinit() is
*                      only called when a new game is started, versioninfo() is
*                      also called from initRestore().
*                      Version 2.2.6 of the interpreter has fixed the
*                      initRestore() bug that caused init() to be called as
*                      well. It now works as stated in the release notes.
*                      Modified Room.enter(actor) to set the text and background
*                      colours only if they are stated in the room attributes.
*                      [Shay Caron]
*                      Corrected verification routine names in outVerb,
*                      downstreamVerb and jumpVerb. [Shay Caron]
*                      Added code to Actor.travelto to make the actor and
*                      everything the actor is carrying known to the player when
*                      the actor is moved into the player's location.
*  1-Apr-99    djh     Added new version of verifyinsertion() to the
*                      holder class to provide a more realistic handling of
*                      maximum bulks and weights for containers. The function
*                      recurses through the hierarchy of containers to ensure
*                      that none of the maximums are exceeded.
*                      Added the property 'fullscore' to global.
*                      Added a new score routine that lists the percentage of
*                      rooms and items that the player has seen. This is
*                      conditioned on the new 'fullscore' property. To override
*                      the basic score routine, replace or modify
*                      old_score_and_rank() rather than score_and_rank().
*                      Added 'look through' methods to the Transparent class to
*                      allow objects defined with this property to be looked
*                      through.
*                      Added the moveinto() function to the Part class to sever
*                      the connection between the part and its parent if the
*                      part is moved.
*                      Added 'lift' and 'raise' as synonyms for moveVerb.
*                      Corrected a couple of grammatical errors in
*                      Lockable.doLock. [Shay Caron]
*                      Added code to commandPrompt and commandAfterRead to
*                      switch to the TADS-Input font for the player's input then
*                      revert to the original font for output.
*                      Added new prompt parameters to the askfile() function.
*                      These let you specify what type of prompt to show and
*                      what type of file to request.  These new arguments are
*                      hints to the system-specific code that displays the "open
*                      file" dialog; by specifying this new information, you
*                      help the system code show the correct type of dialog.
*                      Added new global properties 'datedisp', 'timedisp',
*                      and 'scoredisp' to determine whether the current date,
*                      current time, and score information are displayed in the
*                      status line. Any combination is allowed, the default is
*                      to display just the score and turns.
*                      [v1.5.0]