| 1168 | } |
| 1169 | |
| 1170 | staticfn int |
| 1171 | optfn_boulder( |
| 1172 | int optidx UNUSED, int req, boolean negated UNUSED, |
| 1173 | char *opts, char *op UNUSED) |
| 1174 | { |
| 1175 | #ifdef BACKWARD_COMPAT |
| 1176 | int clash = 0; |
| 1177 | #endif |
| 1178 | |
| 1179 | if (req == do_init) { |
| 1180 | return optn_ok; |
| 1181 | } |
| 1182 | if (req == do_set) { |
| 1183 | /* boulder:symbol */ |
| 1184 | |
| 1185 | #ifdef BACKWARD_COMPAT |
| 1186 | |
| 1187 | /* if ((opts = string_for_env_opt(allopt[optidx].name, opts, FALSE)) |
| 1188 | == empty_optstr) |
| 1189 | */ |
| 1190 | if ((opts = string_for_opt(opts, FALSE)) == empty_optstr) |
| 1191 | return FALSE; |
| 1192 | escapes(opts, opts); |
| 1193 | /* note: dummy monclass #0 has symbol value '\0'; we allow that-- |
| 1194 | attempting to set bouldersym to '^@'/'\0' will reset to default */ |
| 1195 | if (def_char_to_monclass(opts[0]) != MAXMCLASSES) |
| 1196 | clash = opts[0] ? 1 : 0; |
| 1197 | else if (opts[0] >= '1' && opts[0] < WARNCOUNT + '0') |
| 1198 | clash = 2; |
| 1199 | if (opts[0] < ' ') { |
| 1200 | config_error_add("boulder symbol cannot be a control character"); |
| 1201 | return optn_ok; |
| 1202 | } else if (clash) { |
| 1203 | /* symbol chosen matches a used monster or warning |
| 1204 | symbol which is not good - reject it */ |
| 1205 | config_error_add("Badoption - boulder symbol '%s' would conflict " |
| 1206 | "with a %s symbol", |
| 1207 | visctrl(opts[0]), |
| 1208 | (clash == 1) ? "monster" : "warning"); |
| 1209 | } else { |
| 1210 | /* |
| 1211 | * Override the default boulder symbol. |
| 1212 | */ |
| 1213 | go.ov_primary_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0]; |
| 1214 | go.ov_rogue_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0]; |
| 1215 | /* for 'initial', update of BOULDER symbol is done in |
| 1216 | initoptions_finish(), after all symset options |
| 1217 | have been processed */ |
| 1218 | if (!go.opt_initial) { |
| 1219 | nhsym sym = get_othersym(SYM_BOULDER, |
| 1220 | Is_rogue_level(&u.uz) ? ROGUESET |
| 1221 | : PRIMARYSET); |
| 1222 | |
| 1223 | if (sym) |
| 1224 | gs.showsyms[SYM_BOULDER + SYM_OFF_X] = sym; |
| 1225 | go.opt_need_redraw = TRUE; |
| 1226 | } |
| 1227 | } |
nothing calls this directly
no test coverage detected