From 33d2d6175067e75cd222b8f05234221ec2d2b82b Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Mon, 21 Feb 2022 15:40:12 -0500 Subject: Decomped CanLayTrap() --- src/trap.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/trap.c (limited to 'src/trap.c') diff --git a/src/trap.c b/src/trap.c new file mode 100644 index 0000000..e054706 --- /dev/null +++ b/src/trap.c @@ -0,0 +1,27 @@ +#include "global.h" +#include "trap.h" + +#include "dungeon_map_access.h" +#include "dungeon_util.h" +#include "map.h" + +bool8 CanLayTrap(struct Position *pos) +{ + struct MapTile *tile = GetMapTile_2(pos->x, pos->y); + if (tile->tileType & TILE_TYPE_STAIRS || + tile->roomIndex == CORRIDOR_ROOM_INDEX || + tile->tileType & TILE_TYPE_ROOM_EXIT) + { + return FALSE; + } + if (tile->tileType & TILE_TYPE_SHOP) + { + return FALSE; + } + if ((tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)) != TILE_TYPE_FLOOR || + (tile->mapObject != NULL && GetEntityType(tile->mapObject) != ENTITY_TRAP)) + { + return FALSE; + } + return TRUE; +} -- cgit v1.2.3