Use enums and defines for directions

This commit is contained in:
Pasi Kallinen
2021-06-27 15:31:00 +03:00
parent dad804e118
commit f25a6e26ee
15 changed files with 111 additions and 120 deletions

View File

@@ -1013,14 +1013,13 @@ findtravelpath(int mode)
int dir;
int x = travelstepx[set][i];
int y = travelstepy[set][i];
static int ordered[] = { 0, 2, 4, 6, 1, 3, 5, 7 };
/* no diagonal movement for grid bugs */
int dirmax = NODIAG(u.umonnum) ? 4 : 8;
int dirmax = NODIAG(u.umonnum) ? 4 : N_DIRS;
boolean alreadyrepeated = FALSE;
for (dir = 0; dir < dirmax; ++dir) {
int nx = x + xdir[ordered[dir]];
int ny = y + ydir[ordered[dir]];
int nx = x + xdir[dirs_ord[dir]];
int ny = y + ydir[dirs_ord[dir]];
/*
* When guessing and trying to travel as close as possible