OSDN Git Service

[Refactor] #37353 ULTRIX のプリプロを削除 / Removed preprocessor ULTRIX
[hengband/hengband.git] / src / util.c
index f6a9b86..b26f9a8 100644 (file)
@@ -210,14 +210,12 @@ void user_name(char *buf, int id)
                (void)strcpy(buf, pw->pw_name);
                buf[16] = '\0';
 
-#ifdef CAPITALIZE_USER_NAME
                /* Hack -- capitalize the user name */
 #ifdef JP
                if (!iskanji(buf[0]))
 #endif
                        if (islower(buf[0]))
                                buf[0] = toupper(buf[0]);
-#endif /* CAPITALIZE_USER_NAME */
 
                return;
        }
@@ -253,25 +251,13 @@ void user_name(char *buf, int id)
  * path, and a leading "tilde" to indicate a special directory, and default to a
  * relative path, but MSDOS uses a leading "drivename plus colon" to indicate the
  * use of a "special drive", and then the rest of the path is parsed "normally",
- * and MACINTOSH uses a leading colon to indicate a relative path, and an embedded
- * colon to indicate a "drive plus absolute path", and finally defaults to a file
- * in the current working directory, which may or may not be defined.
+ * and an embedded colon to indicate a "drive plus absolute path", and finally
+ * defaults to a file in the current working directory, which may or may not be defined.
  *
  * We should probably parse a leading "~~/" as referring to "ANGBAND_DIR". (?)
  */
 
 
-#ifdef ACORN
-
-
- /*
-  * Most of the "file" routines for "ACORN" should be in "main-acn.c"
-  */
-
-
-#else /* ACORN */
-
-
 #ifdef SET_UID
 
  /*
@@ -351,13 +337,6 @@ errr path_parse(char *buf, int max, concptr file)
 {
        /* Accept the filename */
        (void)strnfmt(buf, max, "%s", file);
-
-#if defined(MAC_MPW) && defined(CARBON)
-       /* Fix it according to the current operating system */
-       convert_pathname(buf);
-#endif /* MAC_MPW && CARBON */
-
-       /* Success */
        return 0;
 }
 
