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 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;

View file

@ -13,11 +13,6 @@
# actions: Action words, grouped into synonyms, and their corresponding
# 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
# generate the value macro for the hint) the number of turns he
# must be at the right loc(s) before triggering the hint, the
@ -4027,10 +4022,4 @@ actions: !!omap
words: ['versi']
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

3
main.c
View file

@ -1134,9 +1134,6 @@ Lookup:
command.part = intransitive;
command.verb = command.id1;
break;
case SPECIAL:
speak(specials[command.id1].message);
goto Lclearobj;
case NUMERIC:
default: // 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;
}} 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 desttype_t {{dest_goto, dest_special, dest_speak}};
@ -145,7 +139,6 @@ extern const hint_t hints[];
extern long conditions[];
extern const motion_t motions[];
extern const action_t actions[];
extern const special_t specials[];
extern const travelop_t travel[];
extern const long tkey[];
extern const char *ignore;
@ -156,9 +149,8 @@ extern const char *ignore;
#define NCLASSES {}
#define NDEATHS {}
#define NTHRESHOLDS {}
#define NMOTIONS {}
#define NMOTIONS {}
#define NACTIONS {}
#define NSPECIALS {}
#define NTRAVEL {}
#define NKEYS {}
@ -184,10 +176,6 @@ enum action_refs {{
{}
}};
enum special_refs {{
{}
}};
/* State definitions */
{}
@ -238,10 +226,6 @@ const action_t actions[] = {{
{}
}};
const special_t specials[] = {{
{}
}};
const long tkey[] = {{{}}};
const travelop_t travel[] = {{
@ -499,16 +483,16 @@ def get_motions(motions):
ignore += word.upper()
return mot_str
def get_specials(specials):
def get_actions(actions):
template = """ {{
.words = {},
.message = {},
.noaction = {},
}},
"""
spc_str = ""
for special in specials:
contents = special[1]
act_str = ""
for action in actions:
contents = action[1]
if contents["words"] == None:
words_str = get_string_group([])
@ -525,14 +509,14 @@ def get_specials(specials):
else:
noaction = "true"
spc_str += template.format(words_str, message, noaction)
act_str += template.format(words_str, message, noaction)
global ignore
if contents.get("oldstyle", True) == False:
for word in contents["words"]:
if len(word) == 1:
ignore += word.upper()
spc_str = spc_str[:-1] # trim trailing newline
return spc_str
act_str = act_str[:-1] # trim trailing newline
return act_str
def bigdump(arr):
out = ""
@ -776,8 +760,7 @@ if __name__ == "__main__":
get_hints(db["hints"], db["arbitrary_messages"]),
get_condbits(db["locations"]),
get_motions(db["motions"]),
get_specials(db["actions"]),
get_specials(db["specials"]),
get_actions(db["actions"]),
bigdump(tkey),
get_travel(travel),
ignore,
@ -796,7 +779,6 @@ if __name__ == "__main__":
len(db["turn_thresholds"]),
len(db["motions"]),
len(db["actions"]),
len(db["specials"]),
len(travel),
len(tkey),
deathbird,
@ -805,7 +787,6 @@ if __name__ == "__main__":
get_refs(db["objects"]),
get_refs(db["motions"]),
get_refs(db["actions"]),
get_refs(db["specials"]),
statedefines,
)

20
misc.c
View file

@ -386,19 +386,6 @@ static int get_action_vocab_id(const char* word)
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)
/* Returns true if the string passed in is represents a valid integer,
* 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;
}
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.
if (strcasecmp(word, game.zzword) == 0) {
*id = PART;

View file

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