… | |
… | |
186 | || ob1->speed != ob2->speed |
186 | || ob1->speed != ob2->speed |
187 | || ob1->value != ob2->value |
187 | || ob1->value != ob2->value |
188 | || ob1->name != ob2->name) |
188 | || ob1->name != ob2->name) |
189 | return 0; |
189 | return 0; |
190 | |
190 | |
191 | /* Do not merge objects if nrof would overflow. First part checks |
191 | /* Do not merge objects if nrof would overflow, assume nrof |
192 | * for unsigned overflow (2c), second part checks whether the result |
192 | * is always 0 .. 2**31-1 */ |
193 | * would fit into a 32 bit signed int, which is often used to hold |
193 | if (ob1->nrof > 0x7fffffff - ob2->nrof) |
194 | * nrof values. |
|
|
195 | */ |
|
|
196 | if (~ob1->nrof < ob2->nrof || ob1->nrof + ob2->nrof > (1UL << 31)) |
|
|
197 | return 0; |
194 | return 0; |
198 | |
195 | |
199 | /* If the objects have been identified, set the BEEN_APPLIED flag. |
196 | /* If the objects have been identified, set the BEEN_APPLIED flag. |
200 | * This is to the comparison of the flags below will be OK. We |
197 | * This is to the comparison of the flags below will be OK. We |
201 | * just can't ignore the been applied or identified flags, as they |
198 | * just can't ignore the been applied or identified flags, as they |
… | |
… | |
762 | else if (action == UP_OBJ_INSERT) |
759 | else if (action == UP_OBJ_INSERT) |
763 | { |
760 | { |
764 | // this is likely overkill, TODO: revisit (schmorp) |
761 | // this is likely overkill, TODO: revisit (schmorp) |
765 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
762 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
766 | || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) |
763 | || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) |
|
|
764 | || (op->type == PLAYER && !(m.flags_ & P_PLAYER)) |
767 | || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) |
765 | || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) |
768 | || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE)) |
766 | || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE)) |
769 | || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC)) |
767 | || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC)) |
770 | || (m.move_on | op->move_on ) != m.move_on |
768 | || (m.move_on | op->move_on ) != m.move_on |
771 | || (m.move_off | op->move_off ) != m.move_off |
769 | || (m.move_off | op->move_off ) != m.move_off |
… | |
… | |
1114 | *(below ? &below->above : &ms.bot) = above; |
1112 | *(below ? &below->above : &ms.bot) = above; |
1115 | |
1113 | |
1116 | above = 0; |
1114 | above = 0; |
1117 | below = 0; |
1115 | below = 0; |
1118 | |
1116 | |
|
|
1117 | ms.flags_ = 0; |
|
|
1118 | |
1119 | if (map->in_memory == MAP_SAVING) |
1119 | if (map->in_memory == MAP_SAVING) |
1120 | return; |
1120 | return; |
1121 | |
1121 | |
1122 | int check_walk_off = !flag [FLAG_NO_APPLY]; |
1122 | int check_walk_off = !flag [FLAG_NO_APPLY]; |
1123 | |
1123 | |
… | |
… | |
1154 | LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); |
1154 | LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); |
1155 | } |
1155 | } |
1156 | |
1156 | |
1157 | last = tmp; |
1157 | last = tmp; |
1158 | } |
1158 | } |
1159 | |
|
|
1160 | /* last == NULL if there are no objects on this space */ |
|
|
1161 | //TODO: this makes little sense, why only update the topmost object? |
|
|
1162 | if (!last) |
|
|
1163 | map->at (x, y).flags_ = 0; |
|
|
1164 | else |
|
|
1165 | update_object (last, UP_OBJ_REMOVE); |
|
|
1166 | |
1159 | |
1167 | if (flag [FLAG_BLOCKSVIEW] || glow_radius) |
1160 | if (flag [FLAG_BLOCKSVIEW] || glow_radius) |
1168 | update_all_los (map, x, y); |
1161 | update_all_los (map, x, y); |
1169 | } |
1162 | } |
1170 | } |
1163 | } |