From 2f69c14c7cb92b2f2aea56c81fd5cd1c8ec01af5 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 29 Apr 2024 15:33:21 -0400 Subject: [PATCH] refactor: use DirectionFlag to remove magic numbers in tryMove function --- src/js/game.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/game.ts b/src/js/game.ts index d62c72ed..dfbfb527 100644 --- a/src/js/game.ts +++ b/src/js/game.ts @@ -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 { @@ -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--; }