diff -u -r angband.org/src/xtra2.c angband/src/xtra2.c --- angband.org/src/xtra2.c Tue Jul 25 19:57:50 2000 +++ angband/src/xtra2.c Wed Dec 13 13:18:12 2000 @@ -2526,7 +2533,7 @@ */ sint target_dir(char ch) { - int d; + int d = 0; int mode; @@ -2535,32 +2542,37 @@ cptr s; - /* Default direction */ - d = (isdigit(ch) ? D2I(ch) : 0); - - /* Roguelike */ - if (rogue_like_commands) + /* Already a direction? */ + if (isdigit(ch)) { - mode = KEYMAP_MODE_ROGUE; + d = D2I(ch); } - - /* Original */ else { - mode = KEYMAP_MODE_ORIG; - } + /* Roguelike */ + if (rogue_like_commands) + { + mode = KEYMAP_MODE_ROGUE; + } - /* Extract the action (if any) */ - act = keymap_act[mode][(byte)(ch)]; + /* Original */ + else + { + mode = KEYMAP_MODE_ORIG; + } - /* Analyze */ - if (act) - { - /* Convert to a direction */ - for (s = act; *s; ++s) + /* Extract the action (if any) */ + act = keymap_act[mode][(byte)(ch)]; + + /* Analyze */ + if (act) { - /* Use any digits in keymap */ - if (isdigit(*s)) d = D2I(*s); + /* Convert to a direction */ + for (s = act; *s; ++s) + { + /* Use any digits in keymap */ + if (isdigit(*s)) d = D2I(*s); + } } }