From 3dce2a1d9dd93db625c81b09309d9ae0b612dbbb Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 14 Aug 2014 01:40:47 +0200 Subject: [PATCH] Server: Replace unnecessary bitwise operations with simple == tests. --- src/server/field_of_view.c | 4 ++-- src/server/io.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/field_of_view.c b/src/server/field_of_view.c index 170d8ac..6ccd16f 100644 --- a/src/server/field_of_view.c +++ b/src/server/field_of_view.c @@ -267,7 +267,7 @@ static uint8_t shade_hex(uint32_t left_angle, uint32_t right_angle, uint16_t pos_in_map, uint8_t * fov_map) { struct shadow_angle * shadow_i; - if (fov_map[pos_in_map] & VISIBLE) + if (fov_map[pos_in_map] == VISIBLE) { for (shadow_i = *shadows; shadow_i; shadow_i = shadow_i->next) { @@ -373,7 +373,7 @@ static void update_map_memory(struct Thing * t, uint32_t map_size) uint32_t i; for (i = 0; i < map_size; i++) { - if (' ' == t->mem_map[i] && t->fov_map[i] & VISIBLE) + if (' ' == t->mem_map[i] && t->fov_map[i] == VISIBLE) { t->mem_map[i] = world.map.cells[i]; } diff --git a/src/server/io.c b/src/server/io.c index 485313a..b5a6871 100644 --- a/src/server/io.c +++ b/src/server/io.c @@ -309,7 +309,7 @@ static char * build_visible_map(struct Thing * player) uint32_t pos_i; for (pos_i = 0; pos_i < map_size; pos_i++) { - if (player->fov_map[pos_i] & VISIBLE) + if (player->fov_map[pos_i] == VISIBLE) { visible_map[pos_i] = world.map.cells[pos_i]; } @@ -323,7 +323,7 @@ static char * build_visible_map(struct Thing * player) for (t = world.things; t != 0; t = t->next) { if ( ( player->fov_map[t->pos.y * world.map.length +t->pos.x] - & VISIBLE) + == VISIBLE) && ( (0 == i && 0 == t->lifepoints) || (1 == i && 0 < t->lifepoints))) { -- 2.30.2