Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C62103

Plural bit not set on long dictionary words
Submitted by: Torbjörn Andersson     Appeared in: Compiler 6.21 or before     Fixed in: Compiler 6.30
Problem

If you define a class like so:

  Class Elephant
    with name 'elephant' 'elephants//p'
    has animate;

you would expect Inform to set the plural bit for 'elephants', but it doesn't. As far as I can see, the problem is in dictionary_prepare() in text.c. Its main loop will terminate before it reaches the // part of the word.

Solution

The simplest -- though probably not the most efficient -- bug fix would be to simply make the // test separate from the main loop. I've included a patch, but unfortunately it turned out pretty unreadable to humans.

On second thought, this patch may not be ideal either. What if I change the name property to 'taxidermist' 'taxidermists//p'?

Anyway, the main problem is that with an unpatched Inform compiler, you apparently can't set the plural flag on nine-letter words.

Workaround (by Jim Fisher)

Although this really is a bug in the compiler, a quick way to address this problem (without patching and recompiling the compiler) is to modify the word table directly in the game source:

  'batteries'-->#dict_par1 = 'batteries'->#dict_par1 | 4;

Of course that sort of code can look a little cryptic. It makes for far more readable source to wrap it in a function:

  [ MakePlural wrd; wrd-->#dict_par1 = wrd->#dict_par1 | 4; ];

So various nine-character words can legibly be made plural in Initialise():

  MakePlural('batteries');
  MakePlural('elephants');
  MakePlural('ostriches');
  MakePlural('creatures');
  MakePlural('gargoyles');
  MakePlural('loopholes');
  MakePlural('limericks');


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.