mirror of
https://github.com/pret/pmd-red.git
synced 2026-04-13 08:38:37 -05:00
28 lines
707 B
C
28 lines
707 B
C
#include "global.h"
|
|
#include "trap.h"
|
|
|
|
#include "dungeon_map_access.h"
|
|
#include "dungeon_util.h"
|
|
#include "map.h"
|
|
|
|
bool8 CanLayTrap(struct Position *pos)
|
|
{
|
|
struct Tile *tile = GetTileSafe(pos->x, pos->y);
|
|
if (tile->terrainType & TERRAIN_TYPE_STAIRS ||
|
|
tile->room == CORRIDOR_ROOM ||
|
|
tile->terrainType & TERRAIN_TYPE_NATURAL_JUNCTION)
|
|
{
|
|
return FALSE;
|
|
}
|
|
if (tile->terrainType & TERRAIN_TYPE_SHOP)
|
|
{
|
|
return FALSE;
|
|
}
|
|
if ((tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) != TERRAIN_TYPE_NORMAL ||
|
|
(tile->object != NULL && GetEntityType(tile->object) != ENTITY_TRAP))
|
|
{
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|