OSDN Git Service

[Refactor] #37353 メッセージ整理。 / Refactor messages.
[hengband/hengband.git] / src / z-rand.c
index 9ca8786..af0ac90 100644 (file)
@@ -192,10 +192,11 @@ void Rand_state_init(void)
 #ifdef RNG_DEVICE
 
        FILE *fp = fopen(RNG_DEVICE, "r");
+       int n;
        
        do {
-               fread(Rand_state, sizeof(Rand_state[0]), 4, fp);
-       } while ((Rand_state[0] | Rand_state[1] | Rand_state[2] | Rand_state[3]) == 0);
+               n = fread(Rand_state, sizeof(Rand_state[0]), 4, fp);
+       } while (n != 4 || (Rand_state[0] | Rand_state[1] | Rand_state[2] | Rand_state[3]) == 0);
        
        fclose(fp);
 
@@ -400,7 +401,7 @@ s16b randnor(int mean, int stand)
 /*
  * Generates damage for "2d6" style dice rolls
  */
-s16b damroll(int num, int sides)
+s16b damroll(DICE_NUMBER num, DICE_SID sides)
 {
        int i, sum = 0;
        for (i = 0; i < num; i++) sum += randint1(sides);
@@ -411,7 +412,7 @@ s16b damroll(int num, int sides)
 /*
  * Same as above, but always maximal
  */
-s16b maxroll(int num, int sides)
+s16b maxroll(DICE_NUMBER num, DICE_SID sides)
 {
        return (num * sides);
 }
@@ -453,7 +454,7 @@ s32b div_round(s32b n, s32b d)
  * "external" program parts like the main-*.c files.  It preserves
  * the current RNG state to prevent influences on game-play.
  *
- * Could also use rand() from <stdlib.h> directly. XXX XXX XXX
+ * Could also use rand() from <stdlib.h> directly. 
  */
 s32b Rand_external(s32b m)
 {