X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Futil.c;h=c85fa8bdb79a94f3f73ad500fd1851b0f7289edd;hb=133ba5387d7476e418ee85f0baf3aada1ba8e8b7;hp=72e20728be6f1865262a4826577a58feca9862b0;hpb=e6fbdf18a8a11cd05c227c18fc3d01dc51bdc9a7;p=hengband%2Fhengband.git diff --git a/src/util.c b/src/util.c index 72e20728b..c85fa8bdb 100644 --- a/src/util.c +++ b/src/util.c @@ -11,13 +11,136 @@ /* Purpose: Angband utilities -BEN- */ #include "angband.h" +#include "core.h" +#include "term.h" +#include "util.h" +#include "files.h" +#include "monsterrace-hook.h" +#include "view-mainwindow.h" +#include "quest.h" +#include "floor.h" +#include "world.h" +#include "cmd-dump.h" +#include "japanese.h" +#include "player-class.h" +/*! + * 10進数から16進数への変換テーブル / + * Global array for converting numbers to uppercase hecidecimal digit + * This array can also be used to convert a number to an octal digit + */ +const char hexsym[16] = +{ + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' +}; + +/* + * Keymaps for each "mode" associated with each keypress. + */ +concptr keymap_act[KEYMAP_MODES][256]; + +/* + * The next "free" index to use + */ +u32b message__next; + +/* + * The index of the oldest message (none yet) + */ +u32b message__last; + +/* + * The next "free" offset + */ +u32b message__head; + +/* + * The offset to the oldest used char (none yet) + */ +u32b message__tail; + +/* + * The array of offsets, by index [MESSAGE_MAX] + */ +u32b *message__ptr; + +/* + * The array of chars, by offset [MESSAGE_BUF] + */ +char *message__buf; + +bool msg_flag; /* Used in msg_print() for "buffering" */ + +/* + * Number of active macros. + */ +s16b macro__num; + +/* + * Array of macro patterns [MACRO_MAX] + */ +concptr *macro__pat; + +/* + * Array of macro actions [MACRO_MAX] + */ +concptr *macro__act; + +/* + * Array of macro types [MACRO_MAX] + */ +bool *macro__cmd; + +/* + * Current macro action [1024] + */ +char *macro__buf; + +bool get_com_no_macros = FALSE; /* Expand macros in "get_com" or not */ + +bool inkey_base; /* See the "inkey()" function */ +bool inkey_xtra; /* See the "inkey()" function */ +bool inkey_scan; /* See the "inkey()" function */ +bool inkey_flag; /* See the "inkey()" function */ + +bool use_menu; + +pos_list tmp_pos; + +/* + * The number of quarks + */ +STR_OFFSET quark__num; + +/* + * The pointers to the quarks [QUARK_MAX] + */ +concptr *quark__str; static int num_more = 0; /* Save macro trigger string for use in inkey_special() */ static char inkey_macro_trigger_string[1024]; +int max_macrotrigger = 0; /*!< 現在登録中のマクロ(トリガー)の数 */ +concptr macro_template = NULL; /*!< Angband設定ファイルのT: タグ情報から読み込んだ長いTコードを処理するために利用する文字列ポインタ */ +concptr macro_modifier_chr; /*!< &x# で指定されるマクロトリガーに関する情報を記録する文字列ポインタ */ +concptr macro_modifier_name[MAX_MACRO_MOD]; /*!< マクロ上で取り扱う特殊キーを文字列上で表現するためのフォーマットを記録した文字列ポインタ配列 */ +concptr macro_trigger_name[MAX_MACRO_TRIG]; /*!< マクロのトリガーコード */ +concptr macro_trigger_keycode[2][MAX_MACRO_TRIG]; /*!< マクロの内容 */ + +s16b command_cmd; /* Current "Angband Command" */ +COMMAND_ARG command_arg; /*!< 各種コマンドの汎用的な引数として扱う / Gives argument of current command */ +COMMAND_NUM command_rep; /*!< 各種コマンドの汎用的なリピート数として扱う / Gives repetition of current command */ +DIRECTION command_dir; /*!< 各種コマンドの汎用的な方向値処理として扱う/ Gives direction of current command */ +s16b command_see; /* See "object1.c" */ +s16b command_wrk; /* See "object1.c" */ +TERM_LEN command_gap = 999; /* See "object1.c" */ +s16b command_new; /* Command chaining from inven/equip view */ + + + #if 0 #ifndef HAS_STRICMP @@ -26,9 +149,9 @@ static char inkey_macro_trigger_string[1024]; * * Compare the two strings "a" and "b" ala "strcmp()" ignoring case. */ -int stricmp(cptr a, cptr b) +int stricmp(concptr a, concptr b) { - cptr s1, s2; + concptr s1, s2; char z1, z2; /* Scan the strings */ @@ -97,7 +220,7 @@ int usleep(huge usecs) */ #ifdef SET_UID extern struct passwd *getpwuid(uid_t uid); -extern struct passwd *getpwnam(const char *name); +extern struct passwd *getpwnam(concptr name); #endif @@ -185,9 +308,9 @@ void user_name(char *buf, int id) * Replace "~user/" by the home directory of the user named "user" * Replace "~/" by the home directory of the current user */ -errr path_parse(char *buf, int max, cptr file) +errr path_parse(char *buf, int max, concptr file) { - cptr u, s; + concptr u, s; struct passwd *pw; char user[128]; @@ -251,7 +374,7 @@ errr path_parse(char *buf, int max, cptr file) * This requires no special processing on simple machines, * except for verifying the size of the filename. */ -errr path_parse(char *buf, int max, cptr file) +errr path_parse(char *buf, int max, concptr file) { /* Accept the filename */ (void)strnfmt(buf, max, "%s", file); @@ -278,12 +401,11 @@ errr path_parse(char *buf, int max, cptr file) */ static errr path_temp(char *buf, int max) { - cptr s; + concptr s; /* Temp file */ s = tmpnam(NULL); - /* Oops */ if (!s) return (-1); /* Format to length */ @@ -299,8 +421,13 @@ static errr path_temp(char *buf, int max) #endif -/* - * Create a new path by appending a file (or directory) to a path. +/*! + * @brief ファイル入出力のためのパス生成する。/ Create a new path by appending a file (or directory) to a path. + * @param buf ファイルのフルを返すバッファ + * @param max bufのサイズ + * @param path ファイルパス + * @param file ファイル名 + * @return エラーコード(ただし常に0を返す) * * This requires no special processing on simple machines, except * for verifying the size of the filename, but note the ability to @@ -312,7 +439,7 @@ static errr path_temp(char *buf, int max) * Note that this function yields a path which must be "parsed" * using the "parse" function above. */ -errr path_build(char *buf, int max, cptr path, cptr file) +errr path_build(char *buf, int max, concptr path, concptr file) { /* Special file */ if (file[0] == '~') @@ -350,7 +477,7 @@ errr path_build(char *buf, int max, cptr path, cptr file) /* * Hack -- replacement for "fopen()" */ -FILE *my_fopen(cptr file, cptr mode) +FILE *my_fopen(concptr file, concptr mode) { char buf[1024]; @@ -420,8 +547,6 @@ FILE *my_fopen_temp(char *buf, int max) { /* Generate a temporary filename */ if (path_temp(buf, max)) return (NULL); - - /* Open the file */ return (my_fopen(buf, "w")); } @@ -438,9 +563,7 @@ FILE *my_fopen_temp(char *buf, int max) errr my_fgets(FILE *fff, char *buf, huge n) { huge i = 0; - char *s; - char tmp[1024]; /* Read a line */ @@ -529,12 +652,10 @@ errr my_fgets(FILE *fff, char *buf, huge n) /* * Hack -- replacement for "fputs()" - * * Dump a string, plus a newline, to a file - * - * XXX XXX XXX Process internal weirdness? + * Process internal weirdness? */ -errr my_fputs(FILE *fff, cptr buf, huge n) +errr my_fputs(FILE *fff, concptr buf, huge n) { /* XXX XXX */ n = n ? n : 0; @@ -562,18 +683,6 @@ errr my_fputs(FILE *fff, cptr buf, huge n) /* - * Code Warrior is a little weird about some functions - */ -#ifdef BEN_HACK -extern int open(const char *, int, ...); -extern int close(int); -extern int read(int, void *, unsigned int); -extern int write(int, const void *, unsigned int); -extern long lseek(int, long, int); -#endif /* BEN_HACK */ - - -/* * The Macintosh is a little bit brain-dead sometimes */ #ifdef MACINTOSH @@ -595,7 +704,7 @@ write(F,(char*)(B),S) /* * Hack -- attempt to delete a file */ -errr fd_kill(cptr file) +errr fd_kill(concptr file) { char buf[1024]; @@ -605,7 +714,6 @@ errr fd_kill(cptr file) /* Remove */ (void)remove(buf); - /* XXX XXX XXX */ return (0); } @@ -613,7 +721,7 @@ errr fd_kill(cptr file) /* * Hack -- attempt to move a file */ -errr fd_move(cptr file, cptr what) +errr fd_move(concptr file, concptr what) { char buf[1024]; char aux[1024]; @@ -627,7 +735,6 @@ errr fd_move(cptr file, cptr what) /* Rename */ (void)rename(buf, aux); - /* XXX XXX XXX */ return (0); } @@ -635,7 +742,7 @@ errr fd_move(cptr file, cptr what) /* * Hack -- attempt to copy a file */ -errr fd_copy(cptr file, cptr what) +errr fd_copy(concptr file, concptr what) { char buf[1024]; char aux[1024]; @@ -678,44 +785,21 @@ errr fd_copy(cptr file, cptr what) fd_close(src_fd); fd_close(dst_fd); - /* XXX XXX XXX */ return (0); } - /* * Hack -- attempt to open a file descriptor (create file) - * * This function should fail if the file already exists - * * Note that we assume that the file should be "binary" - * - * XXX XXX XXX The horrible "BEN_HACK" code is for compiling under - * the CodeWarrior compiler, in which case, for some reason, none - * of the "O_*" flags are defined, and we must fake the definition - * 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, BIT_FLAGS mode) +int fd_make(concptr file, BIT_FLAGS mode) { char buf[1024]; /* Hack -- Try to parse the path */ if (path_parse(buf, 1024, file)) return (-1); -#ifdef BEN_HACK - - /* Check for existance */ - /* if (fd_close(fd_open(file, O_RDONLY | O_BINARY))) return (1); */ - - /* Mega-Hack -- Create the file */ - (void)my_fclose(my_fopen(file, "wb")); - - /* Re-open the file for writing */ - return (open(buf, O_WRONLY | O_BINARY, mode)); - -#else /* BEN_HACK */ - #if defined(MAC_MPW) || defined(MACH_O_CARBON) { int fdes; @@ -726,12 +810,10 @@ int fd_make(cptr file, BIT_FLAGS mode) /* Return the descriptor */ return (fdes); } -# else +#else /* Create the file, fail if exists, write-only, binary */ return (open(buf, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, mode)); -# endif - -#endif /* BEN_HACK */ +#endif } @@ -741,7 +823,7 @@ int fd_make(cptr file, BIT_FLAGS mode) * * Note that we assume that the file should be "binary" */ -int fd_open(cptr file, int flags) +int fd_open(concptr file, int flags) { char buf[1024]; @@ -895,7 +977,7 @@ errr fd_read(int fd, char *buf, huge n) /* * Hack -- Attempt to write data to a file descriptor */ -errr fd_write(int fd, cptr buf, huge n) +errr fd_write(int fd, concptr buf, huge n) { /* Verify the fd */ if (fd < 0) return (-1); @@ -936,7 +1018,6 @@ errr fd_close(int fd) /* Close */ (void)close(fd); - /* XXX XXX XXX */ return (0); } @@ -947,7 +1028,7 @@ errr fd_close(int fd) /* - * XXX XXX XXX Important note about "colors" XXX XXX XXX + * Important note about "colors" * * The "TERM_*" color definitions list the "composition" of each * "Angband color" in terms of "quarters" of each of the three color @@ -1040,9 +1121,9 @@ static int dehex(char c) } -static int my_stricmp(cptr a, cptr b) +static int my_stricmp(concptr a, concptr b) { - cptr s1, s2; + concptr s1, s2; char z1, z2; /* Scan the strings */ @@ -1056,9 +1137,9 @@ static int my_stricmp(cptr a, cptr b) } } -static int my_strnicmp(cptr a, cptr b, int n) +static int my_strnicmp(concptr a, concptr b, int n) { - cptr s1, s2; + concptr s1, s2; char z1, z2; /* Scan the strings */ @@ -1074,15 +1155,15 @@ static int my_strnicmp(cptr a, cptr b, int n) } -static void trigger_text_to_ascii(char **bufptr, cptr *strptr) +static void trigger_text_to_ascii(char **bufptr, concptr *strptr) { char *s = *bufptr; - cptr str = *strptr; + concptr str = *strptr; bool mod_status[MAX_MACRO_MOD]; int i, len = 0; int shiftstatus = 0; - cptr key_code; + concptr key_code; if (macro_template == NULL) return; @@ -1171,7 +1252,7 @@ static void trigger_text_to_ascii(char **bufptr, cptr *strptr) * parsing "\xFF" into a (signed) char. Whoever thought of making * the "sign" of a "char" undefined is a complete moron. Oh well. */ -void text_to_ascii(char *buf, cptr str) +void text_to_ascii(char *buf, concptr str) { char *s = buf; @@ -1183,8 +1264,6 @@ void text_to_ascii(char *buf, cptr str) { /* Skip the backslash */ str++; - - /* Paranoia */ if (!(*str)) break; /* Macro Trigger */ @@ -1300,13 +1379,13 @@ void text_to_ascii(char *buf, cptr str) } -static bool trigger_ascii_to_text(char **bufptr, cptr *strptr) +static bool trigger_ascii_to_text(char **bufptr, concptr *strptr) { char *s = *bufptr; - cptr str = *strptr; + concptr str = *strptr; char key_code[100]; int i; - cptr tmp; + concptr tmp; if (macro_template == NULL) return FALSE; @@ -1365,7 +1444,7 @@ static bool trigger_ascii_to_text(char **bufptr, cptr *strptr) /* * Hack -- convert a string into a printable form */ -void ascii_to_text(char *buf, cptr str) +void ascii_to_text(char *buf, concptr str) { char *s = buf; @@ -1475,7 +1554,7 @@ static bool macro__use[256]; /* * Find the macro (if any) which exactly matches the given pattern */ -sint macro_find_exact(cptr pat) +sint macro_find_exact(concptr pat) { int i; @@ -1503,7 +1582,7 @@ sint macro_find_exact(cptr pat) /* * Find the first macro (if any) which contains the given pattern */ -static sint macro_find_check(cptr pat) +static sint macro_find_check(concptr pat) { int i; @@ -1531,7 +1610,7 @@ static sint macro_find_check(cptr pat) /* * Find the first macro (if any) which contains the given pattern and more */ -static sint macro_find_maybe(cptr pat) +static sint macro_find_maybe(concptr pat) { int i; @@ -1562,7 +1641,7 @@ static sint macro_find_maybe(cptr pat) /* * Find the longest macro (if any) which starts with the given pattern */ -static sint macro_find_ready(cptr pat) +static sint macro_find_ready(concptr pat) { int i, t, n = -1, s = -1; @@ -1588,8 +1667,6 @@ static sint macro_find_ready(cptr pat) n = i; s = t; } - - /* Result */ return (n); } @@ -1598,17 +1675,17 @@ static sint macro_find_ready(cptr pat) * Add a macro definition (or redefinition). * * We should use "act == NULL" to "remove" a macro, but this might make it - * impossible to save the "removal" of a macro definition. XXX XXX XXX + * impossible to save the "removal" of a macro definition. * * We should consider refusing to allow macros which contain existing macros, * or which are contained in existing macros, because this would simplify the - * macro analysis code. XXX XXX XXX + * macro analysis code. * * We should consider removing the "command macro" crap, and replacing it * with some kind of "powerful keymap" ability, but this might make it hard - * to change the "roguelike" option from inside the game. XXX XXX XXX + * to change the "roguelike" option from inside the game. */ -errr macro_add(cptr pat, cptr act) +errr macro_add(concptr pat, concptr act) { int n; @@ -1721,92 +1798,89 @@ errr play_music(int type, int val) /* * Hack -- Select floor music. */ -void select_floor_music(void) +void select_floor_music(player_type *player_ptr) { - int i; - /* No sound */ if (!use_music) return; - if(ambush_flag) + if (player_ptr->ambush_flag) { - play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_AMBUSH); - return; + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_AMBUSH)) return; + } + + if(player_ptr->wild_mode) + { + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WILD)) return; } - if(p_ptr->wild_mode) + if(player_ptr->current_floor_ptr->inside_arena) { - play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WILD); - return; + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_ARENA)) return; } - if(p_ptr->inside_arena) + if(player_ptr->phase_out) { - play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_ARENA); - return; + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BATTLE)) return; } - if(p_ptr->inside_battle) + if(player_ptr->current_floor_ptr->inside_quest) { - play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BATTLE); - return; + if (!play_music(TERM_XTRA_MUSIC_QUEST, player_ptr->current_floor_ptr->inside_quest)) return; + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_QUEST)) return; } - if(p_ptr->inside_quest) + if(player_ptr->dungeon_idx) { - if(play_music(TERM_XTRA_MUSIC_QUEST, p_ptr->inside_quest)) + if (player_ptr->feeling == 2) { - play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_QUEST); + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL2)) return; } - return; - } - - for(i = 0; i < max_quests; i++) - { // TODO マクロで類似条件を統合すること - if(quest[i].status == QUEST_STATUS_TAKEN && - (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_RANDOM) && - quest[i].level == dun_level && dungeon_type == quest[i].dungeon) + else if (player_ptr->feeling >= 3 && player_ptr->feeling <= 5) { - if(play_music(TERM_XTRA_MUSIC_QUEST, i)) - { - play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_QUEST); - } - return; + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL1)) return; } - } - - if(dungeon_type) - { - if(p_ptr->feeling == 2) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL2); - else if(p_ptr->feeling >= 3 && p_ptr->feeling <= 5) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL1); else { - if(play_music(TERM_XTRA_MUSIC_DUNGEON, dungeon_type)) + if (!play_music(TERM_XTRA_MUSIC_DUNGEON, player_ptr->dungeon_idx)) return; + + if (player_ptr->current_floor_ptr->dun_level < 40) + { + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_LOW)) return; + } + else if (player_ptr->current_floor_ptr->dun_level < 80) + { + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_MED)) return; + } + else { - if(dun_level < 40) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_LOW); - else if(dun_level < 80) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_MED); - else play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_HIGH); + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_HIGH)) return; } } - return; } - if(p_ptr->town_num) + if(player_ptr->town_num) { - if(play_music(TERM_XTRA_MUSIC_TOWN, p_ptr->town_num)) - { - play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_TOWN); - } + if (!play_music(TERM_XTRA_MUSIC_TOWN, player_ptr->town_num)) return; + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_TOWN)) return; return; } - if(!dun_level) + if(!player_ptr->current_floor_ptr->dun_level) { - if(p_ptr->lev >= 45) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_FIELD3); - else if(p_ptr->lev >= 25) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_FIELD2); - else play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_FIELD1); - return; + if (player_ptr->lev >= 45) + { + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_FIELD3)) return; + } + else if (player_ptr->lev >= 25) + { + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_FIELD2)) return; + } + else + { + if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_FIELD1)) return; + } } + play_music(TERM_XTRA_MUSIC_MUTE, 0); } @@ -1826,7 +1900,7 @@ void select_floor_music(void) * Only 500 (0+1+2+...+29+30) milliseconds may elapse between each key in * the macro trigger sequence. If a key sequence forms the "prefix" of a * macro trigger, 500 milliseconds must pass before the key sequence is - * known not to be that macro trigger. XXX XXX XXX + * known not to be that macro trigger. */ static char inkey_aux(void) { @@ -1834,7 +1908,7 @@ static char inkey_aux(void) char ch; - cptr pat, act; + concptr pat, act; char *buf = inkey_macro_trigger_string; @@ -1910,7 +1984,6 @@ static char inkey_aux(void) /* Excessive delay */ if (w >= 10) break; - /* Delay */ Term_xtra(TERM_XTRA_DELAY, w); } } @@ -2005,20 +2078,20 @@ static void forget_macro_action(void) /* - * Mega-Hack -- special "inkey_next" pointer. XXX XXX XXX + * Mega-Hack -- special "inkey_next" pointer. * * This special pointer allows a sequence of keys to be "inserted" into * the stream of keys returned by "inkey()". This key sequence will not * trigger any macros, and cannot be bypassed by the Borg. It is used * in Angband to handle "keymaps". */ -static cptr inkey_next = NULL; +static concptr inkey_next = NULL; #ifdef ALLOW_BORG /* - * Mega-Hack -- special "inkey_hack" hook. XXX XXX XXX + * 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. @@ -2084,7 +2157,7 @@ char (*inkey_hack)(int flush_first) = NULL; * is only requested (via "Term_inkey()") when "angband_term[0]" is active. * * Mega-Hack -- This function is used as the entry point for clearing the - * "signal_count" variable, and of the "character_saved" variable. + * "signal_count" variable, and of the "current_world_ptr->character_saved" variable. * * Hack -- Note the use of "inkey_next" to allow "keymaps" to be processed. * @@ -2149,7 +2222,7 @@ char inkey(void) (void)Term_get_cursor(&v); /* Show the cursor if waiting, except sometimes in "command" mode */ - if (!inkey_scan && (!inkey_flag || hilite_player || character_icky)) + if (!inkey_scan && (!inkey_flag || hilite_player || current_world_ptr->character_icky)) { /* Show the cursor */ (void)Term_set_cursor(1); @@ -2184,7 +2257,7 @@ char inkey(void) Term_activate(angband_term[0]); /* Mega-Hack -- reset saved flag */ - character_saved = FALSE; + current_world_ptr->character_saved = FALSE; /* Mega-Hack -- reset signal counter */ signal_count = 0; @@ -2205,11 +2278,9 @@ char inkey(void) /* Wait for (and remove) a pending key */ if (0 == Term_inkey(&ch, TRUE, TRUE)) { - /* Done */ break; } - /* Oops */ break; } @@ -2219,7 +2290,6 @@ char inkey(void) /* Check for (and remove) a pending key */ if (0 == Term_inkey(&ch, FALSE, TRUE)) { - /* Done */ break; } @@ -2232,12 +2302,10 @@ char inkey(void) /* Excessive delay */ if (w >= 100) break; - /* Delay */ Term_xtra(TERM_XTRA_DELAY, w); } } - /* Done */ break; } @@ -2251,8 +2319,6 @@ char inkey(void) { /* Strip this key */ ch = 0; - - /* Continue */ continue; } @@ -2338,7 +2404,7 @@ char inkey(void) void quark_init(void) { /* Quark variables */ - C_MAKE(quark__str, QUARK_MAX, cptr); + C_MAKE(quark__str, QUARK_MAX, concptr); /* Prepare first quark, which is used when quark_add() is failed */ quark__str[1] = string_make(""); @@ -2351,7 +2417,7 @@ void quark_init(void) /* * Add a new "quark" to the set of quarks. */ -u16b quark_add(cptr str) +u16b quark_add(concptr str) { u16b i; @@ -2379,9 +2445,9 @@ u16b quark_add(cptr str) /* * This function looks up a quark */ -cptr quark_str(STR_OFFSET i) +concptr quark_str(STR_OFFSET i) { - cptr q; + concptr q; /* Return NULL for an invalid index */ if ((i < 1) || (i >= quark__num)) return NULL; @@ -2447,11 +2513,11 @@ s32b message_num(void) * @params age メッセージの世代 * @return メッセージの文字列ポインタ */ -cptr message_str(int age) +concptr message_str(int age) { s32b x; s32b o; - cptr s; + concptr s; /* Forgotten messages have no text */ if ((age < 0) || (age >= message_num())) return (""); @@ -2475,14 +2541,14 @@ cptr message_str(int age) * @params str 保存したいメッセージ * @return なし */ -void message_add(cptr str) +void message_add(concptr str) { u32b i, n; int k, x, m; char u[4096]; char splitted1[81]; - cptr splitted2; + concptr splitted2; /*** Step 1 -- Analyze the message ***/ @@ -2498,7 +2564,7 @@ void message_add(cptr str) /* extra step -- split the message if n>80.(added by Mogami) */ if (n > 80) { #ifdef JP - cptr t = str; + concptr t = str; for (n = 0; n < 80; n++, t++) { @@ -2536,7 +2602,7 @@ void message_add(cptr str) char buf[1024]; char *t; - cptr old; + concptr old; /* Back up and wrap if needed */ if (i-- == 0) i = MESSAGE_MAX - 1; @@ -2560,7 +2626,7 @@ void message_add(cptr str) if (*t) { /* Message is too small */ - if (strlen(buf) < 6) break; + if (strlen(buf) < A_MAX) break; /* Drop the space */ *(t - 1) = '\0'; @@ -2593,7 +2659,6 @@ void message_add(cptr str) now_message++; } - /* Done */ break; } @@ -2601,7 +2666,7 @@ void message_add(cptr str) for (i = message__next; k; k--) { int q; - cptr old; + concptr old; /* Back up and wrap if needed */ if (i-- == 0) i = MESSAGE_MAX - 1; @@ -2754,7 +2819,7 @@ static void msg_flush(int x) byte a = TERM_L_BLUE; bool nagasu = FALSE; - if ((auto_more && !now_damaged) || num_more < 0){ + if ((auto_more && !p_ptr->now_damaged) || num_more < 0){ int i; for (i = 0; i < 8; i++) { @@ -2769,7 +2834,7 @@ static void msg_flush(int x) nagasu = TRUE; } } - now_damaged = FALSE; + p_ptr->now_damaged = FALSE; if (!p_ptr->playing || !nagasu) { @@ -2800,6 +2865,12 @@ static void msg_flush(int x) } +void msg_erase(void) +{ + msg_print(NULL); +} + + /* * Output a message to the top line of the screen. * @@ -2816,23 +2887,23 @@ static void msg_flush(int x) * The global "msg_flag" variable can be cleared to tell us to * "erase" any "pending" messages still on the screen. * - * XXX XXX XXX Note that we must be very careful about using the + * Note that we must be very careful about using the * "msg_print()" functions without explicitly calling the special * "msg_print(NULL)" function, since this may result in the loss * of information if the screen is cleared, or if anything is * displayed on the top line. * - * XXX XXX XXX Note that "msg_print(NULL)" will clear the top line + * Note that "msg_print(NULL)" will clear the top line * even if no messages are pending. This is probably a hack. */ -void msg_print(cptr msg) +void msg_print(concptr msg) { static int p = 0; int n; char *t; char buf[1024]; - if (world_monster) return; + if (current_world_ptr->timewalk_m_idx) return; /* Hack -- Reset */ if (!msg_flag) { @@ -2847,7 +2918,6 @@ void msg_print(cptr msg) /* Hack -- flush when requested or needed */ if (p && (!msg || ((p + n) > 72))) { - /* Flush */ msg_flush(p); /* Forget it */ @@ -2859,8 +2929,6 @@ void msg_print(cptr msg) /* No message */ if (!msg) return; - - /* Paranoia */ if (n > 1000) return; /* Copy it */ @@ -2870,14 +2938,14 @@ void msg_print(cptr msg) } else { - sprintf(buf, ("T:%d - %s"), (int)turn, msg); + sprintf(buf, ("T:%d - %s"), (int)current_world_ptr->game_turn, msg); } /* New Message Length */ - n = (buf ? strlen(buf) : 0); + n = strlen(buf); /* Memorize the message */ - if (character_generated) message_add(buf); + if (current_world_ptr->character_generated) message_add(buf); /* Analyze the buffer */ t = buf; @@ -2941,7 +3009,7 @@ void msg_print(cptr msg) msg_flush(split + 1); /* Memorize the piece */ - /* if (character_generated) message_add(t); */ + /* if (current_world_ptr->character_generated) message_add(t); */ /* Restore the split character */ t[split] = oops; @@ -2957,11 +3025,10 @@ void msg_print(cptr msg) Term_putstr(p, 0, n, TERM_WHITE, t); /* Memorize the tail */ - /* if (character_generated) message_add(t); */ + /* if (current_world_ptr->character_generated) message_add(t); */ - /* Window stuff */ p_ptr->window |= (PW_MESSAGE); - window_stuff(); + update_output(p_ptr); /* Remember the message */ msg_flag = TRUE; @@ -2977,25 +3044,27 @@ void msg_print(cptr msg) if (fresh_message) Term_fresh(); } -void msg_print_wizard(int cheat_type, cptr msg) + +void msg_print_wizard(int cheat_type, concptr msg) { if (!cheat_room && cheat_type == CHEAT_DUNGEON) return; if (!cheat_peek && cheat_type == CHEAT_OBJECT) return; if (!cheat_hear && cheat_type == CHEAT_MONSTER) return; if (!cheat_xtra && cheat_type == CHEAT_MISC) return; - cptr cheat_mes[] = {"ITEM", "MONS", "DUNG", "MISC"}; + concptr cheat_mes[] = {"ITEM", "MONS", "DUNG", "MISC"}; char buf[1024]; sprintf(buf, "WIZ-%s:%s", cheat_mes[cheat_type], msg); msg_print(buf); if (cheat_diary_output) { - do_cmd_write_nikki(NIKKI_WIZARD_LOG, 0, buf); + exe_write_diary(p_ptr, NIKKI_WIZARD_LOG, 0, buf); } } + /* * Hack -- prevent "accidents" in "screen_save()" or "screen_load()" */ @@ -3007,7 +3076,7 @@ static int screen_depth = 0; * * This function must match exactly one call to "screen_load()". */ -void screen_save(void) +void screen_save() { /* Hack -- Flush messages */ msg_print(NULL); @@ -3016,7 +3085,7 @@ void screen_save(void) if (screen_depth++ == 0) Term_save(); /* Increase "icky" depth */ - character_icky++; + current_world_ptr->character_icky++; } @@ -3025,7 +3094,7 @@ void screen_save(void) * * This function must match exactly one call to "screen_save()". */ -void screen_load(void) +void screen_load() { /* Hack -- Flush messages */ msg_print(NULL); @@ -3034,14 +3103,14 @@ void screen_load(void) if (--screen_depth == 0) Term_load(); /* Decrease "icky" depth */ - character_icky--; + current_world_ptr->character_icky--; } /* * Display a formatted message, using "vstrnfmt()" and "msg_print()". */ -void msg_format(cptr fmt, ...) +void msg_format(concptr fmt, ...) { va_list vp; @@ -3063,7 +3132,7 @@ void msg_format(cptr fmt, ...) /* * Display a formatted message, using "vstrnfmt()" and "msg_print()". */ -void msg_format_wizard(int cheat_type, cptr fmt, ...) +void msg_format_wizard(int cheat_type, concptr fmt, ...) { if(!cheat_room && cheat_type == CHEAT_DUNGEON) return; if(!cheat_peek && cheat_type == CHEAT_OBJECT) return; @@ -3087,14 +3156,13 @@ void msg_format_wizard(int cheat_type, cptr fmt, ...) } - /* * Display a string on the screen using an attribute. * * At the given location, using the given attribute, if allowed, * add the given string. Do not clear the line. */ -void c_put_str(byte attr, cptr str, int row, int col) +void c_put_str(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col) { /* Position cursor, Dump the attr/text */ Term_putstr(col, row, -1, attr, str); @@ -3103,7 +3171,7 @@ void c_put_str(byte attr, cptr str, int row, int col) /* * As above, but in "white" */ -void put_str(cptr str, int row, int col) +void put_str(concptr str, TERM_LEN row, TERM_LEN col) { /* Spawn */ Term_putstr(col, row, -1, TERM_WHITE, str); @@ -3115,7 +3183,7 @@ void put_str(cptr str, int row, int col) * Display a string on the screen using an attribute, and clear * to the end of the line. */ -void c_prt(byte attr, cptr str, int row, int col) +void c_prt(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col) { /* Clear line, position cursor */ Term_erase(col, row, 255); @@ -3127,7 +3195,7 @@ void c_prt(byte attr, cptr str, int row, int col) /* * As above, but in "white" */ -void prt(cptr str, int row, int col) +void prt(concptr str, TERM_LEN row, TERM_LEN col) { /* Spawn */ c_prt(TERM_WHITE, str, row, col); @@ -3150,13 +3218,13 @@ void prt(cptr str, int row, int 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, cptr str) +void c_roff(byte a, concptr str) { int x, y; int w, h; - cptr s; + concptr s; /* Obtain the size */ (void)Term_get_size(&w, &h); @@ -3209,7 +3277,7 @@ void c_roff(byte a, cptr str) { int i, n = 0; - byte av[256]; + TERM_COLOR av[256]; char cv[256]; /* Wrap word */ @@ -3311,7 +3379,7 @@ void c_roff(byte a, cptr str) /* * As above, but in "white" */ -void roff(cptr str) +void roff(concptr str) { /* Spawn */ c_roff(TERM_WHITE, str); @@ -3618,11 +3686,9 @@ bool askfor(char *buf, int len) * * We clear the input, and return FALSE, on "ESCAPE". */ -bool get_string(cptr prompt, char *buf, int len) +bool get_string(concptr prompt, char *buf, int len) { bool res; - - /* Paranoia XXX XXX XXX */ msg_print(NULL); /* Display prompt */ @@ -3633,8 +3699,6 @@ bool get_string(cptr prompt, char *buf, int len) /* Clear prompt */ prt("", 0, 0); - - /* Result */ return (res); } @@ -3646,7 +3710,7 @@ bool get_string(cptr prompt, char *buf, int len) * * Note that "[y/n]" is appended to the prompt. */ -bool get_check(cptr prompt) +bool get_check(concptr prompt) { return get_check_strict(prompt, 0); } @@ -3659,7 +3723,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, BIT_FLAGS mode) +bool get_check_strict(concptr prompt, BIT_FLAGS mode) { int i; char buf[80]; @@ -3668,17 +3732,15 @@ bool get_check_strict(cptr prompt, BIT_FLAGS mode) if (auto_more) { p_ptr->window |= PW_MESSAGE; - window_stuff(); + handle_stuff(p_ptr); num_more = 0; } - /* Paranoia XXX XXX XXX */ msg_print(NULL); if (!rogue_like_commands) mode &= ~CHECK_OKAY_CANCEL; - /* Hack -- Build a "useful" prompt */ if (mode & CHECK_OKAY_CANCEL) { @@ -3704,7 +3766,7 @@ bool get_check_strict(cptr prompt, BIT_FLAGS mode) /* HACK : Add the line to message buffer */ message_add(buf); p_ptr->window |= (PW_MESSAGE); - window_stuff(); + handle_stuff(p_ptr); } /* Get an acceptable answer */ @@ -3772,9 +3834,8 @@ bool get_check_strict(cptr prompt, BIT_FLAGS mode) * * Returns TRUE unless the character is "Escape" */ -bool get_com(cptr prompt, char *command, bool z_escape) +bool get_com(concptr prompt, char *command, bool z_escape) { - /* Paranoia XXX XXX XXX */ msg_print(NULL); /* Display a prompt */ @@ -3782,7 +3843,7 @@ bool get_com(cptr prompt, char *command, bool z_escape) /* Get a key */ if (get_com_no_macros) - *command = inkey_special(FALSE); + *command = (char)inkey_special(FALSE); else *command = inkey(); @@ -3790,11 +3851,11 @@ bool get_com(cptr prompt, char *command, bool z_escape) prt("", 0, 0); /* Handle "cancel" */ - if (*command == ESCAPE) return (FALSE); - if (z_escape && ((*command == 'z') || (*command == 'Z'))) return (FALSE); + if (*command == ESCAPE) return FALSE; + if (z_escape && ((*command == 'z') || (*command == 'Z'))) return FALSE; /* Success */ - return (TRUE); + return TRUE; } @@ -3803,12 +3864,13 @@ bool get_com(cptr prompt, char *command, bool z_escape) * * Hack -- allow "command_arg" to specify a quantity */ -QUANTITY get_quantity(cptr prompt, QUANTITY max) +QUANTITY get_quantity(concptr prompt, QUANTITY max) { - bool res; + bool res, result; QUANTITY amt; char tmp[80]; char buf[80]; + COMMAND_CODE code; /* Use "command_arg" */ @@ -3827,10 +3889,10 @@ QUANTITY get_quantity(cptr prompt, QUANTITY max) return (amt); } -#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; @@ -3842,19 +3904,14 @@ QUANTITY get_quantity(cptr prompt, QUANTITY max) return (amt); } -#endif /* ALLOW_REPEAT -- TNB */ - /* Build a prompt if needed */ if (!prompt) { - /* Build a prompt */ sprintf(tmp, _("いくつですか (1-%d): ", "Quantity (1-%d): "), max); /* Use that prompt */ prompt = tmp; } - - /* Paranoia XXX XXX XXX */ msg_print(NULL); /* Display prompt */ @@ -3890,11 +3947,7 @@ QUANTITY get_quantity(cptr prompt, QUANTITY max) /* Enforce the minimum */ if (amt < 0) amt = 0; -#ifdef ALLOW_REPEAT /* TNB */ - - if (amt) repeat_push(amt); - -#endif /* ALLOW_REPEAT -- TNB */ + if (amt) repeat_push((COMMAND_CODE)amt); /* Return the result */ return (amt); @@ -3902,7 +3955,7 @@ QUANTITY get_quantity(cptr prompt, QUANTITY max) /* - * Pause for user response XXX XXX XXX + * Pause for user response */ void pause_line(int row) { @@ -3923,7 +3976,7 @@ static char request_command_buffer[256]; typedef struct { - cptr name; + concptr name; byte cmd; bool fin; } menu_naiyou; @@ -4198,7 +4251,7 @@ menu_naiyou menu_info[10][10] = typedef struct { - cptr name; + concptr name; byte window; byte number; byte jouken; @@ -4263,7 +4316,7 @@ static char inkey_from_menu(void) { int i; char sub_cmd; - cptr menu_name; + concptr menu_name; if (!menu) old_num = num; put_str("+----------------------------------------------------+", basey, basex); put_str("| |", basey+1, basex); @@ -4288,7 +4341,7 @@ static char inkey_from_menu(void) if (p_ptr->pclass == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name; break; case MENU_WILD: - if (!dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest) + if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->current_floor_ptr->inside_arena && !p_ptr->current_floor_ptr->inside_quest) { if ((byte)p_ptr->wild_mode == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name; } @@ -4306,7 +4359,6 @@ static char inkey_from_menu(void) /* Place the cursor on the player */ move_cursor_relative(p_ptr->y, p_ptr->x); - /* Get a command */ sub_cmd = inkey(); if ((sub_cmd == ' ') || (sub_cmd == 'x') || (sub_cmd == 'X') || (sub_cmd == '\r') || (sub_cmd == '\n')) { @@ -4399,16 +4451,16 @@ static char inkey_from_menu(void) * Note that this command is used both in the dungeon and in * stores, and must be careful to work in both situations. * - * Note that "p_ptr->command_new" may not work any more. XXX XXX XXX + * Note that "p_ptr->command_new" may not work any more. */ void request_command(int shopping) { int i; - char cmd; + s16b cmd; int mode; - cptr act; + concptr act; #ifdef JP int caretcmd = 0; @@ -4444,8 +4496,7 @@ void request_command(int shopping) /* Hack -- auto-commands */ if (command_new) { - /* Flush messages */ - msg_print(NULL); + msg_erase(); /* Use auto-command */ cmd = command_new; @@ -4464,7 +4515,6 @@ void request_command(int shopping) /* Activate "command mode" */ inkey_flag = TRUE; - /* Get a command */ cmd = inkey(); if (!shopping && command_menu && ((cmd == '\r') || (cmd == '\n') || (cmd == 'x') || (cmd == 'X')) @@ -4562,8 +4612,6 @@ void request_command(int shopping) { /* Clear count */ command_arg = 0; - - /* Continue */ continue; } } @@ -4600,20 +4648,15 @@ void request_command(int shopping) /* Start using the buffer */ inkey_next = request_command_buffer; - - /* Continue */ continue; } - - /* Paranoia */ if (!cmd) continue; /* Use command */ command_cmd = (byte)cmd; - /* Done */ break; } @@ -4648,7 +4691,7 @@ void request_command(int shopping) #ifdef JP for (i = 0; i < 256; i++) { - cptr s; + concptr s; if ((s = keymap_act[mode][i]) != NULL) { if (*s == command_cmd && *(s+1) == 0) @@ -4665,11 +4708,9 @@ void request_command(int shopping) /* Hack -- Scan equipment */ for (i = INVEN_RARM; i < INVEN_TOTAL; i++) { - cptr s; - - object_type *o_ptr = &inventory[i]; + concptr s; - /* Skip non-objects */ + object_type *o_ptr = &p_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; /* No inscription */ @@ -4729,10 +4770,10 @@ bool is_a_vowel(int ch) case 'I': case 'O': case 'U': - return (TRUE); + return TRUE; } - return (FALSE); + return FALSE; } @@ -4747,7 +4788,7 @@ bool is_a_vowel(int ch) * XXX Could be made more efficient, especially in the * case where "insert" is smaller than "target". */ -static bool insert_str(char *buf, cptr target, cptr insert) +static bool insert_str(char *buf, concptr target, concptr insert) { int i, len; int b_len, t_len, i_len; @@ -4756,7 +4797,7 @@ static bool insert_str(char *buf, cptr target, cptr insert) buf = my_strstr(buf, target); /* No target found */ - if (!buf) return (FALSE); + if (!buf) return FALSE; /* Be sure we have an insertion string */ if (!insert) insert = ""; @@ -4788,7 +4829,7 @@ static bool insert_str(char *buf, cptr target, cptr insert) for (i = 0; i < i_len; ++i) buf[i] = insert[i]; /* Successful operation */ - return (TRUE); + return TRUE; } @@ -4815,7 +4856,7 @@ int get_keymap_dir(char ch) else { BIT_FLAGS mode; - cptr act, s; + concptr act, s; /* Roguelike */ if (rogue_like_commands) @@ -4843,8 +4884,6 @@ int get_keymap_dir(char ch) } } } - - /* Paranoia */ if (d == 5) d = 0; /* Return direction */ @@ -4852,8 +4891,6 @@ int get_keymap_dir(char ch) } -#ifdef ALLOW_REPEAT /* TNB */ - #define REPEAT_MAX 20 /* Number of chars saved */ @@ -4882,13 +4919,13 @@ void repeat_push(COMMAND_CODE what) bool repeat_pull(COMMAND_CODE *what) { /* All out of keys */ - if (repeat__idx == repeat__cnt) return (FALSE); + if (repeat__idx == repeat__cnt) return FALSE; /* Grab the next key, advance */ *what = repeat__key[repeat__idx++]; /* Success */ - return (TRUE); + return TRUE; } void repeat_check(void) @@ -4929,8 +4966,6 @@ void repeat_check(void) } } -#endif /* ALLOW_REPEAT -- TNB */ - #ifdef SORT_R_INFO @@ -5164,10 +5199,10 @@ void build_gamma_table(int gamma) * * NB: The keys added here will be interpreted by any macros or keymaps. */ -errr type_string(cptr str, uint len) +errr type_string(concptr str, uint len) { errr err = 0; - cptr s; + concptr s; term *old = Term; @@ -5199,7 +5234,7 @@ errr type_string(cptr str, uint len) -void roff_to_buf(cptr str, int maxlen, char *tbuf, size_t bufsize) +void roff_to_buf(concptr str, int maxlen, char *tbuf, size_t bufsize) { int read_pt = 0; int write_pt = 0; @@ -5305,12 +5340,12 @@ void roff_to_buf(cptr str, int maxlen, char *tbuf, size_t bufsize) * * This function should be equivalent to the strlcpy() function in BSD. */ -size_t my_strcpy(char *buf, const char *src, size_t bufsize) +size_t my_strcpy(char *buf, concptr src, size_t bufsize) { #ifdef JP char *d = buf; - const char *s = src; + concptr s = src; size_t len = 0; if (bufsize > 0) { @@ -5344,8 +5379,6 @@ size_t my_strcpy(char *buf, const char *src, size_t bufsize) size_t len = strlen(src); size_t ret = len; - - /* Paranoia */ if (bufsize == 0) return ret; /* Truncate */ @@ -5373,7 +5406,7 @@ size_t my_strcpy(char *buf, const char *src, size_t bufsize) * * This function should be equivalent to the strlcat() function in BSD. */ -size_t my_strcat(char *buf, const char *src, size_t bufsize) +size_t my_strcat(char *buf, concptr src, size_t bufsize) { size_t dlen = strlen(buf); @@ -5396,7 +5429,7 @@ size_t my_strcat(char *buf, const char *src, size_t bufsize) * * my_strstr() can handle Kanji strings correctly. */ -char *my_strstr(const char *haystack, const char *needle) +char *my_strstr(concptr haystack, concptr needle) { int i; int l1 = strlen(haystack); @@ -5424,7 +5457,7 @@ char *my_strstr(const char *haystack, const char *needle) * * my_strchr() can handle Kanji strings correctly. */ -char *my_strchr(const char *ptr, char ch) +char *my_strchr(concptr ptr, char ch) { for ( ; *ptr != '\0'; ptr++) { @@ -5469,7 +5502,7 @@ void str_tolower(char *str) int inkey_special(bool numpad_cursor) { static const struct { - cptr keyname; + concptr keyname; int keyflag; } modifier_key_list[] = { {"shift-", SKEY_MOD_SHIFT}, @@ -5479,7 +5512,7 @@ int inkey_special(bool numpad_cursor) static const struct { bool numpad; - cptr keyname; + concptr keyname; int keycode; } special_key_list[] = { {FALSE, "Down]", SKEY_DOWN}, @@ -5510,7 +5543,7 @@ int inkey_special(bool numpad_cursor) }; static const struct { - cptr keyname; + concptr keyname; int keycode; } gcu_special_key_list[] = { {"A", SKEY_UP}, @@ -5525,7 +5558,7 @@ int inkey_special(bool numpad_cursor) }; char buf[1024]; - cptr str = buf; + concptr str = buf; char key; int skey = 0; int modifier = 0; @@ -5633,3 +5666,4 @@ int inkey_special(bool numpad_cursor) /* Return normal keycode */ return (int)((unsigned char)key); } +