MCPcopy Index your code
hub / github.com/NetHack/NetHack / movecmd

Function movecmd

src/cmd.c:3868–3898  ·  view source on GitHub ↗

also sets u.dz, but returns false for <> */

Source from the content-addressed store, hash-verified

3866
3867/* also sets u.dz, but returns false for <> */
3868int
3869movecmd(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 */
3901int

Callers 4

use_pick_axeFunction · 0.85
key2extcmddescFunction · 0.85
getdirFunction · 0.85
getposFunction · 0.85

Calls 1

cmdbind_getFunction · 0.85

Tested by

no test coverage detected