MCPcopy Create free account
hub / github.com/NetHack/NetHack / shuffle_all

Function shuffle_all

src/o_init.c:321–347  ·  view source on GitHub ↗

randomize object descriptions */

Source from the content-addressed store, hash-verified

319
320/* randomize object descriptions */
321staticfn void
322shuffle_all(void)
323{
324 /* entire classes; obj_shuffle_range() handles their exceptions */
325 static char shuffle_classes[] = {
326 AMULET_CLASS, POTION_CLASS, RING_CLASS, SCROLL_CLASS,
327 SPBOOK_CLASS, WAND_CLASS, VENOM_CLASS,
328 };
329 /* sub-class type ranges (one item from each group) */
330 static short shuffle_types[] = {
331 HELMET, LEATHER_GLOVES, CLOAK_OF_PROTECTION, SPEED_BOOTS,
332 };
333 int first, last, idx;
334
335 /* do whole classes (amulets, &c) */
336 for (idx = 0; idx < SIZE(shuffle_classes); idx++) {
337 obj_shuffle_range(svb.bases[(int) shuffle_classes[idx]],
338 &first, &last);
339 shuffle(first, last, TRUE);
340 }
341 /* do type ranges (helms, &c) */
342 for (idx = 0; idx < SIZE(shuffle_types); idx++) {
343 obj_shuffle_range(shuffle_types[idx], &first, &last);
344 shuffle(first, last, FALSE);
345 }
346 return;
347}
348
349/* Return TRUE if the provided string matches the unidentified description of
350 * the provided object. */

Callers 1

init_objectsFunction · 0.85

Calls 2

obj_shuffle_rangeFunction · 0.85
shuffleFunction · 0.85

Tested by

no test coverage detected