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.252 by root, Mon Aug 11 23:23:41 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;
765 else if (action == UP_OBJ_INSERT) 762 else if (action == UP_OBJ_INSERT)
766 { 763 {
767 // this is likely overkill, TODO: revisit (schmorp) 764 // this is likely overkill, TODO: revisit (schmorp)
768 if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) 765 if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW))
769 || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) 766 || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC))
770 || (op->type == PLAYER && !(m.flags_ & P_PLAYER))
771 || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) 767 || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE))
772 || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE)) 768 || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE))
773 || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC)) 769 || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC))
774 || (m.move_on | op->move_on ) != m.move_on 770 || (m.move_on | op->move_on ) != m.move_on
775 || (m.move_off | op->move_off ) != m.move_off 771 || (m.move_off | op->move_off ) != m.move_off
776 || (m.move_slow | op->move_slow) != m.move_slow 772 || (m.move_slow | op->move_slow) != m.move_slow
777 /* This isn't perfect, but I don't expect a lot of objects to 773 /* This isn't perfect, but I don't expect a lot of objects to
778 * to have move_allow right now. 774 * have move_allow right now.
779 */ 775 */
780 || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block 776 || ((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) 777 || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp)
782 m.flags_ = 0; 778 m.flags_ = 0;
783 } 779 }
913 || map->in_memory != MAP_ACTIVE 909 || map->in_memory != MAP_ACTIVE
914 || map->no_drop 910 || map->no_drop
915 || ms ().move_block == MOVE_ALL) 911 || ms ().move_block == MOVE_ALL)
916 { 912 {
917 while (inv) 913 while (inv)
918 {
919 inv->destroy_inv (false);
920 inv->destroy (); 914 inv->destroy (true);
921 }
922 } 915 }
923 else 916 else
924 { /* Put objects in inventory onto this space */ 917 { /* Put objects in inventory onto this space */
925 while (inv) 918 while (inv)
926 { 919 {
1541 if (!nr) 1534 if (!nr)
1542 return true; 1535 return true;
1543 1536
1544 nr = min (nr, nrof); 1537 nr = min (nr, nrof);
1545 1538
1539 if (nrof > nr)
1540 {
1546 nrof -= nr; 1541 nrof -= nr;
1547
1548 if (nrof)
1549 {
1550 adjust_weight (env, -weight * nr); // carrying == 0 1542 adjust_weight (env, -weight * max (1, nr)); // carrying == 0
1551 1543
1552 if (object *pl = visible_to ()) 1544 if (object *pl = visible_to ())
1553 esrv_update_item (UPD_NROF, pl, this); 1545 esrv_update_item (UPD_NROF, pl, this);
1554 1546
1555 return true; 1547 return true;
1556 } 1548 }
1557 else 1549 else
1558 { 1550 {
1559 destroy (1); 1551 destroy ();
1560 return false; 1552 return false;
1561 } 1553 }
1562} 1554}
1563 1555
1564/* 1556/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines