OSDN Git Service

[Refactor] #37353 ソースファイル改名。
[hengband/hengband.git] / src / util.c
index 26f8ff1..4651323 100644 (file)
@@ -696,7 +696,7 @@ errr fd_copy(cptr file, cptr what)
  * of "O_RDONLY", "O_WRONLY", and "O_RDWR" in "A-win-h", and then
  * we must simulate the effect of the proper "open()" call below.
  */
-int fd_make(cptr file, int mode)
+int fd_make(cptr file, BIT_FLAGS mode)
 {
        char buf[1024];
 
@@ -1760,7 +1760,7 @@ void select_floor_music(void)
                return;
        }
 
-       for(i = 0; i < max_quests; i++)
+       for(i = 0; i < max_q_idx; i++)
        { // TODO マクロで類似条件を統合すること
                if(quest[i].status == QUEST_STATUS_TAKEN &&
                        (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_RANDOM) &&
@@ -2351,9 +2351,9 @@ void quark_init(void)
 /*
  * Add a new "quark" to the set of quarks.
  */
-s16b quark_add(cptr str)
+u16b quark_add(cptr str)
 {
-       int i;
+       u16b i;
 
        /* Look for an existing quark */
        for (i = 1; i < quark__num; i++)
@@ -2477,7 +2477,8 @@ cptr message_str(int age)
  */
 void message_add(cptr str)
 {
-       int i, k, x, m, n;
+       u32b i, n;
+       int k, x, m;
 
        char u[4096];
        char splitted1[81];
@@ -2869,11 +2870,11 @@ void msg_print(cptr msg)
        }
        else
        {
-               sprintf(buf, ("T:%d - %s"), turn, msg);
+               sprintf(buf, ("T:%d - %s"), (int)turn, msg);
        }
 
        /* New Message Length */
-       n = (buf ? strlen(buf) : 0);
+       n = strlen(buf);
 
        /* Memorize the message */
        if (character_generated) message_add(buf);
@@ -3658,7 +3659,7 @@ bool get_check(cptr prompt)
  * mode & CHECK_NO_HISTORY  : no message_add
  * mode & CHECK_DEFAULT_Y   : accept any key as y, except n and Esc.
  */
-bool get_check_strict(cptr prompt, int mode)
+bool get_check_strict(cptr prompt, BIT_FLAGS mode)
 {
        int i;
        char buf[80];
@@ -3804,10 +3805,11 @@ bool get_com(cptr prompt, char *command, bool z_escape)
  */
 QUANTITY get_quantity(cptr prompt, QUANTITY max)
 {
-       bool res;
-       COMMAND_CODE amt;
+       bool res, result;
+       QUANTITY amt;
        char tmp[80];
        char buf[80];
+       COMMAND_CODE code;
 
 
        /* Use "command_arg" */
@@ -3829,7 +3831,9 @@ QUANTITY get_quantity(cptr prompt, QUANTITY max)
 #ifdef ALLOW_REPEAT /* TNB */
 
        /* Get the item index */
-       if ((max != 1) && repeat_pull(&amt))
+       result = repeat_pull(&code);
+       amt = (QUANTITY)code;
+       if ((max != 1) && result)
        {
                /* Enforce the maximum */
                if (amt > max) amt = max;
@@ -3891,7 +3895,7 @@ QUANTITY get_quantity(cptr prompt, QUANTITY max)
 
 #ifdef ALLOW_REPEAT /* TNB */
 
-       if (amt) repeat_push(amt);
+       if (amt) repeat_push((COMMAND_CODE)amt);
 
 #endif /* ALLOW_REPEAT -- TNB */
 
@@ -4404,7 +4408,7 @@ void request_command(int shopping)
 {
        int i;
 
-       char cmd;
+       s16b cmd;
        int mode;
 
        cptr act;
@@ -4478,7 +4482,7 @@ void request_command(int shopping)
                /* Command Count */
                if (cmd == '0')
                {
-                       int old_arg = command_arg;
+                       COMMAND_ARG old_arg = command_arg;
 
                        /* Reset */
                        command_arg = 0;
@@ -4620,7 +4624,7 @@ void request_command(int shopping)
        if (always_repeat && (command_arg <= 0))
        {
                /* Hack -- auto repeat certain commands */
-               if (my_strchr("TBDoc+", (COMMAND_CODE)command_cmd))
+               if (my_strchr("TBDoc+", (char)command_cmd))
                {
                        /* Repeat 99 times */
                        command_arg = 99;
@@ -4813,7 +4817,7 @@ int get_keymap_dir(char ch)
        }
        else
        {
-               int mode;
+               BIT_FLAGS mode;
                cptr act, s;
 
                /* Roguelike */
@@ -5453,7 +5457,7 @@ void str_tolower(char *str)
                        continue;
                }
 #endif
-               *str = tolower(*str);
+               *str = (char)tolower(*str);
        }
 }