Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue L61009

Buggy message for boxes of scenery
Submitted by: Alan Trewartha     Appeared in: Library 6/7 or before     Fixed in: Library 6/11
Problem

In the event that you OPEN an opaque box which has at least one child, AND you are not in that box, then L__M(##Open,4,noun) is called. This prints "You open the NOUN, revealing" then calls WriteListFrom(), then it prints either a "." or the word "nothing" depending on the returned value. So a box that contains only concealed items gives you...

  You open the magician's cabinet, revealing .

Highly suspicious.

Solution

My quick suggested fix is to replace WriteListFrom() so that it returns the value it gets from the much longer WriteListR() routine.

  ! To allow opening "apparently" empty containers
  [ WriteListFrom o style depth;
    if (o==child(parent(o)))
    {   SortOutList(o); o=child(parent(o)); }
    c_style=style;
    wlf_indent=0;
    return WriteListR(o,depth);
  ];

  You open the magician's cabinet, revealing nothing.

Slightly less suspicious? OK, it's not a perfect fix because "You open the NOUN." is what you get if there *really is* nothing inside the box. Go to town and use the algorithm from WriteListR() to fix either OpenSub() or lib_messages() as you prefer. This is left as an exercise for the reader.

Update (by Cedric Knight)

As the contributor says, the patch isn't perfect. A simpler solution is to make OpenSub more like SearchSub. Add the following before SearchSub():

  [ VisibleContents o  i f;
    objectloop (i in o) if (i hasnt concealed && i hasnt scenery) f++;
    return f;
  ];

And then change the OpenSub() line

  if (noun has container && noun hasnt transparent && child(noun)~=0

to

  if (noun has container && noun hasnt transparent && VisibleContents(noun) ~= 0
       && location ~= thedark

(the second line being the addition from L61014).


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.