diff options
author | Seth Barberee <seth.barberee@gmail.com> | 2022-02-27 08:43:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-27 08:43:59 -0800 |
commit | ea1aa9c0c5c3a4167912d1078fffdd5e69cbbe98 (patch) | |
tree | 1d3f29615f1683fae77ade7d8713e7bfe5a11c26 /src/trap.c | |
parent | 0dd38993f6a4383d6d5743fd0ae0abc01210ae25 (diff) | |
parent | a5296a2f994a0f8e4421c4afd6bac1cedcfb72be (diff) |
Merge pull request #97 from AnonymousRandomPerson/master
More attack AI decomp
Diffstat (limited to 'src/trap.c')
-rw-r--r-- | src/trap.c | 27 |
1 files changed, 27 insertions, 0 deletions
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; +} |