--- deliantra/server/common/utils.C 2006/12/31 18:10:40 1.33 +++ deliantra/server/common/utils.C 2007/01/01 12:28:46 1.34 @@ -201,16 +201,15 @@ void maptile::decay_objects () { - int x, y, destroy; - object *op, *otmp; - - for (x = 0; x < width; x++) - for (y = 0; y < height; y++) - for (op = at (x, y).bot; op; op = otmp) + for (int x = 0; x < width; x++) + for (int y = 0; y < height; y++) + for (object *above = 0, *op = at (x, y).bot; op; op = above) { - destroy = 0; - otmp = op->above; + bool destroy = 0; + + above = op->above; + // do not decay anything above unique floor tiles (yet :) if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) break; @@ -221,10 +220,8 @@ || QUERY_FLAG (op, FLAG_OVERLAY_FLOOR) || QUERY_FLAG (op, FLAG_UNPAID) || op->is_alive ()) - continue; - - /* otherwise, we decay and destroy */ - if (op->is_weapon ()) + ; // do not decay + else if (op->is_weapon ()) { op->stats.dam--; if (op->stats.dam < 0) @@ -244,23 +241,19 @@ } else { - if (op->material & M_PAPER || op->material & M_LEATHER || - op->material & M_WOOD || op->material & M_ORGANIC || op->material & M_CLOTH || op->material & M_LIQUID) - destroy = 1; - - if (op->material & M_IRON && rndm (1, 5) == 1) - destroy = 1; - - if (op->material & M_GLASS && rndm (1, 2) == 1) - destroy = 1; - - if ((op->material & M_STONE || op->material & M_ADAMANT) && rndm (1, 10) == 1) - destroy = 1; - - if ((op->material & M_SOFT_METAL || op->material & M_BONE) && rndm (1, 3) == 1) - destroy = 1; + int mat = op->material; - if (op->material & M_ICE && temp > 32) + if (mat & M_PAPER + || mat & M_LEATHER + || mat & M_WOOD + || mat & M_ORGANIC + || mat & M_CLOTH + || mat & M_LIQUID + || (mat & M_IRON && rndm (1, 5) == 1) + || (mat & M_GLASS && rndm (1, 2) == 1) + || ((mat & M_STONE || mat & M_ADAMANT) && rndm (1, 10) == 1) + || ((mat & M_SOFT_METAL || mat & M_BONE) && rndm (1, 3) == 1) + || (mat & M_ICE && temp > 32)) destroy = 1; }