Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing parserm.h

MakeMatch (lines 3184-3220)

3184  !  MakeMatch looks at how good a match is.  If it's the best so far, then
3185  !  wipe out all the previous matches and start a new list with this one.
3186  !  If it's only as good as the best so far, add it to the list.
3187  !  If it's worse, ignore it altogether.
3188  !
3189  !  The idea is that "red panic button" is better than "red button" or "panic".
3190  !
3191  !  number_matched (the number of words matched) is set to the current level
3192  !  of quality.
3193  !
3194  !  We never match anything twice, and keep at most 64 equally good items.
3195  ! ----------------------------------------------------------------------------
3196   
3197  [ MakeMatch obj quality i;
3198  #ifdef DEBUG;
3199     if (parser_trace>=6) print "    Match with quality ",quality,"^";
3200  #endif;
3201     if (token_filter~=0 && UserFilter(obj)==0)
3202     {   #ifdef DEBUG;
3203         if (parser_trace>=6)
3204         {   print "    Match filtered out: token filter ", token_filter, "^";
3205         }
3206         #endif;
3207         rtrue;
3208     }
3209     if (quality < match_length) rtrue;
3210     if (quality > match_length) { match_length=quality; number_matched=0; }
3211     else
3212     {   if (2*number_matched>=MATCH_LIST_SIZE) rtrue;
3213         for (i=0:i<number_matched:i++)
3214             if (match_list-->i==obj) rtrue;
3215     }
3216     match_list-->number_matched++ = obj;
3217  #ifdef DEBUG;
3218     if (parser_trace>=6) print "    Match added to list^";
3219  #endif;
3220  ];


Last updated 27 February 2004. 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 Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.