Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue L61013

Match list handled incorrectly
Submitted by: Neil Cerutti     Appeared in: Library 6/10 or before     Fixed in: Library 6/11
Problem

The ScoreMatchL() routine in Parserm.h incorrectly decides which objects meet descriptors. As a result, some objects that don't meet descriptors are not properly removed from the match list when the library is deciding which objects best match a player's input. Here is a short transcript demonstrating the bug:

  >INV
  You are carrying:
    A steel lantern
    A brass lantern (providing light)
    A copper lantern

  >DROP LIT LANTERN
  (the brass lantern)
  Dropped.

The steel lantern was correctly removed from the match list, but the copper lantern was not -- since they are both unlit, they should have removed.

At this point, the library haphazardly chose the first object of those remaining in the match list, since it considers them indistinguishable. Ironically, the library is guaranteed to guess correctly. That's probably why this bug isn't fixed yet.

The correct transcript would be:

  >DROP LIT LANTERN
  Dropped.

Both of the unlit lanterns are removed from the match list, so there is no ambiguity, and the parser does not need to guess.

Solution

It's a simple case of a variable not being reset to zero on subsequent iterations. After Parserm.h lines 2618-2619,

  for (i=0: i<number_matched: i++) {
      obj = match_list-->i; its_owner = parent(obj); its_score=0;

add the line:

  met = 0;

The only functioning descriptors in the standard English version of the Inform library are 'lit' and 'unlit'. Foreign language editions of the library most likely define many more of them, and so they are more susceptible to this bug.

Update (by Sabrejack)

What I’m writing to emphasize is that this is a -BIG- bug and it will screw up ambiguous matching of almost any sort, failing to exclude objects which are clearly not matches. Example: If you have an animate, and you do:

  >x his pen

And you also have a pen in your inventory, the fact that met is not set back to 0 will cause your pen AND his pen to both be considered, at which point your pen will be scored 20 higher than his pen because it is in your inventory and will end up being the target of the action. With met=0 at the beginning of each new iteration, your pen fails to meet the criteria (belonging to the pronoun him), and is correctly excluded.


Last updated 17 April 2013. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Roger Firth.