also sets u.dz, but returns false for <> */
| 3866 | |
| 3867 | /* also sets u.dz, but returns false for <> */ |
| 3868 | int |
| 3869 | movecmd(char sym, int mode) |
| 3870 | { |
| 3871 | int d = DIR_ERR; |
| 3872 | struct Cmd_bind *bind = cmdbind_get(sym); |
| 3873 | |
| 3874 | if (bind && bind->cmd) { |
| 3875 | int (*fnc)(void) = bind->cmd->ef_funct; |
| 3876 | |
| 3877 | if (mode == MV_ANY) { |
| 3878 | for (d = N_DIRS_Z - 1; d > DIR_ERR; d--) |
| 3879 | if (fnc == move_funcs[d][MV_WALK] |
| 3880 | || fnc == move_funcs[d][MV_RUN] |
| 3881 | || fnc == move_funcs[d][MV_RUSH]) |
| 3882 | break; |
| 3883 | } else { |
| 3884 | for (d = N_DIRS_Z - 1; d > DIR_ERR; d--) |
| 3885 | if (fnc == move_funcs[d][mode]) |
| 3886 | break; |
| 3887 | } |
| 3888 | } |
| 3889 | |
| 3890 | if (d != DIR_ERR) { |
| 3891 | u.dx = xdir[d]; |
| 3892 | u.dy = ydir[d]; |
| 3893 | u.dz = zdir[d]; |
| 3894 | return !u.dz; |
| 3895 | } |
| 3896 | u.dz = 0; |
| 3897 | return 0; |
| 3898 | } |
| 3899 | |
| 3900 | /* grid bug handling */ |
| 3901 | int |
no test coverage detected