From 951d04f930dd232494db0f53979d6345f80a1f2b Mon Sep 17 00:00:00 2001 From: Adrer Date: Fri, 3 Nov 2023 04:45:07 +0100 Subject: [PATCH] Fixes dir flip (#23116) Co-authored-by: adrermail@gmail.com --- code/__DEFINES/directions.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/directions.dm b/code/__DEFINES/directions.dm index 086082c8e31..dfe3b2ecc78 100644 --- a/code/__DEFINES/directions.dm +++ b/code/__DEFINES/directions.dm @@ -16,9 +16,9 @@ /// hence EAST (0010) XOR EAST|WEST (0011) --> WEST (0001) ///Flips a direction along the horizontal axis, will convert E -> W, W -> E, NE -> NW, SE -> SW, etc -#define FLIP_DIR_HORIZONTALLY(dir) (dir ^ (EAST|WEST)) +#define FLIP_DIR_HORIZONTALLY(dir) ((dir & (EAST|WEST)) ? dir ^ (EAST|WEST) : dir) ///Flips a direction along the vertical axis, will convert N -> S, S -> N, NE -> SE, SW -> NW, etc -#define FLIP_DIR_VERTICALLY(dir) (dir ^ (NORTH|SOUTH)) +#define FLIP_DIR_VERTICALLY(dir) ((dir & (NORTH|SOUTH)) ? dir ^ (NORTH|SOUTH) : dir) /// for directions, each cardinal direction only has 1 TRUE bit, so `1000` or `0100` for example, so when you subtract 1 /// from a cardinal direction it results in that directions initial TRUE bit always switching to FALSE, so if you & check it