DavidKinder / Inform6

The latest version of the Inform 6 compiler, used for generating interactive fiction games.
http://inform-fiction.org/
Other
199 stars 32 forks source link

Verb clash -- initial cleanup #286

Closed erkyrath closed 2 months ago

erkyrath commented 2 months ago

I want to tackle https://github.com/DavidKinder/Inform6/issues/285 , but first I'm cleaning up a bunch of grotty verb code.

This PR does not change any functionality except that one hard-coded size limit is gone.

The make_verb() sequence used to store verb info in two byte-encoded arrays, English_verb_list and English_verbs_given. It was unnecessarily complicated and also led to a requirement that the verb word length fit in a byte. (The MAX_VERB_WORD_SIZE header define.)

I have changed this to an array of structs (English_verbs) and a separate array of strings referred to by those structs (English_verbs_text). The flow of make_verb() is simpler. I have gotten rid of the MAX_VERB_WORD_SIZE constant and the register_verb() helper function.

I've also split find_or_renumber_verb() into find_verb() and renumber_verb(). Both are simpler because they iterate through an array of structs rather than variable-length strings.