home · contact · privacy
Server: Replace unnecessary bitwise operations with simple == tests.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 13 Aug 2014 23:40:47 +0000 (01:40 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 13 Aug 2014 23:40:47 +0000 (01:40 +0200)
src/server/field_of_view.c
src/server/io.c

index 170d8acb1c83bd310cc01141d3392dd67a5373a9..6ccd16f431c5e1fc59f2d099977c38ee6ce771f0 100644 (file)
@@ -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];
         }
index 485313a4bff954f0da115d30ff12061af993f32b..b5a6871a2ad28e8500042ce034fd52d3b2408b80 100644 (file)
@@ -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)))
                 {