@@ -454,14 +433,14 @@ FILE *my_fopen(concptr file, concptr mode)
 {
        char buf[1024];
 
-#if defined(MAC_MPW) || defined(MACH_O_CARBON)
+#if defined(MACH_O_CARBON)
        FILE *tempfff;
 #endif
 
        /* Hack -- Try to parse the path */
        if (path_parse(buf, 1024, file)) return (NULL);
 
-#if defined(MAC_MPW) || defined(MACH_O_CARBON)
+#if defined(MACH_O_CARBON)
        if (my_strchr(mode, 'w'))
        {
                /* setting file type/creator */
@@ -492,9 +471,6 @@ errr my_fclose(FILE *fff)
 }
 
 
-#endif /* ACORN */
-
-
 #ifdef HAVE_MKSTEMP
 
 FILE *my_fopen_temp(char *buf, int max)
@@ -549,7 +525,7 @@ errr my_fgets(FILE *fff, char *buf, huge n)
                /* Convert weirdness */
                for (s = tmp; *s; s++)
                {
-#if defined(MACINTOSH) || defined(MACH_O_CARBON)
+#if defined(MACH_O_CARBON)
 
                        /*
                         * Be nice to the Macintosh, where a file can have Mac or Unix
@@ -558,7 +534,7 @@ errr my_fgets(FILE *fff, char *buf, huge n)
                         */
                        if (*s == '\r') *s = '\n';
 
-#endif /* MACINTOSH || MACH_O_CARBON */
+#endif /* MACH_O_CARBON */
 
                        /* Handle newline */
                        if (*s == '\n')
@@ -641,31 +617,6 @@ errr my_fputs(FILE *fff, concptr buf, huge n)
 }
 
 
-#ifdef ACORN
-
-
-/*
- * Most of the "file" routines for "ACORN" should be in "main-acn.c"
- *
- * Many of them can be rewritten now that only "fd_open()" and "fd_make()"
- * and "my_fopen()" should ever create files.
- */
-
-
-#else /* ACORN */
-
-
-/*
- * The Macintosh is a little bit brain-dead sometimes
- */
-#ifdef MACINTOSH
-# define open(N,F,M) \
-((M), open((char*)(N),F))
-# define write(F,B,S) \
-write(F,(char*)(B),S)
-#endif /* MACINTOSH */
-
-
  /*
   * Several systems have no "O_BINARY" flag
   */
@@ -773,7 +724,7 @@ int fd_make(concptr file, BIT_FLAGS mode)
        /* Hack -- Try to parse the path */
        if (path_parse(buf, 1024, file)) return -1;
 
-#if defined(MAC_MPW) || defined(MACH_O_CARBON)
+#if defined(MACH_O_CARBON)
        {
                int fdes;
                /* Create the file, fail if exists, write-only, binary */
@@ -904,7 +855,7 @@ errr fd_chop(int fd, huge n)
        /* Verify the fd */
        if (fd < 0) return -1;
 
-#if defined(ULTRIX) || defined(NeXT)
+#if defined(NeXT)
        /* Truncate */
        ftruncate(fd, n);
 #endif
@@ -995,11 +946,6 @@ errr fd_close(int fd)
 }
 
 
-#endif /* ACORN */
-
-
-
-
 /*
  * Important note about "colors"
  *
@@ -2049,7 +1995,6 @@ static void forget_macro_action(void)
        parse_macro = FALSE;
 }
 
-
 /*
  * Mega-Hack -- special "inkey_next" pointer.
  *
@@ -2060,21 +2005,6 @@ static void forget_macro_action(void)
  */
 static concptr inkey_next = NULL;
 
-
-#ifdef ALLOW_BORG
-
-/*
- * Mega-Hack -- special "inkey_hack" hook.
- *
- * This special function hook allows the "Borg" (see elsewhere) to take
- * control of the "inkey()" function, and substitute in fake keypresses.
- */
-char(*inkey_hack)(int flush_first) = NULL;
-
-#endif /* ALLOW_BORG */
-
-
-
 /*
  * Get a keypress from the user.
  *
@@ -2161,22 +2091,6 @@ char inkey(void)
        /* Forget pointer */
        inkey_next = NULL;
 
-
-#ifdef ALLOW_BORG
-
-       /* Mega-Hack -- Use the special hook */
-       if (inkey_hack && ((ch = (*inkey_hack)(inkey_xtra)) != 0))
-       {
-               /* Cancel the various "global parameters" */
-               inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE;
-
-               /* Accept result */
-               return (ch);
-       }
-
-#endif /* ALLOW_BORG */
-
-
        /* Hack -- handle delayed "flush()" */
        if (inkey_xtra)
        {
@@ -3195,7 +3109,7 @@ void prt(concptr str, TERM_LEN row, TERM_LEN col)
  * This function will correctly handle any width up to the maximum legal
  * value of 256, though it works best for a standard 80 character width.
  */
-void c_roff(byte a, concptr str)
+void c_roff(TERM_COLOR a, concptr str)
 {
        int x, y;
 
@@ -4269,7 +4183,7 @@ special_menu_naiyou special_menu_info[] =
 };
 #endif
 
-static char inkey_from_menu(void)
+static char inkey_from_menu(player_type *player_ptr)
 {
        char cmd;
        int basey, basex;
@@ -4277,7 +4191,7 @@ static char inkey_from_menu(void)
        int menu = 0;
        bool kisuu;
 
-       if (p_ptr->y - panel_row_min > 10) basey = 2;
+       if (player_ptr->y - panel_row_min > 10) basey = 2;
        else basey = 13;
        basex = 15;
 
@@ -4286,6 +4200,7 @@ static char inkey_from_menu(void)
 
        screen_save();
 
+       floor_type* floor_ptr = player_ptr->current_floor_ptr;
        while (TRUE)
        {
                int i;
@@ -4312,12 +4227,12 @@ static char inkey_from_menu(void)
                                switch (special_menu_info[hoge].jouken)
                                {
                                case MENU_CLASS:
-                                       if (p_ptr->pclass == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name;
+                                       if (player_ptr->pclass == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name;
                                        break;
                                case MENU_WILD:
-                                       if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->current_floor_ptr->inside_arena && !p_ptr->current_floor_ptr->inside_quest)
+                                       if (!floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
                                        {
-                                               if ((byte)p_ptr->wild_mode == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name;
+                                               if ((byte)player_ptr->wild_mode == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name;
                                        }
                                        break;
                                default:
@@ -4331,7 +4246,7 @@ static char inkey_from_menu(void)
                put_str(_("》", "> "), basey + 1 + num / 2, basex + 2 + (num % 2) * 24);
 
                /* Place the cursor on the player */
-               move_cursor_relative(p_ptr->y, p_ptr->x);
+               move_cursor_relative(player_ptr->y, player_ptr->x);
 
                sub_cmd = inkey();
                if ((sub_cmd == ' ') || (sub_cmd == 'x') || (sub_cmd == 'X') || (sub_cmd == '\r') || (sub_cmd == '\n'))
@@ -4493,7 +4408,7 @@ void request_command(player_type *player_ptr, int shopping)
 
                        if (!shopping && command_menu && ((cmd == '\r') || (cmd == '\n') || (cmd == 'x') || (cmd == 'X'))
                                && !keymap_act[mode][(byte)(cmd)])
-                               cmd = inkey_from_menu();
+                               cmd = inkey_from_menu(player_ptr);
                }
 
                /* Clear top line */
@@ -4882,8 +4797,6 @@ void repeat_check(void)
 }
 
 
-#ifdef SORT_R_INFO
-
 /*
  * Array size for which InsertionSort
  * is used instead of QuickSort
@@ -5004,10 +4917,6 @@ void tag_sort(tag_type elements[], int number)
        quicksort(elements, 0, number - 1);
 }
 
-#endif /* SORT_R_INFO */
-
-#ifdef SUPPORT_GAMMA
-
 /* Table of gamma values */
 byte gamma_table[256];
 
@@ -5101,8 +5010,6 @@ void build_gamma_table(int gamma)
        }
 }
 
-#endif /* SUPPORT_GAMMA */
-
 
 /*
  * Add a series of keypresses to the "queue".