Ignore l g z i under oldstyle.
This commit is contained in:
parent
3c8482a613
commit
0d0b8df0a3
7 changed files with 56 additions and 19 deletions
5
NEWS
5
NEWS
|
@ -1,5 +1,10 @@
|
||||||
= Open Adventure project news =
|
= 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::
|
1.1: 2017-06-29::
|
||||||
There is a 'version' command.
|
There is a 'version' command.
|
||||||
Include tests directory in generated tarball.
|
Include tests directory in generated tarball.
|
||||||
|
|
|
@ -40,11 +40,10 @@ There have been no gameplay changes.
|
||||||
|
|
||||||
-l:: Log commands to specified file.
|
-l:: Log commands to specified file.
|
||||||
|
|
||||||
-s:: Suppress Emacs-like line editing and command history.
|
|
||||||
|
|
||||||
-r:: Restore game from specified file
|
-r:: Restore game from specified file
|
||||||
|
|
||||||
-o:: Old-style. Restores original interface, no prompt or line editing.
|
-o:: Old-style. Restores original interface, no prompt or line editing.
|
||||||
|
Also ignores new-school one-letter commands l, x, g, z, i.
|
||||||
|
|
||||||
== BUGS ==
|
== BUGS ==
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,12 @@
|
||||||
#
|
#
|
||||||
# We define a bunch of YAML structures:
|
# We define a bunch of YAML structures:
|
||||||
#
|
#
|
||||||
# vocabulary: - This structure is unused, and will eventually be removed. -
|
# motions: Motion words, grouped into synonyms. The 'oldstyle'
|
||||||
# Almost all the words the game knows - one of them (the
|
# attribute, if false, means that single-letter synonyms should be
|
||||||
# reservoir magic word) gets replaced with a randomly-generated
|
# accepted in oldstyle mode; it defaults to truie.
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# actions: Action words, grouped into synonyms, and their corresponding
|
# 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
|
# hints: Each item contains a hint number, a hint label (used to
|
||||||
# generate the value macro for the hint) the number of turns he
|
# generate the value macro for the hint) the number of turns he
|
||||||
|
@ -243,6 +238,7 @@ motions: !!omap
|
||||||
words: ['climb']
|
words: ['climb']
|
||||||
- LOOK:
|
- LOOK:
|
||||||
words: ['l', 'x', 'look', 'exami', 'touch', 'descr']
|
words: ['l', 'x', 'look', 'exami', 'touch', 'descr']
|
||||||
|
oldstyle: false
|
||||||
- MOT_58:
|
- MOT_58:
|
||||||
words: ['floor']
|
words: ['floor']
|
||||||
- MOT_59:
|
- MOT_59:
|
||||||
|
@ -290,6 +286,7 @@ actions: !!omap
|
||||||
message: ALREADY_CARRYING
|
message: ALREADY_CARRYING
|
||||||
words: ['g', 'carry', 'take', 'keep', 'catch',
|
words: ['g', 'carry', 'take', 'keep', 'catch',
|
||||||
'steal', 'captu', 'get', 'tote', 'snarf']
|
'steal', 'captu', 'get', 'tote', 'snarf']
|
||||||
|
oldstyle: false
|
||||||
- DROP:
|
- DROP:
|
||||||
message: ARENT_CARRYING
|
message: ARENT_CARRYING
|
||||||
words: ['drop', 'relea', 'free', 'disca', 'dump']
|
words: ['drop', 'relea', 'free', 'disca', 'dump']
|
||||||
|
@ -302,6 +299,7 @@ actions: !!omap
|
||||||
- NOTHING:
|
- NOTHING:
|
||||||
message: NO_MESSAGE
|
message: NO_MESSAGE
|
||||||
words: ['z', 'nothi']
|
words: ['z', 'nothi']
|
||||||
|
oldstyle: false
|
||||||
- LOCK:
|
- LOCK:
|
||||||
message: NOT_LOCKABLE
|
message: NOT_LOCKABLE
|
||||||
words: ['lock', 'close']
|
words: ['lock', 'close']
|
||||||
|
@ -348,6 +346,7 @@ actions: !!omap
|
||||||
- INVENTORY:
|
- INVENTORY:
|
||||||
message: NEARBY
|
message: NEARBY
|
||||||
words: ['i', 'inven']
|
words: ['i', 'inven']
|
||||||
|
oldstyle: false
|
||||||
- FEED:
|
- FEED:
|
||||||
message: NO_EDIBLES
|
message: NO_EDIBLES
|
||||||
words: ['feed']
|
words: ['feed']
|
||||||
|
|
|
@ -175,6 +175,7 @@ extern const action_t actions[];
|
||||||
extern const action_t specials[];
|
extern const action_t specials[];
|
||||||
extern const travelop_t travel[];
|
extern const travelop_t travel[];
|
||||||
extern const long tkey[];
|
extern const long tkey[];
|
||||||
|
extern const char *ignore;
|
||||||
|
|
||||||
#define NLOCATIONS {}
|
#define NLOCATIONS {}
|
||||||
#define NOBJECTS {}
|
#define NOBJECTS {}
|
||||||
|
@ -266,12 +267,14 @@ const action_t specials[] = {{
|
||||||
{}
|
{}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
{}
|
const long tkey[] = {{{}}};
|
||||||
|
|
||||||
const travelop_t travel[] = {{
|
const travelop_t travel[] = {{
|
||||||
{}
|
{}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
const char *ignore = \"{}\";
|
||||||
|
|
||||||
/* end */
|
/* end */
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -519,6 +522,11 @@ def get_motions(motions):
|
||||||
else:
|
else:
|
||||||
words_str = get_string_group(contents["words"])
|
words_str = get_string_group(contents["words"])
|
||||||
mot_str += template.format(words_str)
|
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
|
return mot_str
|
||||||
|
|
||||||
def get_actions(actions):
|
def get_actions(actions):
|
||||||
|
@ -542,6 +550,11 @@ def get_actions(actions):
|
||||||
message = contents["message"]
|
message = contents["message"]
|
||||||
|
|
||||||
act_str += template.format(words_str, 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
|
act_str = act_str[:-1] # trim trailing newline
|
||||||
return act_str
|
return act_str
|
||||||
|
|
||||||
|
@ -552,7 +565,7 @@ def bigdump(arr):
|
||||||
if out and out[-1] == ' ':
|
if out and out[-1] == ' ':
|
||||||
out = out[:-1]
|
out = out[:-1]
|
||||||
out += "\n "
|
out += "\n "
|
||||||
out += str(arr[i]) + ", "
|
out += str(arr[i]).lower() + ", "
|
||||||
out = out[:-2] + "\n"
|
out = out[:-2] + "\n"
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
@ -697,7 +710,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
(travel, tkey) = buildtravel(db["locations"],
|
(travel, tkey) = buildtravel(db["locations"],
|
||||||
db["objects"])
|
db["objects"])
|
||||||
|
ignore = ""
|
||||||
c = c_template.format(
|
c = c_template.format(
|
||||||
h_name,
|
h_name,
|
||||||
get_arbitrary_messages(db["arbitrary_messages"]),
|
get_arbitrary_messages(db["arbitrary_messages"]),
|
||||||
|
@ -711,8 +724,9 @@ if __name__ == "__main__":
|
||||||
get_motions(db["motions"]),
|
get_motions(db["motions"]),
|
||||||
get_actions(db["actions"]),
|
get_actions(db["actions"]),
|
||||||
get_actions(db["specials"]),
|
get_actions(db["specials"]),
|
||||||
"const long tkey[] = {%s};" % bigdump(tkey),
|
bigdump(tkey),
|
||||||
get_travel(travel),
|
get_travel(travel),
|
||||||
|
ignore,
|
||||||
)
|
)
|
||||||
|
|
||||||
h = h_template.format(
|
h = h_template.format(
|
||||||
|
|
4
misc.c
4
misc.c
|
@ -459,7 +459,7 @@ int get_motion_vocab_id(const char* word)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NMOTIONS; ++i) {
|
for (int i = 0; i < NMOTIONS; ++i) {
|
||||||
for (int j = 0; j < motions[i].words.n; ++j) {
|
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);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ int get_action_vocab_id(const char* word)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NACTIONS; ++i) {
|
for (int i = 0; i < NACTIONS; ++i) {
|
||||||
for (int j = 0; j < actions[i].words.n; ++j) {
|
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);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,22 @@ You are standing at the end of a road before a small brick building.
|
||||||
Around you is a forest. A small stream flows out of the building and
|
Around you is a forest. A small stream flows out of the building and
|
||||||
down a gully.
|
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
|
quit
|
||||||
|
|
||||||
Do you really want to quit now?
|
Do you really want to quit now?
|
||||||
|
@ -16,7 +32,7 @@ yes
|
||||||
|
|
||||||
OK
|
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.
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
## Simple quit
|
## Simple quit
|
||||||
#options: -o
|
#options: -o
|
||||||
n
|
n
|
||||||
|
i
|
||||||
|
l
|
||||||
|
x
|
||||||
|
z
|
||||||
quit
|
quit
|
||||||
yes
|
yes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue