void init_opt_struct(void) { options = clone_optlist(const_options); birth_options = clone_optlist(const_birth_options); build_role_spec(); build_race_spec(); /* initialize option definitions */ find_option(options, "comment")->s.maxlen = BUFSZ; find_option(options, "disclose")->e = disclose_spec; find_option(options, "fruit")->s.maxlen = PL_FSIZ; find_option(options, "menustyle")->e = menustyle_spec; find_option(options, "pickup_burden")->e = pickup_burden_spec; find_option(options, "packorder")->s.maxlen = MAXOCLASSES; find_option(options, "runmode")->e = runmode_spec; find_option(options, "autopickup_rules")->a = autopickup_spec; find_option(birth_options, "align")->e = align_spec; find_option(birth_options, "gender")->e = gender_spec; find_option(birth_options, "role")->e = role_spec; find_option(birth_options, "race")->e = race_spec; find_option(birth_options, "pettype")->e = pettype_spec; find_option(birth_options, "catname")->s.maxlen = PL_PSIZ; find_option(birth_options, "dogname")->s.maxlen = PL_PSIZ; find_option(birth_options, "horsename")->s.maxlen = PL_PSIZ; /* If no config file exists, these values will not get set until they have already been used during game startup. (-1) is a much better default, as 0 will always cause a lawful male Archologist to be created */ flags.init_align = flags.init_gend = flags.init_race = flags.init_role = -1; }
struct nh_option_desc * new_opt_struct(void) { struct nh_option_desc *options = nhlib_clone_optlist(const_options); build_role_spec(); build_race_spec(); /* initialize option definitions */ nhlib_find_option(options, "disclose")->e = disclose_spec; nhlib_find_option(options, "menustyle")->e = menustyle_spec; nhlib_find_option(options, "movecommand")->e = movecommand_spec; nhlib_find_option(options, "pickup_burden")->e = pickup_burden_spec; nhlib_find_option(options, "autopickup_rules")->a = autopickup_spec; nhlib_find_option(options, "name")->s.maxlen = PL_NSIZ; nhlib_find_option(options, "seed")->s.maxlen = RNG_SEED_SIZE_BASE64; nhlib_find_option(options, "mode")->e = mode_spec; nhlib_find_option(options, "timezone")->e = timezone_spec; nhlib_find_option(options, "polyinit")->e = polyinit_spec; nhlib_find_option(options, "align")->e = align_spec; nhlib_find_option(options, "gender")->e = gender_spec; nhlib_find_option(options, "role")->e = role_spec; nhlib_find_option(options, "race")->e = race_spec; nhlib_find_option(options, "pettype")->e = pettype_spec; nhlib_find_option(options, "catname")->s.maxlen = PL_PSIZ; nhlib_find_option(options, "dogname")->s.maxlen = PL_PSIZ; nhlib_find_option(options, "horsename")->s.maxlen = PL_PSIZ; struct nh_option_desc *fruit = nhlib_find_option(options, "fruit"); const char *def_fruit = "melon"; fruit->s.maxlen = PL_FSIZ; fruit->value.s = malloc(strlen(def_fruit)+1); strcpy(fruit->value.s, def_fruit); struct nh_option_desc *packorder = nhlib_find_option(options, "packorder"); const char *def_packorder = "$\")[%?+!=/(*`0_"; packorder->s.maxlen = MAXOCLASSES; packorder->value.s = malloc(strlen(def_packorder)+1); strcpy(packorder->value.s, def_packorder); return options; }
void init_opt_struct(void) { options = clone_optlist(const_options); birth_options = clone_optlist(const_birth_options); build_role_spec(); build_race_spec(); /* initialize option definitions */ find_option(options, "disclose")->e = disclose_spec; find_option(options, "fruit")->s.maxlen = PL_FSIZ; find_option(options, "hp_notify_format")->s.maxlen = 80; /* min term width */ find_option(options, "menumatch")->e = menumatch_spec; find_option(options, "menustyle")->e = menustyle_spec; find_option(options, "pickup_burden")->e = pickup_burden_spec; find_option(options, "packorder")->s.maxlen = MAXOCLASSES; find_option(options, "pilesize")->i.min = 1; find_option(options, "pilesize")->i.max = 20; find_option(options, "runmode")->e = runmode_spec; find_option(options, "safe_peaceful")->e = safe_peaceful_spec; find_option(options, "sparkle")->i.min = 0; find_option(options, "sparkle")->i.max = 21; /* SHIELD_COUNT in display.h */ find_option(options, "spellorder")->s.maxlen = 78; /* "a-bc-d...Y-Z" */ find_option(options, "autopickup_rules")->a = autopickup_spec; find_option(birth_options, "align")->e = align_spec; find_option(birth_options, "gender")->e = gender_spec; find_option(birth_options, "role")->e = role_spec; find_option(birth_options, "race")->e = race_spec; find_option(birth_options, "pettype")->e = pettype_spec; find_option(birth_options, "catname")->s.maxlen = PL_PSIZ; find_option(birth_options, "dogname")->s.maxlen = PL_PSIZ; find_option(birth_options, "horsename")->s.maxlen = PL_PSIZ; find_option(birth_options, "crocname")->s.maxlen = PL_PSIZ; find_option(birth_options, "monkeyname")->s.maxlen = PL_PSIZ; find_option(birth_options, "wolfname")->s.maxlen = PL_PSIZ; find_option(birth_options, "ratname")->s.maxlen = PL_PSIZ; /* If no config file exists, these values will not get set until they * have already been used during game startup. (-1) is a much better * default, as 0 will always cause a lawful male Archologist to be created */ flags.init_align = flags.init_gend = flags.init_race = flags.init_role = -1; }