Specials excised from adventure.yaml

This commit is contained in:
Aaron Traas 2017-07-21 17:15:23 -04:00
parent 5f28f95244
commit e8a627f964
6 changed files with 13 additions and 67 deletions

View file

@ -87,7 +87,7 @@ enum termination {endgame, quitgame, scoregame};
enum speechpart {unknown, intransitive, transitive}; enum speechpart {unknown, intransitive, transitive};
enum wordtype {NO_WORD_TYPE, MOTION, OBJECT, ACTION, SPECIAL, NUMERIC}; enum wordtype {NO_WORD_TYPE, MOTION, OBJECT, ACTION, NUMERIC};
typedef enum scorebonus {none, splatter, defeat, victory} score_t; typedef enum scorebonus {none, splatter, defeat, victory} score_t;

View file

@ -13,11 +13,6 @@
# actions: Action words, grouped into synonyms, and their corresponding # actions: Action words, grouped into synonyms, and their corresponding
# default messages. The 'oldstyle' attribute is as for motions. # default messages. The 'oldstyle' attribute is as for motions.
# #
# specials: Special action words, grouped into synonyms, and their
# messages. These differ from the regular action words above in that
# they only display their corresponding message; no other logic is
# invoked. In the future, these will be merged into the regular actions.
#
# 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
# must be at the right loc(s) before triggering the hint, the # must be at the right loc(s) before triggering the hint, the
@ -4027,10 +4022,4 @@ actions: !!omap
words: ['versi'] words: ['versi']
noaction: true noaction: true
# Specials no longer used, but this is still needed for now
specials: !!omap
- SPC_DELETEME:
message: 'Please delete this item'
words: ['null']
# end # end

3
main.c
View file

@ -1134,9 +1134,6 @@ Lookup:
command.part = intransitive; command.part = intransitive;
command.verb = command.id1; command.verb = command.id1;
break; break;
case SPECIAL:
speak(specials[command.id1].message);
goto Lclearobj;
case NUMERIC: case NUMERIC:
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE

View file

@ -108,12 +108,6 @@ typedef struct {{
const bool noaction; const bool noaction;
}} action_t; }} action_t;
typedef struct {{
const string_group_t words;
const char* message;
const bool noaction;
}} special_t;
enum condtype_t {{cond_goto, cond_pct, cond_carry, cond_with, cond_not}}; enum condtype_t {{cond_goto, cond_pct, cond_carry, cond_with, cond_not}};
enum desttype_t {{dest_goto, dest_special, dest_speak}}; enum desttype_t {{dest_goto, dest_special, dest_speak}};
@ -145,7 +139,6 @@ extern const hint_t hints[];
extern long conditions[]; extern long conditions[];
extern const motion_t motions[]; extern const motion_t motions[];
extern const action_t actions[]; extern const action_t actions[];
extern const special_t specials[];
extern const travelop_t travel[]; extern const travelop_t travel[];
extern const long tkey[]; extern const long tkey[];
extern const char *ignore; extern const char *ignore;
@ -156,9 +149,8 @@ extern const char *ignore;
#define NCLASSES {} #define NCLASSES {}
#define NDEATHS {} #define NDEATHS {}
#define NTHRESHOLDS {} #define NTHRESHOLDS {}
#define NMOTIONS {} #define NMOTIONS {}
#define NACTIONS {} #define NACTIONS {}
#define NSPECIALS {}
#define NTRAVEL {} #define NTRAVEL {}
#define NKEYS {} #define NKEYS {}
@ -184,10 +176,6 @@ enum action_refs {{
{} {}
}}; }};
enum special_refs {{
{}
}};
/* State definitions */ /* State definitions */
{} {}
@ -238,10 +226,6 @@ const action_t actions[] = {{
{} {}
}}; }};
const special_t specials[] = {{
{}
}};
const long tkey[] = {{{}}}; const long tkey[] = {{{}}};
const travelop_t travel[] = {{ const travelop_t travel[] = {{
@ -499,16 +483,16 @@ def get_motions(motions):
ignore += word.upper() ignore += word.upper()
return mot_str return mot_str
def get_specials(specials): def get_actions(actions):
template = """ {{ template = """ {{
.words = {}, .words = {},
.message = {}, .message = {},
.noaction = {}, .noaction = {},
}}, }},
""" """
spc_str = "" act_str = ""
for special in specials: for action in actions:
contents = special[1] contents = action[1]
if contents["words"] == None: if contents["words"] == None:
words_str = get_string_group([]) words_str = get_string_group([])
@ -525,14 +509,14 @@ def get_specials(specials):
else: else:
noaction = "true" noaction = "true"
spc_str += template.format(words_str, message, noaction) act_str += template.format(words_str, message, noaction)
global ignore global ignore
if contents.get("oldstyle", True) == False: if contents.get("oldstyle", True) == False:
for word in contents["words"]: for word in contents["words"]:
if len(word) == 1: if len(word) == 1:
ignore += word.upper() ignore += word.upper()
spc_str = spc_str[:-1] # trim trailing newline act_str = act_str[:-1] # trim trailing newline
return spc_str return act_str
def bigdump(arr): def bigdump(arr):
out = "" out = ""
@ -776,8 +760,7 @@ if __name__ == "__main__":
get_hints(db["hints"], db["arbitrary_messages"]), get_hints(db["hints"], db["arbitrary_messages"]),
get_condbits(db["locations"]), get_condbits(db["locations"]),
get_motions(db["motions"]), get_motions(db["motions"]),
get_specials(db["actions"]), get_actions(db["actions"]),
get_specials(db["specials"]),
bigdump(tkey), bigdump(tkey),
get_travel(travel), get_travel(travel),
ignore, ignore,
@ -796,7 +779,6 @@ if __name__ == "__main__":
len(db["turn_thresholds"]), len(db["turn_thresholds"]),
len(db["motions"]), len(db["motions"]),
len(db["actions"]), len(db["actions"]),
len(db["specials"]),
len(travel), len(travel),
len(tkey), len(tkey),
deathbird, deathbird,
@ -805,7 +787,6 @@ if __name__ == "__main__":
get_refs(db["objects"]), get_refs(db["objects"]),
get_refs(db["motions"]), get_refs(db["motions"]),
get_refs(db["actions"]), get_refs(db["actions"]),
get_refs(db["specials"]),
statedefines, statedefines,
) )

