From: Christian Heller Date: Wed, 13 Aug 2014 23:40:47 +0000 (+0200) Subject: Server: Replace unnecessary bitwise operations with simple == tests. X-Git-Tag: tce~667 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/blog?a=commitdiff_plain;h=3dce2a1d9dd93db625c81b09309d9ae0b612dbbb;p=plomrogue Server: Replace unnecessary bitwise operations with simple == tests. --- 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))) {