if (!s) return (-1);
/* Format to length */
+#ifndef WIN32
(void)strnfmt(buf, max, "%s", s);
+#else
+ (void)strnfmt(buf, max, ".%s", s);
+#endif
/* Success */
return (0);
{
char buf[1024];
-#if defined(MACINTOSH) && defined(MAC_MPW)
+#if defined(MAC_MPW) || defined(MACH_O_CARBON)
FILE *tempfff;
#endif
/* Hack -- Try to parse the path */
if (path_parse(buf, 1024, file)) return (NULL);
-#if defined(MACINTOSH) && defined(MAC_MPW)
+#if defined(MAC_MPW) || defined(MACH_O_CARBON)
if (my_strchr(mode, 'w'))
{
/* setting file type/creator */
tempfff = fopen(buf, mode);
- fsetfileinfo(file, _fcreator, _ftype);
+ fsetfileinfo(buf, _fcreator, _ftype);
fclose(tempfff);
}
#endif
#else /* BEN_HACK */
-# if defined(MACINTOSH) && defined(MAC_MPW)
+#if defined(MAC_MPW) || defined(MACH_O_CARBON)
{
int fdes;
/* Create the file, fail if exists, write-only, binary */
}
/* Limit the multiplier to 1000 */
- if (buf && streq(buf, str) && (j < 1000))
+ if (streq(buf, str) && (j < 1000))
{
j++;
* ESCAPE clears the buffer and the window and returns FALSE.
* RETURN accepts the current buffer contents and returns TRUE.
*/
-bool askfor_aux(char *buf, int len, bool numpad_cursor, bool allow_ascii_macro_trigger)
+bool askfor_aux(char *buf, int len, bool numpad_cursor)
{
int y, x;
int pos = 0;
Term_gotoxy(x + pos, y);
/* Get a special key code */
- skey = inkey_special(numpad_cursor, allow_ascii_macro_trigger);
+ skey = inkey_special(numpad_cursor);
/* Analyze the key */
switch (skey)
*/
bool askfor(char *buf, int len)
{
- return askfor_aux(buf, len, TRUE, FALSE);
+ return askfor_aux(buf, len, TRUE);
}
*
* We clear the input, and return FALSE, on "ESCAPE".
*/
-bool get_string(cptr prompt, char *buf, int len, bool allow_ascii_macro_trigger)
+bool get_string(cptr prompt, char *buf, int len)
{
bool res;
prt(prompt, 0, 0);
/* Ask the user for a string */
- res = askfor_aux(buf, len, TRUE, allow_ascii_macro_trigger);
+ res = askfor(buf, len);
/* Clear prompt */
prt("", 0, 0);
prt(prompt, 0, 0);
/* Get a key */
- *command = inkey();
+ if (get_com_no_macros)
+ *command = inkey_special(FALSE);
+ else
+ *command = inkey();
/* Clear the prompt */
prt("", 0, 0);
* Ask for a quantity
* Don't allow to use numpad as cursor key.
*/
- res = askfor_aux(buf, 6, FALSE, TRUE);
+ res = askfor_aux(buf, 6, FALSE);
/* Clear prompt */
prt("", 0, 0);
{
{"ĶǽÎÏ/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_MINDCRAFTER},
{"¤â¤Î¤Þ¤Í/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_IMITATOR},
+ {"²Î/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_BARD},
{"ɬ»¦µ»/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_SAMURAI},
{"Îýµ¤½Ñ/ËâË¡/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_FORCETRAINER},
+ {"µ»/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_BERSERKER},
+ {"µ»½Ñ/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_SMITH},
{"¶ÀËâË¡/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_MIRROR_MASTER},
+ {"Ǧ½Ñ/ÆüìǽÎÏ", 0, 0, MENU_CLASS, CLASS_NINJA},
{"¹°è¥Þ¥Ã¥×(<)", 2, 6, MENU_WILD, FALSE},
{"Ä̾ï¥Þ¥Ã¥×(>)", 2, 7, MENU_WILD, TRUE},
{"", 0, 0, 0, 0},
{
{"MindCraft/Special", 0, 0, MENU_CLASS, CLASS_MINDCRAFTER},
{"Imitation/Special", 0, 0, MENU_CLASS, CLASS_IMITATOR},
+ {"Song/Special", 0, 0, MENU_CLASS, CLASS_BARD},
{"Technique/Special", 0, 0, MENU_CLASS, CLASS_SAMURAI},
{"Mind/Magic/Special", 0, 0, MENU_CLASS, CLASS_FORCETRAINER},
+ {"BrutalPower/Special", 0, 0, MENU_CLASS, CLASS_BERSERKER},
+ {"Technique/Special", 0, 0, MENU_CLASS, CLASS_SMITH},
{"MirrorMagic/Special", 0, 0, MENU_CLASS, CLASS_MIRROR_MASTER},
+ {"Ninjutsu/Special", 0, 0, MENU_CLASS, CLASS_NINJA},
{"Enter global map(<)", 2, 6, MENU_WILD, FALSE},
{"Enter local map(>)", 2, 7, MENU_WILD, TRUE},
{"", 0, 0, 0, 0},
{
tag_type temp;
- temp.tag = a->tag;
- temp.pointer = a->pointer;
-
- a->tag = b->tag;
- a->pointer = b->pointer;
-
- b->tag = temp.tag;
- b->pointer = temp.pointer;
+ temp = *a;
+ *a = *b;
+ *b = temp;
}
const char *s = src;
size_t len = 0;
- /* reserve for NUL termination */
- bufsize--;
+ if (bufsize > 0) {
+ /* reserve for NUL termination */
+ bufsize--;
- /* Copy as many bytes as will fit */
- while (len < bufsize)
- {
- if (iskanji(*s))
+ /* Copy as many bytes as will fit */
+ while (*s && (len < bufsize))
{
- if (len + 1 >= bufsize || !*(s+1)) break;
- *d++ = *s++;
- *d++ = *s++;
- len += 2;
- }
- else
- {
- *d++ = *s++;
- len++;
+ if (iskanji(*s))
+ {
+ if (len + 1 >= bufsize || !*(s+1)) break;
+ *d++ = *s++;
+ *d++ = *s++;
+ len += 2;
+ }
+ else
+ {
+ *d++ = *s++;
+ len++;
+ }
}
+ *d = '\0';
}
- *d = '\0';
+
while(*s++) len++;
return len;
/*
- * A copy of ANSI my_strchr()
+ * A copy of ANSI strchr()
*
* my_strchr() can handle Kanji strings correctly.
*/
* This function is a Mega-Hack and depend on pref-xxx.prf's.
* Currently works on Linux(UNIX), Windows, and Macintosh only.
*/
-int inkey_special(bool numpad_cursor, bool allow_ascii_macro_trigger)
+int inkey_special(bool numpad_cursor)
{
static const struct {
cptr keyname;
int i;
size_t trig_len;
+ /*
+ * Forget macro trigger ----
+ * It's important if we are already expanding macro action
+ */
+ inkey_macro_trigger_string[0] = '\0';
+
/* Get a keypress */
key = inkey();
/*
* Hack -- Ignore macro defined on ASCII characters.
*/
- if ((trig_len == 1) && parse_macro && !allow_ascii_macro_trigger)
+ if (trig_len == 1 && parse_macro)
{
char c = inkey_macro_trigger_string[0];