Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue L61034

'name' property on rooms with THE
Submitted by: Giancarlo Niccolai     Appeared in: Library 6/10 or before     Fixed in: Library 6/11
Problem

The problem is in the misbehaviour of name properties on rooms in conjunction with THE. Look at the following example:

  Object   The_Room "In The Room"
    with   name 'unimportant' 'things',
           ...

The game produces this misleading output:

  > EXAMINE UNIMPORTANT
  That's not something you need to refer to in the course of this game.

  > EXAMINE THE UNIMPORTANT
  You can't see any such thing.
Solution

This is due to a mistake in the CantSee() routine (in parserm.h):

  [ CantSee  i w e;
      ...
      i=actor; while (parent(i) ~= 0) i = parent(i);
      if (i has visited && Refers(i,wn-1)==1) e=SCENERY_PE;
      if (etype>e) return etype;
      return e;
  ];

In this code, Refers() can be called on w='the'.

To make things multilingual I used the LanguageDescriptor names. First, add this function (which may also be useful for other reasons) somewhere in the code:

  [ IsArticle word
      x type;
      for (x=1 : x<=LanguageDescriptors-->0 : x=x+4) {
          type = LanguageDescriptors-->(x+2);
          if ( type == DEFART_PK or INDEFART_PK )
              if ( word == LanguageDescriptors-->x ) rtrue;
      }
      rfalse;
  ];

Then, add one line into CantSee():

  [ CantSee  i w e;
      ...
      i=actor; while (parent(i) ~= 0) i = parent(i);
      if (IsArticle(w)) w=NextWord();    ! Add this line
      if (i has visited && Refers(i,wn-1)==1) e=SCENERY_PE;
      if (etype>e) return etype;
      return e;
  ];

This patch seems to have no side-effects. It will always work, unless an object has a name that consists only of articles, but then I think that the problem is in the object name, and not in the parser. But if we want to take care also of this aspect, we can use if( IsArticle(w) ) only if Refers() fails once, like that:

    i=actor; while (parent(i) ~= 0) i = parent(i);            ! unchanged
    if (i has visited && Refers(i,wn-1)==1) e=SCENERY_PE;     ! unchanged
    else {                                                    ! Add the thing below
        if (IsArticle(w)) w=NextWord();
        if (i has visited && Refers(i,wn-1)==1) e=SCENERY_PE; ! unchanged
    }

(Not tested: if Refers() moves wn, then we need to save wn first.)

Since incomplete sentences (for example, LOOK AT THE) are treated separately (the parser says "What do you want to look at?" and never calls CantSee()), we can presume that if the word "w" is an article, that word is not the last of the sentence, and no control about it must be taken.


Last updated 17 April 2013. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Roger Firth.