20
misc.c
View file

@ -386,19 +386,6 @@ static int get_action_vocab_id(const char* word)
return (WORD_NOT_FOUND); return (WORD_NOT_FOUND);
} }
static int get_special_vocab_id(const char* word)
// Return the first special number that has 'word' as one of its words.
{
for (int i = 0; i < NSPECIALS; ++i) {
for (int j = 0; j < specials[i].words.n; ++j) {
if (strncasecmp(word, specials[i].words.strs[j], TOKLEN) == 0)
return (i);
}
}
// If execution reaches here, we didn't find the word.
return (WORD_NOT_FOUND);
}
static bool is_valid_int(const char *str) static bool is_valid_int(const char *str)
/* Returns true if the string passed in is represents a valid integer, /* Returns true if the string passed in is represents a valid integer,
* that could then be parsed by atoi() */ * that could then be parsed by atoi() */
@ -455,13 +442,6 @@ static void get_vocab_metadata(const char* word, vocab_t* id, enum wordtype* typ
return; return;
} }
ref_num = get_special_vocab_id(word);
if (ref_num != WORD_NOT_FOUND) {
*id = ref_num;
*type = SPECIAL;
return;
}
// Check for the reservoir magic word. // Check for the reservoir magic word.
if (strcasecmp(word, game.zzword) == 0) { if (strcasecmp(word, game.zzword) == 0) {
*id = PART; *id = PART;

View file

@ -152,8 +152,8 @@ def arb_coverage(arb_msgs, text, report):
report["messages"][name]["covered"] = True report["messages"][name]["covered"] = True
report["covered"] += 1 report["covered"] += 1
def specials_actions_coverage(items, text, report): def actions_coverage(items, text, report):
# works for actions or specials # works for actions
for name, item in items: for name, item in items:
if name not in report["messages"]: if name not in report["messages"]:
report["messages"][name] = {"covered" : False} report["messages"][name] = {"covered" : False}
@ -182,8 +182,7 @@ def coverage_report(db, check_file_contents):
loc_coverage(db["locations"], chk, report["locations"]) loc_coverage(db["locations"], chk, report["locations"])
obit_coverage(db["obituaries"], chk, report["obituaries"]) obit_coverage(db["obituaries"], chk, report["obituaries"])
obj_coverage(db["objects"], chk, report["objects"]) obj_coverage(db["objects"], chk, report["objects"])
specials_actions_coverage(db["actions"], chk, report["actions"]) actions_coverage(db["actions"], chk, report["actions"])
specials_actions_coverage(db["specials"], chk, report["specials"])
threshold_coverage(db["classes"], chk, report["classes"]) threshold_coverage(db["classes"], chk, report["classes"])
threshold_coverage(db["turn_thresholds"], chk, report["turn_thresholds"]) threshold_coverage(db["turn_thresholds"], chk, report["turn_thresholds"])