ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/object.C
(Generate patch)

Comparing deliantra/server/common/object.C (file contents):
Revision 1.245 by root, Sun May 18 19:53:07 2008 UTC vs.
Revision 1.253 by root, Sun Aug 17 22:46:26 2008 UTC

184 if (ob1 == ob2 184 if (ob1 == ob2
185 || ob1->type != ob2->type 185 || ob1->type != ob2->type
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;
190
191 // some objects are unmergable
192 if (!ob1->nrof || !ob2->nrof)
193 return 0; 189 return 0;
194 190
195 /* Do not merge objects if nrof would overflow. First part checks 191 /* Do not merge objects if nrof would overflow. First part checks
196 * for unsigned overflow (2c), second part checks whether the result 192 * for unsigned overflow (2c), second part checks whether the result
197 * would fit into a 32 bit signed int, which is often used to hold 193 * would fit into a 32 bit signed int, which is often used to hold
349 else 345 else
350 { 346 {
351 // maybe there is a player standing on the same mapspace 347 // maybe there is a player standing on the same mapspace
352 // this will catch the case where "this" is a player 348 // this will catch the case where "this" is a player
353 if (object *pl = ms ().player ()) 349 if (object *pl = ms ().player ())
350 if ((!pl->container && pl->contr->ns && !pl->contr->ns->update_look)
354 if (!pl->container || this == pl->container) 351 || this == pl->container)
355 return pl; 352 return pl;
356 } 353 }
357 } 354 }
358 355
359 return 0; 356 return 0;
773 || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC)) 770 || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC))
774 || (m.move_on | op->move_on ) != m.move_on 771 || (m.move_on | op->move_on ) != m.move_on
775 || (m.move_off | op->move_off ) != m.move_off 772 || (m.move_off | op->move_off ) != m.move_off
776 || (m.move_slow | op->move_slow) != m.move_slow 773 || (m.move_slow | op->move_slow) != m.move_slow
777 /* This isn't perfect, but I don't expect a lot of objects to 774 /* This isn't perfect, but I don't expect a lot of objects to
778 * to have move_allow right now. 775 * have move_allow right now.
779 */ 776 */
780 || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block 777 || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block
781 || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp) 778 || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp)
782 m.flags_ = 0; 779 m.flags_ = 0;
783 } 780 }
913 || map->in_memory != MAP_ACTIVE 910 || map->in_memory != MAP_ACTIVE
914 || map->no_drop 911 || map->no_drop
915 || ms ().move_block == MOVE_ALL) 912 || ms ().move_block == MOVE_ALL)
916 { 913 {
917 while (inv) 914 while (inv)
918 {
919 inv->destroy_inv (false);
920 inv->destroy (); 915 inv->destroy (true);
921 }
922 } 916 }
923 else 917 else
924 { /* Put objects in inventory onto this space */ 918 { /* Put objects in inventory onto this space */
925 while (inv) 919 while (inv)
926 { 920 {
1121 *(below ? &below->above : &ms.bot) = above; 1115 *(below ? &below->above : &ms.bot) = above;
1122 1116
1123 above = 0; 1117 above = 0;
1124 below = 0; 1118 below = 0;
1125 1119
1120 ms.flags_ = 0;
1121
1126 if (map->in_memory == MAP_SAVING) 1122 if (map->in_memory == MAP_SAVING)
1127 return; 1123 return;
1128 1124
1129 int check_walk_off = !flag [FLAG_NO_APPLY]; 1125 int check_walk_off = !flag [FLAG_NO_APPLY];
1130 1126
1161 LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); 1157 LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ());
1162 } 1158 }
1163 1159
1164 last = tmp; 1160 last = tmp;
1165 } 1161 }
1166
1167 /* last == NULL if there are no objects on this space */
1168 //TODO: this makes little sense, why only update the topmost object?
1169 if (!last)
1170 map->at (x, y).flags_ = 0;
1171 else
1172 update_object (last, UP_OBJ_REMOVE);
1173 1162
1174 if (flag [FLAG_BLOCKSVIEW] || glow_radius) 1163 if (flag [FLAG_BLOCKSVIEW] || glow_radius)
1175 update_all_los (map, x, y); 1164 update_all_los (map, x, y);
1176 } 1165 }
1177} 1166}
1541 if (!nr) 1530 if (!nr)
1542 return true; 1531 return true;
1543 1532
1544 nr = min (nr, nrof); 1533 nr = min (nr, nrof);
1545 1534
1535 if (nrof > nr)
1536 {
1546 nrof -= nr; 1537 nrof -= nr;
1547
1548 if (nrof)
1549 {
1550 adjust_weight (env, -weight * nr); // carrying == 0 1538 adjust_weight (env, -weight * max (1, nr)); // carrying == 0
1551 1539
1552 if (object *pl = visible_to ()) 1540 if (object *pl = visible_to ())
1553 esrv_update_item (UPD_NROF, pl, this); 1541 esrv_update_item (UPD_NROF, pl, this);
1554 1542
1555 return true; 1543 return true;
1556 } 1544 }
1557 else 1545 else
1558 { 1546 {
1559 destroy (1); 1547 destroy ();
1560 return false; 1548 return false;
1561 } 1549 }
1562} 1550}
1563 1551
1564/* 1552/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines