= Open Adventure project news =
+Repository head:
+ Under oldstyle, new-school single-letter command synonyms are ignored.
+ Switched from linenoise to editline for new-style line input.
+ The -s option is no longer required to paste command input; it is removed.
+
1.1: 2017-06-29::
There is a 'version' command.
Include tests directory in generated tarball.
-l:: Log commands to specified file.
--s:: Suppress Emacs-like line editing and command history.
-
-r:: Restore game from specified file
-o:: Old-style. Restores original interface, no prompt or line editing.
+ Also ignores new-school one-letter commands l, x, g, z, i.
== BUGS ==
#
# We define a bunch of YAML structures:
#
-# vocabulary: - This structure is unused, and will eventually be removed. -
-# Almost all the words the game knows - one of them (the
-# reservoir magic word) gets replaced with a randomly-generated
-# cookie. For each word there is a type (motion, action, object,
-# or special) and a numeric value. Multiple synonyms may have the
-# same value.
-#
-# motions: Motion words, grouped into synonyms.
-#
+# motions: Motion words, grouped into synonyms. The 'oldstyle'
+# attribute, if false, means that single-letter synonyms should be
+# accepted in oldstyle mode; it defaults to truie.
+
# actions: Action words, grouped into synonyms, and their corresponding
-# default messages.
+# default messages. The 'oldstyle' attribute is as for motions.
#
# hints: Each item contains a hint number, a hint label (used to
# generate the value macro for the hint) the number of turns he
words: ['climb']
- LOOK:
words: ['l', 'x', 'look', 'exami', 'touch', 'descr']
+ oldstyle: false
- MOT_58:
words: ['floor']
- MOT_59:
message: ALREADY_CARRYING
words: ['g', 'carry', 'take', 'keep', 'catch',
'steal', 'captu', 'get', 'tote', 'snarf']
+ oldstyle: false
- DROP:
message: ARENT_CARRYING
words: ['drop', 'relea', 'free', 'disca', 'dump']
- NOTHING:
message: NO_MESSAGE
words: ['z', 'nothi']
+ oldstyle: false
- LOCK:
message: NOT_LOCKABLE
words: ['lock', 'close']
- INVENTORY:
message: NEARBY
words: ['i', 'inven']
+ oldstyle: false
- FEED:
message: NO_EDIBLES
words: ['feed']
extern const action_t specials[];
extern const travelop_t travel[];
extern const long tkey[];
+extern const char *ignore;
#define NLOCATIONS {}
#define NOBJECTS {}
{}
}};
-{}
+const long tkey[] = {{{}}};
const travelop_t travel[] = {{
{}
}};
+const char *ignore = \"{}\";
+
/* end */
"""
else:
words_str = get_string_group(contents["words"])
mot_str += template.format(words_str)
+ global ignore
+ if contents.get("oldstyle", True) == False:
+ for word in contents["words"]:
+ if len(word) == 1:
+ ignore += word.upper()
return mot_str
def get_actions(actions):
message = contents["message"]
act_str += template.format(words_str, message)
+ global ignore
+ if contents.get("oldstyle", True) == False:
+ for word in contents["words"]:
+ if len(word) == 1:
+ ignore += word.upper()
act_str = act_str[:-1] # trim trailing newline
return act_str
if out and out[-1] == ' ':
out = out[:-1]
out += "\n "
- out += str(arr[i]) + ", "
+ out += str(arr[i]).lower() + ", "
out = out[:-2] + "\n"
return out
(travel, tkey) = buildtravel(db["locations"],
db["objects"])
-
+ ignore = ""
c = c_template.format(
h_name,
get_arbitrary_messages(db["arbitrary_messages"]),
get_motions(db["motions"]),
get_actions(db["actions"]),
get_actions(db["specials"]),
- "const long tkey[] = {%s};" % bigdump(tkey),
+ bigdump(tkey),
get_travel(travel),
+ ignore,
)
h = h_template.format(
{
for (int i = 0; i < NMOTIONS; ++i) {
for (int j = 0; j < motions[i].words.n; ++j) {
- if (strcasecmp(word, motions[i].words.strs[j]) == 0)
+ if (strcasecmp(word, motions[i].words.strs[j]) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !oldstyle))
return (i);
}
}
{
for (int i = 0; i < NACTIONS; ++i) {
for (int j = 0; j < actions[i].words.n; ++j) {
- if (strcasecmp(word, actions[i].words.strs[j]) == 0)
+ if (strcasecmp(word, actions[i].words.strs[j]) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !oldstyle))
return (i);
}
}
Around you is a forest. A small stream flows out of the building and
down a gully.
+i
+
+Sorry, I don't know the word "I".
+
+l
+
+Sorry, I don't know the word "L".
+
+x
+
+Sorry, I don't know the word "X".
+
+z
+
+Sorry, I don't know the word "Z".
+
quit
Do you really want to quit now?
OK
-You scored 32 out of a possible 430, using 1 turn.
+You scored 32 out of a possible 430, using 5 turns.
You are obviously a rank amateur. Better luck next time.
## Simple quit
#options: -o
n
+i
+l
+x
+z
quit
yes