- GO_UNNEEDED: 'You don''t have to say "go" every time; just specify a direction or, if\nit''s nearby, name the place to which you wish to move.'
- CANNOT_CARRY7: !!null
-class_messages: !!omap
-- CLS_0: !!null
-- CLS_1: 'You are obviously a rank amateur. Better luck next time.'
-- CLS_2: 'Your score qualifies you as a novice class adventurer.'
-- CLS_3: 'You have achieved the rating: "Experienced Adventurer".'
-- CLS_4: 'You may now consider yourself a "Seasoned Adventurer".'
-- CLS_5: 'You have reached "Junior Master" status.'
-- CLS_6: 'Your score puts you in Master Adventurer Class C.'
-- CLS_7: 'Your score puts you in Master Adventurer Class B.'
-- CLS_8: 'Your score puts you in Master Adventurer Class A.'
-- CLS_9: 'All of Adventuredom gives tribute to you, Adventurer Grandmaster!'
-- CLS_10: 'Adventuredom stands in awe -- you have now joined the ranks of the\n W O R L D C H A M P I O N A D V E N T U R E R S !\nIt may interest you to know that the Dungeon-Master himself has, to\nmy knowledge, never achieved this threshhold in fewer than 330 turns.'
+classes:
+- threshold: 0
+ message: !!null
+- threshold: 45
+ message: 'You are obviously a rank amateur. Better luck next time.'
+- threshold: 120
+ message: 'Your score qualifies you as a novice class adventurer.'
+- threshold: 170
+ message: 'You have achieved the rating: "Experienced Adventurer".'
+- threshold: 250
+ message: 'You may now consider yourself a "Seasoned Adventurer".'
+- threshold: 320
+ message: 'You have reached "Junior Master" status.'
+- threshold: 375
+ message: 'Your score puts you in Master Adventurer Class C.'
+- threshold: 410
+ message: 'Your score puts you in Master Adventurer Class B.'
+- threshold: 426
+ message: 'Your score puts you in Master Adventurer Class A.'
+- threshold: 429
+ message: 'All of Adventuredom gives tribute to you, Adventurer Grandmaster!'
+- threshold: 9999
+ message: 'Adventuredom stands in awe -- you have now joined the ranks of the\n W O R L D C H A M P I O N A D V E N T U R E R S !\nIt may interest you to know that the Dungeon-Master himself has, to\nmy knowledge, never achieved this threshhold in fewer than 330 turns.'
turn_thresholds:
- threshold: 350
// Storage for what comes out of the database
long LINUSE;
long TRVS;
-long CLSSES;
long TRNVLS;
long TABNDX;
long HNTMAX;
long KEY[LOCSIZ + 1];
long LOCSND[LOCSIZ + 1];
long LINES[LINSIZ + 1];
-long CVAL[CLSMAX + 1];
long TTEXT[TRNSIZ + 1];
long TRNVAL[TRNSIZ + 1];
long TRAVEL[TRVSIZ + 1];
continue;
}
if (sect == 10) {
- CLSSES = CLSSES + 1;
- if (CLSSES > CLSMAX)
- BUG(TOO_MANY_CLASS_OR_TURN_MESSAGES);
- CTEXT[CLSSES] = LINUSE;
- CVAL[CLSSES] = loc;
+ /* now parsed from YAML */
continue;
}
if (sect == 6) {
LINUSE = 1;
TRVS = 1;
- CLSSES = 0;
TRNVLS = 0;
/* Start new data section. Sect is the section number. */
write_1d(header_file, COND, LOCSIZ + 1, "COND");
write_1d(header_file, KEY, LOCSIZ + 1, "KEY");
write_1d(header_file, LOCSND, LOCSIZ + 1, "LOCSND");
- write_1d(header_file, CVAL, CLSMAX + 1, "CVAL");
write_1d(header_file, TRAVEL, TRVSIZ + 1, "TRAVEL");
write_1d(header_file, KTAB, TABSIZ + 1, "KTAB");
write_1d(header_file, ATAB, TABSIZ + 1, "ATAB");
const char* message;
}} turn_threshold_t;
+typedef struct {{
+ const int threshold;
+ const char* message;
+}} class_t;
+
extern location_t locations[];
extern object_description_t object_descriptions[];
extern const char* arbitrary_messages[];
-extern const char* class_messages[];
+extern const class_t classes[];
extern turn_threshold_t turn_thresholds[];
extern obituary_t obituaries[];
{}
}};
-enum class_messages_refs {{
-{}
-}};
-
enum locations_refs {{
{}
}};
{}
}};
-const char* class_messages[] = {{
+const class_t classes[] = {{
{}
}};
return arb_str
def get_class_messages(cls):
- template = """ {},
+ template = """ {{
+ .threshold = {},
+ .message = {},
+ }},
"""
cls_str = ""
for item in cls:
- cls_str += template.format(make_c_string(item[1]))
+ threshold = item["threshold"]
+ message = make_c_string(item["message"])
+ cls_str += template.format(threshold, message)
cls_str = cls_str[:-1] # trim trailing newline
- return cls_str
+ return cls_str
def get_turn_thresholds(trn):
template = """ {{
.threshold = {},
.point_loss = {},
.message = {},
-}},
+ }},
"""
trn_str = ""
for item in trn:
h = h_template.format(
get_refs(db["arbitrary_messages"]),
- get_refs(db["class_messages"]),
get_refs(db["locations"]),
get_refs(db["object_descriptions"]),
)
c = c_template.format(
h_name,
get_arbitrary_messages(db["arbitrary_messages"]),
- get_class_messages(db["class_messages"]),
+ get_class_messages(db["classes"]),
get_turn_thresholds(db["turn_thresholds"]),
get_locations(db["locations"]),
get_object_descriptions(db["object_descriptions"]),
get_obituaries(db["obituaries"]),
- len(db["class_messages"]),
+ len(db["classes"]),
len(db["obituaries"]),
len(db["turn_thresholds"]),
)
SETPRM(3, game.turns, game.turns);
RSPEAK(TOTAL_SCORE);
for (long i = 1; i <= (long)CLSSES; i++) {
- if (CVAL[i] >= points) {
- speak(class_messages[i]);
- i = CVAL[i] + 1 - points;
+ if (classes[i].threshold >= points) {
+ speak(classes[i].message);
+ i = classes[i].threshold + 1 - points;
SETPRM(1, i, i);
RSPEAK(NEXT_HIGHER);
exit(0);