*
* 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 */
*/
#ifdef SET_UID
extern struct passwd *getpwuid(uid_t uid);
-extern struct passwd *getpwnam(const char *name);
+extern struct passwd *getpwnam(concptr name);
#endif
* 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];
* 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);
*/
static errr path_temp(char *buf, int max)
{
- cptr s;
+ concptr s;
/* Temp file */
s = tmpnam(NULL);
* 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] == '~')
/*
* Hack -- replacement for "fopen()"
*/
-FILE *my_fopen(cptr file, cptr mode)
+FILE *my_fopen(concptr file, concptr mode)
{
char buf[1024];
* Dump a string, plus a newline, to a file
* 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;
/*
* Hack -- attempt to delete a file
*/
-errr fd_kill(cptr file)
+errr fd_kill(concptr file)
{
char buf[1024];
/*
* 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];
/*
* 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];
* This function should fail if the file already exists
* Note that we assume that the file should be "binary"
*/
-int fd_make(cptr file, BIT_FLAGS mode)
+int fd_make(concptr file, BIT_FLAGS mode)
{
char buf[1024];
*
* 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];
/*
* 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);
}
-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 */
}
}
-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 */
}
-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;
* 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;
}
-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;
/*
* 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;
/*
* 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;
/*
* 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;
/*
* 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;
/*
* 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;
* with some kind of "powerful keymap" ability, but this might make it hard
* 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;
{ // 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)
+ quest[i].level == dun_level && p_ptr->dungeon_idx == quest[i].dungeon)
{
if(play_music(TERM_XTRA_MUSIC_QUEST, i))
{
}
}
- if(dungeon_type)
+ if(p_ptr->dungeon_idx)
{
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, p_ptr->dungeon_idx))
{
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);
char ch;
- cptr pat, act;
+ concptr pat, act;
char *buf = inkey_macro_trigger_string;
* 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
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("");
/*
* Add a new "quark" to the set of quarks.
*/
-u16b quark_add(cptr str)
+u16b quark_add(concptr str)
{
u16b i;
/*
* 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;
* @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 ("");
* @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 ***/
/* 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++)
{
char buf[1024];
char *t;
- cptr old;
+ concptr old;
/* Back up and wrap if needed */
if (i-- == 0) i = MESSAGE_MAX - 1;
if (*t)
{
/* Message is too small */
- if (strlen(buf) < 6) break;
+ if (strlen(buf) < A_MAX) break;
/* Drop the space */
*(t - 1) = '\0';
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;
* 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;
/* if (character_generated) message_add(t); */
p_ptr->window |= (PW_MESSAGE);
- handle_stuff();
+ update_output();
/* Remember the message */
msg_flag = TRUE;
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);
/*
* Display a formatted message, using "vstrnfmt()" and "msg_print()".
*/
-void msg_format(cptr fmt, ...)
+void msg_format(concptr fmt, ...)
{
va_list vp;
/*
* 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;
* At the given location, using the given attribute, if allowed,
* add the given string. Do not clear the line.
*/
-void c_put_str(TERM_COLOR 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);
/*
* 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);
* 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);
/*
* 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);
* 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);
/*
* As above, but in "white"
*/
-void roff(cptr str)
+void roff(concptr str)
{
/* Spawn */
c_roff(TERM_WHITE, str);
*
* 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;
*
* 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);
}
* 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];
*
* 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 */
msg_print(NULL);
/* Get a key */
if (get_com_no_macros)
- *command = inkey_special(FALSE);
+ *command = (char)inkey_special(FALSE);
else
*command = inkey();
*
* Hack -- allow "command_arg" to specify a quantity
*/
-QUANTITY get_quantity(cptr prompt, QUANTITY max)
+QUANTITY get_quantity(concptr prompt, QUANTITY max)
{
bool res, result;
QUANTITY amt;
typedef struct
{
- cptr name;
+ concptr name;
byte cmd;
bool fin;
} menu_naiyou;
typedef struct
{
- cptr name;
+ concptr name;
byte window;
byte number;
byte jouken;
{
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);
s16b cmd;
int mode;
- cptr act;
+ concptr act;
#ifdef JP
int caretcmd = 0;
#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)
/* Hack -- Scan equipment */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
- cptr s;
+ concptr s;
object_type *o_ptr = &inventory[i];
* 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;
else
{
BIT_FLAGS mode;
- cptr act, s;
+ concptr act, s;
/* Roguelike */
if (rogue_like_commands)
*
* 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;
-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;
*
* 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) {
*
* 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);
*
* 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);
*
* 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++)
{
int inkey_special(bool numpad_cursor)
{
static const struct {
- cptr keyname;
+ concptr keyname;
int keyflag;
} modifier_key_list[] = {
{"shift-", SKEY_MOD_SHIFT},
static const struct {
bool numpad;
- cptr keyname;
+ concptr keyname;
int keycode;
} special_key_list[] = {
{FALSE, "Down]", SKEY_DOWN},
};
static const struct {
- cptr keyname;
+ concptr keyname;
int keycode;
} gcu_special_key_list[] = {
{"A", SKEY_UP},
};
char buf[1024];
- cptr str = buf;
+ concptr str = buf;
char key;
int skey = 0;
int modifier = 0;