Changeset 895

Show
Ignore:
Timestamp:
05/11/08 22:23:55 (4 months ago)
Author:
takkaria
Message:

Fix #44: (by Rowan Beentje)

  • Replace all instances of rand_int() with randint0()
  • Replace all instances of randint() with randint1()

In addition, the patch:

  • Replaces all instances of rand_die() with randint1()
  • Replaces randint1() with randint0() on line 1649 of effects.c to fix a multihued breath effect error.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/attack.c

    r887 r895  
    7979 
    8080        /* Percentile dice */ 
    81         k = rand_int(100); 
     81        k = randint0(100); 
    8282 
    8383        /* Hack -- Instant miss or hit */ 
     
    8888 
    8989        /* Power competes against armor */ 
    90         if ((chance > 0) && (rand_int(chance) >= (ac * 3 / 4))) return (TRUE); 
     90        if ((chance > 0) && (randint0(chance) >= (ac * 3 / 4))) return (TRUE); 
    9191 
    9292        /* Assume miss */ 
     
    108108 
    109109        /* Critical hit */ 
    110         if (randint(5000) <= i) 
    111         { 
    112                 k = weight + randint(500); 
     110        if (randint1(5000) <= i) 
     111        { 
     112                k = weight + randint1(500); 
    113113 
    114114                if (k < 500) 
     
    147147 
    148148        /* Chance */ 
    149         if (randint(5000) <= i) 
    150         { 
    151                 k = weight + randint(650); 
     149        if (randint1(5000) <= i) 
     150        { 
     151                k = weight + randint1(650); 
    152152 
    153153                if (k < 400) 
     
    524524                                        msg_format("%^s is unaffected.", m_name); 
    525525                                } 
    526                                 else if (rand_int(100) < r_ptr->level) 
     526                                else if (randint0(100) < r_ptr->level) 
    527527                                { 
    528528                                        msg_format("%^s is unaffected.", m_name); 
     
    531531                                { 
    532532                                        msg_format("%^s appears confused.", m_name); 
    533                                         m_ptr->confused += 10 + rand_int(p_ptr->lev) / 5; 
     533                                        m_ptr->confused += 10 + randint0(p_ptr->lev) / 5; 
    534534                                } 
    535535                        } 
  • trunk/src/birth.c

    r887 r895  
    191191                        else if (value < 18+70) 
    192192                        { 
    193                                 value += ((auto_roll ? 15 : randint(15)) + 5); 
     193                                value += ((auto_roll ? 15 : randint1(15)) + 5); 
    194194                        } 
    195195                        else if (value < 18+90) 
    196196                        { 
    197                                 value += ((auto_roll ? 6 : randint(6)) + 2); 
     197                                value += ((auto_roll ? 6 : randint1(6)) + 2); 
    198198                        } 
    199199                        else if (value < 18+100) 
     
    232232                { 
    233233                        /* Roll the dice */ 
    234                         dice[i] = randint(3 + i % 3); 
     234                        dice[i] = randint1(3 + i % 3); 
    235235 
    236236                        /* Collect the maximum */ 
     
    315315                for (i = 1; i < PY_MAX_LEVEL; i++) 
    316316                { 
    317                         j = randint(p_ptr->hitdie); 
     317                        j = randint1(p_ptr->hitdie); 
    318318                        p_ptr->player_hp[i] = p_ptr->player_hp[i-1] + j; 
    319319                } 
     
    360360 
    361361        /* Initial social class */ 
    362         social_class = randint(4); 
     362        social_class = randint1(4); 
    363363 
    364364        /* Starting place */ 
     
    373373 
    374374                /* Roll for nobility */ 
    375                 roll = randint(100); 
     375                roll = randint1(100); 
    376376 
    377377                /* Get the proper entry in the table */ 
     
    405405{ 
    406406        /* Calculate the age */ 
    407         p_ptr->age = rp_ptr->b_age + randint(rp_ptr->m_age); 
     407        p_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age); 
    408408 
    409409        /* Calculate the height/weight for males */ 
     
    435435 
    436436        /* Social Class determines starting gold */ 
    437         gold = (p_ptr->sc * 6) + randint(100) + 300; 
     437        gold = (p_ptr->sc * 6) + randint1(100) + 300; 
    438438 
    439439        /* Process the stats */ 
  • trunk/src/cave.c

    r887 r895  
    352352        { 
    353353                /* Select a random monster */ 
    354                 r_ptr = &r_info[rand_int(z_info->r_max)]; 
     354                r_ptr = &r_info[randint0(z_info->r_max)]; 
    355355                 
    356356                /* Skip non-entries */ 
     
    380380        { 
    381381                /* Select a random object */ 
    382                 k_ptr = &k_info[rand_int(z_info->k_max - 1) + 1]; 
     382                k_ptr = &k_info[randint0(z_info->k_max - 1) + 1]; 
    383383                 
    384384                /* Skip non-entries */ 
     
    726726                        { 
    727727                                /* Multi-hued attr */ 
    728                                 a = randint(15); 
     728                                a = randint1(15); 
    729729                                 
    730730                                /* Normal char */ 
     
    976976                { 
    977977                        /* Normally, make an imaginary monster */ 
    978                         if (rand_int(100) < 75) 
     978                        if (randint0(100) < 75) 
    979979                        { 
    980980                                g->m_idx = 1; 
  • trunk/src/cmd1.c

    r889 r895  
    5050                { 
    5151                        /* Sometimes, notice things */ 
    52                         if (rand_int(100) < chance) 
     52                        if (randint0(100) < chance) 
    5353                        { 
    5454                                /* Invisible trap */ 
  • trunk/src/cmd2.c

    r889 r895  
    229229 
    230230                /* Small chests often drop gold */ 
    231                 if (tiny && (rand_int(100) < 75)) 
     231                if (tiny && (randint0(100) < 75)) 
    232232                        make_gold(i_ptr, value); 
    233233 
     
    295295                if (!(p_ptr->resist_pois || p_ptr->timed[TMD_OPP_POIS])) 
    296296                { 
    297                         (void)inc_timed(TMD_POISONED, 10 + randint(20)); 
     297                        (void)inc_timed(TMD_POISONED, 10 + randint1(20)); 
    298298                } 
    299299        } 
     
    305305                if (!p_ptr->free_act) 
    306306                { 
    307                         (void)inc_timed(TMD_PARALYZED, 10 + randint(20)); 
     307                        (void)inc_timed(TMD_PARALYZED, 10 + randint1(20)); 
    308308                } 
    309309        } 
     
    312312        if (trap & (CHEST_SUMMON)) 
    313313        { 
    314                 int num = 2 + randint(3); 
     314                int num = 2 + randint1(3); 
    315315                msg_print("You are enveloped in a cloud of smoke!"); 
    316316                sound(MSG_SUM_MONSTER); 
     
    370370 
    371371                /* Success -- May still have traps */ 
    372                 if (rand_int(100) < j) 
     372                if (randint0(100) < j) 
    373373                { 
    374374                        message(MSG_LOCKPICK, 0, "You have picked the lock."); 
     
    456456 
    457457        /* Success (get a lot of experience) */ 
    458         else if (rand_int(100) < j) 
     458        else if (randint0(100) < j) 
    459459        { 
    460460                message(MSG_DISARM, 0, "You have disarmed the chest."); 
     
    464464 
    465465        /* Failure -- Keep trying */ 
    466         else if ((i > 5) && (randint(i) > 5)) 
     466        else if ((i > 5) && (randint1(i) > 5)) 
    467467        { 
    468468                /* We may keep trying */ 
     
    691691 
    692692                /* Success */ 
    693                 if (rand_int(100) < j) 
     693                if (randint0(100) < j) 
    694694                { 
    695695                        /* Message */ 
     
    10911091        { 
    10921092                /* Tunnel */ 
    1093                 if ((p_ptr->skills[SKILL_DIGGING] > 40 + rand_int(1600)) && twall(y, x)) 
     1093                if ((p_ptr->skills[SKILL_DIGGING] > 40 + randint0(1600)) && twall(y, x)) 
    10941094                { 
    10951095                        msg_print("You have finished the tunnel."); 
     
    11271127                if (hard) 
    11281128                { 
    1129                         okay = (p_ptr->skills[SKILL_DIGGING] > 20 + rand_int(800)); 
     1129                        okay = (p_ptr->skills[SKILL_DIGGING] > 20 + randint0(800)); 
    11301130                } 
    11311131 
     
    11331133                else 
    11341134                { 
    1135                         okay = (p_ptr->skills[SKILL_DIGGING] > 10 + rand_int(400)); 
     1135                        okay = (p_ptr->skills[SKILL_DIGGING] > 10 + randint0(400)); 
    11361136                } 
    11371137 
     
    11781178        { 
    11791179                /* Remove the rubble */ 
    1180                 if ((p_ptr->skills[SKILL_DIGGING] > rand_int(200)) && twall(y, x)) 
     1180                if ((p_ptr->skills[SKILL_DIGGING] > randint0(200)) && twall(y, x)) 
    11811181                { 
    11821182                        /* Message */ 
     
    11841184 
    11851185                        /* Hack -- place an object */ 
    1186                         if (rand_int(100) < 10) 
     1186                        if (randint0(100) < 10) 
    11871187                        { 
    11881188                                /* Create a simple object */ 
     
    12101210        { 
    12111211                /* Tunnel */ 
    1212                 if ((p_ptr->skills[SKILL_DIGGING] > 30 + rand_int(1200)) && twall(y, x)) 
     1212                if ((p_ptr->skills[SKILL_DIGGING] > 30 + randint0(1200)) && twall(y, x)) 
    12131213                { 
    12141214                        msg_print("You have finished the tunnel."); 
     
    12231223 
    12241224                        /* Occasional Search XXX XXX */ 
    1225                         if (rand_int(100) < 25) search(); 
     1225                        if (randint0(100) < 25) search(); 
    12261226                } 
    12271227        } 
     
    12311231        { 
    12321232                /* Tunnel */ 
    1233                 if ((p_ptr->skills[SKILL_DIGGING] > 30 + rand_int(1200)) && twall(y, x)) 
     1233                if ((p_ptr->skills[SKILL_DIGGING] > 30 + randint0(1200)) && twall(y, x)) 
    12341234                { 
    12351235                        msg_print("You have finished the tunnel."); 
     
    13951395 
    13961396        /* Success */ 
    1397         if (rand_int(100) < j) 
     1397        if (randint0(100) < j) 
    13981398        { 
    13991399                /* Message */ 
     
    14111411 
    14121412        /* Failure -- Keep trying */ 
    1413         else if ((i > 5) && (randint(i) > 5)) 
     1413        else if ((i > 5) && (randint1(i) > 5)) 
    14141414        { 
    14151415                /* Failure */ 
     
    16071607 
    16081608        /* Hack -- attempt to bash down the door */ 
    1609         if (rand_int(100) < temp) 
     1609        if (randint0(100) < temp) 
    16101610        { 
    16111611                /* Break down the door */ 
    1612                 if (rand_int(100) < 50) 
     1612                if (randint0(100) < 50) 
    16131613                { 
    16141614                        cave_set_feat(y, x, FEAT_BROKEN); 
     
    16291629 
    16301630        /* Saving throw against stun */ 
    1631         else if (rand_int(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] + 
     1631        else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] + 
    16321632                 p_ptr->lev) 
    16331633        { 
     
    16461646 
    16471647                /* Hack -- Lose balance ala paralysis */ 
    1648                 (void)inc_timed(TMD_PARALYZED, 2 + rand_int(2)); 
     1648                (void)inc_timed(TMD_PARALYZED, 2 + randint0(2)); 
    16491649        } 
    16501650 
  • trunk/src/cmd5.c

    r887 r895  
    541541 
    542542                /* Apply the randomizer */ 
    543                 if ((++k > 1) && (rand_int(k) != 0)) continue; 
     543                if ((++k > 1) && (randint0(k) != 0)) continue; 
    544544 
    545545                /* Track it */ 
     
    628628 
    629629        /* Failed spell */ 
    630         if (rand_int(100) < chance) 
     630        if (randint0(100) < chance) 
    631631        { 
    632632                if (flush_failure) flush(); 
     
    677677 
    678678                /* Hack -- Bypass free action */ 
    679                 (void)inc_timed(TMD_PARALYZED, randint(5 * oops + 1)); 
     679                (void)inc_timed(TMD_PARALYZED, randint1(5 * oops + 1)); 
    680680 
    681681                /* Damage CON (possibly permanently) */ 
    682                 if (rand_int(100) < 50) 
    683                 { 
    684                         bool perm = (rand_int(100) < 25); 
     682                if (randint0(100) < 50) 
     683                { 
     684                        bool perm = (randint0(100) < 25); 
    685685 
    686686                        /* Message */ 
     
    688688 
    689689                        /* Reduce constitution */ 
    690                         (void)dec_stat(A_CON, 15 + randint(10), perm); 
     690                        (void)dec_stat(A_CON, 15 + randint1(10), perm); 
    691691                } 
    692692        } 
  • trunk/src/cmd6.c

    r887 r895  
    6565 
    6666        /* Roll for usage */ 
    67         if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE)) 
     67        if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE)) 
    6868        { 
    6969                if (flush_failure) flush(); 
  • trunk/src/dungeon.c

    r887 r895  
    656656                                while (1) 
    657657                                { 
    658                                         n = rand_int(MAX_STORES); 
     658                                        n = randint0(MAX_STORES); 
    659659                                        if (n != STORE_HOME) break; 
    660660                                } 
     
    785785 
    786786                                /* Hack -- faint (bypass free action) */ 
    787                                 (void)inc_timed(TMD_PARALYZED, 1 + rand_int(5)); 
     787                                (void)inc_timed(TMD_PARALYZED, 1 + randint0(5)); 
    788788                        } 
    789789                } 
     
    18031803 
    18041804                /* Hack -- seed for flavors */ 
    1805                 seed_flavor = rand_int(0x10000000); 
     1805                seed_flavor = randint0(0x10000000); 
    18061806 
    18071807                /* Hack -- seed for town layout */ 
    1808                 seed_town = rand_int(0x10000000); 
     1808                seed_town = randint0(0x10000000); 
    18091809 
    18101810                /* Hack -- seed for random artifacts */ 
    1811                 seed_randart = rand_int(0x10000000); 
     1811                seed_randart = randint0(0x10000000); 
    18121812 
    18131813                /* Roll up a new character. Quickstart is allowed if ht_birth is set */ 
  • trunk/src/effects.c

    r761 r895  
    178178                case EF_SCARE: 
    179179                { 
    180                         if (!p_ptr->resist_fear && inc_timed(TMD_AFRAID, rand_int(10) + 10)) 
     180                        if (!p_ptr->resist_fear && inc_timed(TMD_AFRAID, randint0(10) + 10)) 
    181181                                *ident = TRUE; 
    182182 
     
    194194                case EF_HALLUC: 
    195195                { 
    196                         if (!p_ptr->resist_chaos && inc_timed(TMD_IMAGE, rand_int(250) + 250)) 
     196                        if (!p_ptr->resist_chaos && inc_timed(TMD_IMAGE, randint0(250) + 250)) 
    197197                                *ident = TRUE; 
    198198 
     
    202202                case EF_PARALYZE: 
    203203                { 
    204                         if (!p_ptr->free_act && inc_timed(TMD_PARALYZED, rand_int(5) + 5)) 
     204                        if (!p_ptr->free_act && inc_timed(TMD_PARALYZED, randint0(5) + 5)) 
    205205                                *ident = TRUE; 
    206206 
     
    210210                case EF_SLOW: 
    211211                { 
    212                         if (inc_timed(TMD_SLOW, randint(25) + 15)) *ident = TRUE; 
     212                        if (inc_timed(TMD_SLOW, randint1(25) + 15)) *ident = TRUE; 
    213213                        return TRUE; 
    214214                } 
     
    414414                { 
    415415                        /* Pick a random stat to decrease other than strength */ 
    416                         int stat = rand_int(A_MAX-1) + 1; 
     416                        int stat = randint0(A_MAX-1) + 1; 
    417417                         
    418418                        if (!do_dec_stat(stat, TRUE)) return FALSE; 
     
    424424                { 
    425425                        /* Pick a random stat to decrease other than intelligence */ 
    426                         int stat = rand_int(A_MAX-1); 
     426                        int stat = randint0(A_MAX-1); 
    427427                        if (stat >= A_INT) stat++; 
    428428                         
     
    435435                { 
    436436                        /* Pick a random stat to decrease other than wisdom */ 
    437                         int stat = rand_int(A_MAX-1); 
     437                        int stat = randint0(A_MAX-1); 
    438438                        if (stat >= A_WIS) stat++; 
    439439                         
     
    446446                { 
    447447                        /* Pick a random stat to decrease other than constitution */ 
    448                         int stat = rand_int(A_MAX-1); 
     448                        int stat = randint0(A_MAX-1); 
    449449                        if (stat >= A_CON) stat++; 
    450450                         
     
    457457                { 
    458458                        /* Pick a random stat to decrease other than dexterity */ 
    459                         int stat = rand_int(A_MAX-1); 
     459                        int stat = randint0(A_MAX-1); 
    460460                        if (stat >= A_DEX) stat++; 
    461461                         
     
    468468                { 
    469469                        /* Pick a random stat to decrease other than charisma */ 
    470                         int stat = rand_int(A_MAX-1); 
     470                        int stat = randint0(A_MAX-1); 
    471471                         
    472472                        if (!do_dec_stat(stat, TRUE)) return FALSE; 
     
    618618                        if (hp_player(10)) *ident = TRUE; 
    619619                        if (clear_timed(TMD_AFRAID)) *ident = TRUE; 
    620                         if (inc_timed(TMD_HERO, randint(25) + 25)) *ident = TRUE; 
     620                        if (inc_timed(TMD_HERO, randint1(25) + 25)) *ident = TRUE; 
    621621                        return TRUE; 
    622622                } 
     
    626626                        if (hp_player(30)) *ident = TRUE; 
    627627                        if (clear_timed(TMD_AFRAID)) *ident = TRUE; 
    628                         if (inc_timed(TMD_SHERO, randint(25) + 25)) *ident = TRUE; 
     628                        if (inc_timed(TMD_SHERO, randint1(25) + 25)) *ident = TRUE; 
    629629                        return TRUE; 
    630630                } 
     
    668668                case EF_RESIST_ALL: 
    669669                { 
    670                         if (inc_timed(TMD_OPP_ACID, randint(20) + 20)) *ident = TRUE; 
    671                         if (inc_timed(TMD_OPP_ELEC, randint(20) + 20)) *ident = TRUE; 
    672                         if (inc_timed(TMD_OPP_FIRE, randint(20) + 20)) *ident = TRUE; 
    673                         if (inc_timed(TMD_OPP_COLD, randint(20) + 20)) *ident = TRUE; 
    674                         if (inc_timed(TMD_OPP_POIS, randint(20) + 20)) *ident = TRUE; 
     670                        if (inc_timed(TMD_OPP_ACID, randint1(20) + 20)) *ident = TRUE; 
     671                        if (inc_timed(TMD_OPP_ELEC, randint1(20) + 20)) *ident = TRUE; 
     672                        if (inc_timed(TMD_OPP_FIRE, randint1(20) + 20)) *ident = TRUE; 
     673                        if (inc_timed(TMD_OPP_COLD, randint1(20) + 20)) *ident = TRUE; 
     674                        if (inc_timed(TMD_OPP_POIS, randint1(20) + 20)) *ident = TRUE; 
    675675                        return TRUE; 
    676676                } 
     
    730730                { 
    731731                        *ident = TRUE; 
    732                         if (!enchant_spell(randint(3), randint(3), 0)) return FALSE; 
     732                        if (!enchant_spell(randint1(3), randint1(3), 0)) return FALSE; 
    733733                        return TRUE; 
    734734                } 
     
    744744                { 
    745745                        *ident = TRUE; 
    746                         if (!enchant_spell(0, 0, randint(3) + 2)) return FALSE; 
     746                        if (!enchant_spell(0, 0, randint1(3) + 2)) return FALSE; 
    747747                        return TRUE; 
    748748                } 
     
    787787                        sound(MSG_SUM_MONSTER); 
    788788 
    789                         for (i = 0; i < randint(3); i++) 
     789                        for (i = 0; i < randint1(3); i++) 
    790790                        { 
    791791                                if (summon_specific(py, px, p_ptr->depth, 0)) 
     
    800800                        sound(MSG_SUM_UNDEAD); 
    801801 
    802                         for (i = 0; i < randint(3); i++) 
     802                        for (i = 0; i < randint1(3); i++) 
    803803                        { 
    804804                                if (summon_specific(py, px, p_ptr->depth, SUMMON_UNDEAD)) 
     
    863863                case EF_ACQUIRE2: 
    864864                { 
    865                         acquirement(py, px, p_ptr->depth, randint(2) + 1, TRUE); 
     865                        acquirement(py, px, p_ptr->depth, randint1(2) + 1, TRUE); 
    866866                        *ident = TRUE; 
    867867                        return TRUE; 
     
    906906                        if (!p_ptr->resist_blind) 
    907907                        { 
    908                                 (void)inc_timed(TMD_BLIND, 3 + randint(5)); 
     908                                (void)inc_timed(TMD_BLIND, 3 + randint1(5)); 
    909909                        } 
    910910                        if (unlite_area(10, 3)) *ident = TRUE; 
     
    914914                case EF_PROTEVIL: 
    915915                { 
    916                         if (inc_timed(TMD_PROTEVIL, randint(25) + 3 * p_ptr->lev)) *ident = TRUE; 
     916                        if (inc_timed(TMD_PROTEVIL, randint1(25) + 3 * p_ptr->lev)) *ident = TRUE; 
    917917                        return TRUE; 
    918918                } 
     
    938938                case EF_BLESSING: 
    939939                { 
    940                         if (inc_timed(TMD_BLESSED, randint(12) + 6)) *ident = TRUE; 
     940                        if (inc_timed(TMD_BLESSED, randint1(12) + 6)) *ident = TRUE; 
    941941                        return TRUE; 
    942942                } 
     
    944944                case EF_BLESSING2: 
    945945                { 
    946                         if (inc_timed(TMD_BLESSED, randint(24) + 12)) *ident = TRUE; 
     946                        if (inc_timed(TMD_BLESSED, randint1(24) + 12)) *ident = TRUE; 
    947947                        return TRUE; 
    948948                } 
     
    950950                case EF_BLESSING3: 
    951951                { 
    952                         if (inc_timed(TMD_BLESSED, randint(48) + 24)) *ident = TRUE; 
     952                        if (inc_timed(TMD_BLESSED, randint1(48) + 24)) *ident = TRUE; 
    953953                        return TRUE; 
    954954                } 
     
    10581058                        (void)hp_player(30); 
    10591059                        (void)clear_timed(TMD_AFRAID); 
    1060                         (void)inc_timed(TMD_SHERO, randint(50) + 50); 
    1061                         (void)inc_timed(TMD_BLESSED, randint(50) + 50); 
    1062                         (void)inc_timed(TMD_OPP_ACID, randint(50) + 50); 
    1063                         (void)inc_timed(TMD_OPP_ELEC, randint(50) + 50); 
    1064                         (void)inc_timed(TMD_OPP_FIRE, randint(50) + 50); 
    1065                         (void)inc_timed(TMD_OPP_COLD, randint(50) + 50); 
    1066                         (void)inc_timed(TMD_OPP_POIS, randint(50) + 50); 
     1060                        (void)inc_timed(TMD_SHERO, randint1(50) + 50); 
     1061                        (void)inc_timed(TMD_BLESSED, randint1(50) + 50); 
     1062                        (void)inc_timed(TMD_OPP_ACID, randint1(50) + 50); 
     1063                        (void)inc_timed(TMD_OPP_ELEC, randint1(50) + 50); 
     1064                        (void)inc_timed(TMD_OPP_FIRE, randint1(50) + 50); 
     1065                        (void)inc_timed(TMD_OPP_COLD, randint1(50) + 50); 
     1066                        (void)inc_timed(TMD_OPP_POIS, randint1(50) + 50); 
    10671067                        return TRUE; 
    10681068                } 
     
    11321132                        if (!p_ptr->timed[TMD_FAST]) 
    11331133                        { 
    1134                                 if (set_timed(TMD_FAST, randint(20) + 20)) *ident = TRUE; 
     1134                                if (set_timed(TMD_FAST, randint1(20) + 20)) *ident = TRUE; 
    11351135                        } 
    11361136                        else 
     
    11461146                        if (!p_ptr->timed[TMD_FAST]) 
    11471147                        { 
    1148                                 if (set_timed(TMD_FAST, randint(75) + 75)) *ident = TRUE; 
     1148                                if (set_timed(TMD_FAST, randint1(75) + 75)) *ident = TRUE; 
    11491149                        } 
    11501150                        else 
     
    14541454                case EF_BERSERKER: 
    14551455                { 
    1456                         if (inc_timed(TMD_SHERO, randint(50) + 50)) *ident = TRUE; 
     1456                        if (inc_timed(TMD_SHERO, randint1(50) + 50)) *ident = TRUE; 
    14571457                        return TRUE; 
    14581458                } 
     
    14611461                case EF_WONDER: 
    14621462                { 
    1463                         if (spell_wonder(dir, randint(100) + p_ptr->lev / 5, beam)) *ident = TRUE; 
     1463                        if (spell_wonder(dir, randint1(100) + p_ptr->lev / 5, beam)) *ident = TRUE; 
    14641464                        return TRUE; 
    14651465                } 
     
    14781478                        }; 
    14791479                        /* pick a random (type, damage) tuple in the table */ 
    1480                         int which = 2 * rand_int(sizeof(breath_types) / (2 * sizeof(int))); 
     1480                        int which = 2 * randint0(sizeof(breath_types) / (2 * sizeof(int))); 
    14811481                        if (fire_ball(breath_types[which], dir, breath_types[which + 1], 3)) 
    14821482                                *ident = TRUE; 
     
    15011501                { 
    15021502                        if (dispel_evil(120)) *ident = TRUE; 
    1503                         if (inc_timed(TMD_PROTEVIL, randint(25) + 3 * p_ptr->lev)) *ident = TRUE; 
     1503                        if (inc_timed(TMD_PROTEVIL, randint1(25) + 3 * p_ptr->lev)) *ident = TRUE; 
    15041504                        if (clear_timed(TMD_POISONED)) *ident = TRUE; 
    15051505                        if (clear_timed(TMD_AFRAID)) *ident = TRUE; 
     
    15791579                        *ident = TRUE; 
    15801580                        fire_ball(GF_ACID, dir, 70, 2); 
    1581                         inc_timed(TMD_OPP_ACID, randint(20) + 20); 
     1581                        inc_timed(TMD_OPP_ACID, randint1(20) + 20); 
    15821582                        return TRUE; 
    15831583                } 
     
    15871587                        *ident = TRUE; 
    15881588                        fire_ball(GF_FIRE, dir, 80, 2); 
    1589                         inc_timed(TMD_OPP_FIRE, randint(20) + 20); 
     1589                        inc_timed(TMD_OPP_FIRE, randint1(20) + 20); 
    15901590                        return TRUE; 
    15911591                } 
     
    15951595                        *ident = TRUE; 
    15961596                        fire_ball(GF_COLD, dir, 75, 2); 
    1597                         inc_timed(TMD_OPP_COLD, randint(20) + 20); 
     1597                        inc_timed(TMD_OPP_COLD, randint1(20) + 20); 
    15981598                        return TRUE; 
    15991599                } 
     
    16031603                        *ident = TRUE; 
    16041604                        fire_ball(GF_ELEC, dir, 85, 2); 
    1605                         inc_timed(TMD_OPP_ELEC, randint(20) + 20); 
     1605                        inc_timed(TMD_OPP_ELEC, randint1(20) + 20); 
    16061606                        return TRUE; 
    16071607                } 
     
    16471647                        }; 
    16481648 
    1649                         int chance = randint(5); 
     1649                        int chance = randint0(5); 
    16501650                        sound(mh[chance].sound); 
    16511651                        msg_format("You breathe %s.", mh[chance].msg); 
     
    16721672                case EF_DRAGON_CHAOS: 
    16731673                { 
    1674                         int chance = rand_int(2); 
     1674                        int chance = randint0(2); 
    16751675                        sound(((chance == 1 ? MSG_BR_CHAOS : MSG_BR_DISENCHANT))); 
    16761676                        msg_format("You breathe %s.", 
     
    16831683                case EF_DRAGON_LAW: 
    16841684                { 
    1685                         int chance = rand_int(2); 
     1685                        int chance = randint0(2); 
    16861686                        sound(((chance == 1 ? MSG_BR_SOUND : MSG_BR_SHARDS))); 
    16871687                        msg_format("You breathe %s.", 
     
    16941694                case EF_DRAGON_BALANCE: 
    16951695                { 
    1696                         int chance = rand_int(4); 
     1696                        int chance = randint0(4); 
    16971697                        msg_format("You breathe %s.", 
    16981698                                   ((chance == 1) ? "chaos" : 
     
    17081708                case EF_DRAGON_SHINING: 
    17091709                { 
    1710                         int chance = rand_int(2); 
     1710                        int chance = randint0(2); 
    17111711                        sound(((chance == 0 ? MSG_BR_LIGHT : MSG_BR_DARK))); 
    17121712                        msg_format("You breathe %s.", 
  • trunk/src/generate.c

    <
    r849 r895  
    283283        if (*rdir && *cdir) 
    284284        { 
    285                 if (rand_int(100) < 50) 
     285                if (randint0(100) < 50) 
    286286                { 
    287287                        *rdir = 0; 
     
    301301{ 
    302302        /* Pick a random direction */ 
    303         int i = rand_int(4); 
     303        int i = randint0(4); 
    304304 
    305305        /* Extract the dy/dx components */ 
     
    419419                place_up_stairs(y, x); 
    420420        } 
    421         else if (rand_int(100) < 50) 
     421        else if (randint0(100) < 50) 
    422422        { 
    423423                place_down_stairs(y, x); 
     
    448448                        { 
    449449                                /* Pick a random grid */ 
    450                                 y = rand_int(DUNGEON_HGT); 
    451                                 x = rand_int(DUNGEON_WID);