Skip to content

Commit 2c73e13

Browse files
committed
Combine occupied and monster check
1 parent 0bbd5a0 commit 2c73e13

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

src/monster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ has_collided(Monster *monster, RoomMatrix *matrix, Vector2d direction)
335335
monster_behaviour_check_post_attack(monster);
336336
}
337337

338-
return SPACE_IS_OCCUPIED(space) || space->monster;
338+
return SPACE_IS_BLOCKED(space);
339339
}
340340

341341
static bool

src/projectile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ projectile_update(Projectile *p, UpdateData *data)
136136
p->processedSpaces[roomPos.x][roomPos.y] = true;
137137

138138
RoomSpace *space = &data->matrix->spaces[roomPos.x][roomPos.y];
139-
if (!SPACE_IS_OCCUPIED(space) && !space->monster)
139+
if (!SPACE_IS_BLOCKED(space))
140140
return;
141141

142142
if (space->player)

src/roommatrix.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ typedef struct RoomSpace {
6868
#define SPACE_CLEAR_FLAG(space, flag) ((space) && ((space)->flags &= ~flag))
6969
#define SPACE_TOGGLE_FLAG(space, flag) ((space) && ((space)->flags ^= flag))
7070

71+
#define SPACE_IS_BLOCKED(space) (SPACE_IS_OCCUPIED(space) || (space)->monster)
72+
7173
typedef struct RoomMatrix_t {
7274
RoomSpace spaces[MAP_ROOM_WIDTH][MAP_ROOM_HEIGHT];
7375
Position roomPos;

src/skill.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ skill_charge(Skill *skill, SkillData *data)
808808
Position lastAvailableDest = playerStartPos;
809809
while (position_in_roommatrix(&destination))
810810
{
811-
if (SPACE_IS_OCCUPIED(space) || space->monster) {
811+
if (SPACE_IS_BLOCKED(space)) {
812812
if (!space->monster || passThroughCount >= chargeThroughLvl)
813813
break;
814814
else

0 commit comments

Comments
 (0)