--- deliantra/server/common/treasure.C 2007/01/15 21:06:18 1.32 +++ deliantra/server/common/treasure.C 2007/01/18 19:42:09 1.33 @@ -333,7 +333,7 @@ { object *tmp; - if ((int) t->chance >= 100 || (RANDOM () % 100 + 1) < (int) t->chance) + if ((int) t->chance >= 100 || (rndm (100) + 1) < (int) t->chance) { if (t->name) { @@ -572,7 +572,7 @@ if (scaled_diff >= DIFFLEVELS) scaled_diff = DIFFLEVELS - 1; - percent = RANDOM () % 100; + percent = rndm (100); for (magic = 0; magic < (MAXMAGIC + 1); magic++) { @@ -588,7 +588,7 @@ magic = 0; } - magic = (RANDOM () % 3) ? magic : -magic; + magic = (rndm (3)) ? magic : -magic; /* LOG(llevDebug, "Chose magic %d for difficulty (scaled %d) %d\n", magic, scaled_diff, difficulty); */ return magic; @@ -613,7 +613,7 @@ if (op->type == ARMOUR) ARMOUR_SPEED (op) = (ARMOUR_SPEED (&op->arch->clone) * (100 + magic * 10)) / 100; - if (magic < 0 && !(RANDOM () % 3)) /* You can't just check the weight always */ + if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */ magic = (-magic); op->weight = (op->arch->clone.weight * (100 - magic * 10)) / 100; } @@ -621,7 +621,7 @@ { if (op->type == ARMOUR) ARMOUR_SPEED (op) = (ARMOUR_SPEED (op) * (100 + magic * 10)) / 100; - if (magic < 0 && !(RANDOM () % 3)) /* You can't just check the weight always */ + if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */ magic = (-magic); op->weight = (op->weight * (100 - magic * 10)) / 100; } @@ -664,14 +664,14 @@ if (op->type == AMULET) { - if (!(RANDOM () % 21)) - r = 20 + RANDOM () % 2; + if (!(rndm (21))) + r = 20 + rndm (2); else { if (RANDOM () & 2) r = 10; else - r = 11 + RANDOM () % 9; + r = 11 + rndm (9); } } @@ -805,7 +805,7 @@ } #define DICE2 (get_magic(2)==2?2:1) -#define DICESPELL (RANDOM()%3+RANDOM()%3+RANDOM()%3+RANDOM()%3+RANDOM()%3) +#define DICESPELL (rndm (3)+RANDOM()%3+RANDOM()%3+RANDOM()%3+RANDOM()%3) /* * fix_generated_item(): This is called after an item is generated, in @@ -944,7 +944,7 @@ case SHIELD: case HELMET: case CLOAK: - if (QUERY_FLAG (op, FLAG_CURSED) && !(RANDOM () % 4)) + if (QUERY_FLAG (op, FLAG_CURSED) && !(rndm (4))) set_ring_bonus (op, -DICE2); break; @@ -993,7 +993,7 @@ op->name_pl = "potions"; } - if (!(flags & GT_ONLY_GOOD) && RANDOM () % 2) + if (!(flags & GT_ONLY_GOOD) && rndm (2)) SET_FLAG (op, FLAG_CURSED); break; } @@ -1013,7 +1013,7 @@ if (op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact! */ break; - if (!(flags & GT_ONLY_GOOD) && !(RANDOM () % 3)) + if (!(flags & GT_ONLY_GOOD) && !(rndm (3))) SET_FLAG (op, FLAG_CURSED); set_ring_bonus (op, QUERY_FLAG (op, FLAG_CURSED) ? -DICE2 : DICE2); @@ -1021,18 +1021,18 @@ if (op->type != RING) /* Amulets have only one ability */ break; - if (!(RANDOM () % 4)) + if (!(rndm (4))) { - int d = (RANDOM () % 2 || QUERY_FLAG (op, FLAG_CURSED)) ? -DICE2 : DICE2; + int d = (rndm (2) || QUERY_FLAG (op, FLAG_CURSED)) ? -DICE2 : DICE2; if (d > 0) op->value *= 3; set_ring_bonus (op, d); - if (!(RANDOM () % 4)) + if (!(rndm (4))) { - int d = (RANDOM () % 3 || QUERY_FLAG (op, FLAG_CURSED)) ? -DICE2 : DICE2; + int d = (rndm (3) || QUERY_FLAG (op, FLAG_CURSED)) ? -DICE2 : DICE2; if (d > 0) op->value *= 5; @@ -1050,15 +1050,15 @@ * msg for it, and tailor its properties based on theĀ· * creator and/or map level we found it on. */ - if (!op->msg && RANDOM () % 10) + if (!op->msg && rndm (10)) { /* set the book level properly */ if (creator->level == 0 || QUERY_FLAG (creator, FLAG_ALIVE)) { if (op->map && op->map->difficulty) - op->level = RANDOM () % (op->map->difficulty) + RANDOM () % 10 + 1; + op->level = RANDOM () % (op->map->difficulty) + rndm (10) + 1; else - op->level = RANDOM () % 20 + 1; + op->level = rndm (20) + 1; } else op->level = RANDOM () % creator->level;