Skip to content

Commit

Permalink
refactor: use DirectionFlag to remove magic numbers in tryMove function
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraviolet-jordan committed Apr 29, 2024
1 parent 8f22cdc commit 2f69c14
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/js/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import SeqFrame from './jagex2/graphics/SeqFrame';
import FloType from './jagex2/config/FloType';
import {setupConfiguration} from './configuration';
import Tile from './jagex2/dash3d/type/Tile';
import DirectionFlag from './jagex2/dash3d/DirectionFlag';

// noinspection JSSuspiciousNameCombination
class Game extends Client {
Expand Down Expand Up @@ -7199,15 +7200,15 @@ class Game extends Client {
this.bfsStepZ[length++] = z;
}

if ((next & 0x2) !== 0) {
if ((next & DirectionFlag.EAST) !== 0) {
x++;
} else if ((next & 0x8) !== 0) {
} else if ((next & DirectionFlag.WEST) !== 0) {
x--;
}

if ((next & 0x1) !== 0) {
if ((next & DirectionFlag.NORTH) !== 0) {
z++;
} else if ((next & 0x4) !== 0) {
} else if ((next & DirectionFlag.SOUTH) !== 0) {
z--;
}

Expand Down

0 comments on commit 2f69c14

Please sign in to comment.