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.74 by root, Wed Dec 20 09:14:21 2006 UTC vs.
Revision 1.78 by root, Fri Dec 22 16:34:00 2006 UTC

467 } 467 }
468 468
469 op->key_values = 0; 469 op->key_values = 0;
470} 470}
471 471
472void object::clear ()
473{
474 attachable_base::clear ();
475
476 free_key_values (this);
477
478 owner = 0;
479 name = 0;
480 name_pl = 0;
481 title = 0;
482 race = 0;
483 slaying = 0;
484 skill = 0;
485 msg = 0;
486 lore = 0;
487 custom_name = 0;
488 materialname = 0;
489 contr = 0;
490 below = 0;
491 above = 0;
492 inv = 0;
493 container = 0;
494 env = 0;
495 more = 0;
496 head = 0;
497 map = 0;
498 active_next = 0;
499 active_prev = 0;
500
501 memset (static_cast<object_pod *>(this), 0, sizeof (object_pod));
502
503 SET_FLAG (this, FLAG_REMOVED);
504
505 /* What is not cleared is next, prev, and count */
506
507 expmul = 1.0;
508 face = blank_face;
509
510 if (settings.casting_time)
511 casting_time = -1;
512}
513
514/* 472/*
515 * copy_to first frees everything allocated by the dst object, 473 * copy_to first frees everything allocated by the dst object,
516 * and then copies the contents of itself into the second 474 * and then copies the contents of itself into the second
517 * object, allocating what needs to be allocated. Basically, any 475 * object, allocating what needs to be allocated. Basically, any
518 * data that is malloc'd needs to be re-malloc/copied. Otherwise, 476 * data that is malloc'd needs to be re-malloc/copied. Otherwise,
694 op->active_next = NULL; 652 op->active_next = NULL;
695 op->active_prev = NULL; 653 op->active_prev = NULL;
696} 654}
697 655
698/* 656/*
699 * update_object() updates the array which represents the map. 657 * update_object() updates the the map.
700 * It takes into account invisible objects (and represent squares covered 658 * It takes into account invisible objects (and represent squares covered
701 * by invisible objects by whatever is below them (unless it's another 659 * by invisible objects by whatever is below them (unless it's another
702 * invisible object, etc...) 660 * invisible object, etc...)
703 * If the object being updated is beneath a player, the look-window 661 * If the object being updated is beneath a player, the look-window
704 * of that player is updated (this might be a suboptimal way of 662 * of that player is updated (this might be a suboptimal way of
705 * updating that window, though, since update_object() is called _often_) 663 * updating that window, though, since update_object() is called _often_)
706 * 664 *
707 * action is a hint of what the caller believes need to be done. 665 * action is a hint of what the caller believes need to be done.
708 * For example, if the only thing that has changed is the face (due to
709 * an animation), we don't need to call update_position until that actually
710 * comes into view of a player. OTOH, many other things, like addition/removal
711 * of walls or living creatures may need us to update the flags now.
712 * current action are: 666 * current action are:
713 * UP_OBJ_INSERT: op was inserted 667 * UP_OBJ_INSERT: op was inserted
714 * UP_OBJ_REMOVE: op was removed 668 * UP_OBJ_REMOVE: op was removed
715 * UP_OBJ_CHANGE: object has somehow changed. In this case, we always update 669 * UP_OBJ_CHANGE: object has somehow changed. In this case, we always update
716 * as that is easier than trying to look at what may have changed. 670 * as that is easier than trying to look at what may have changed.
717 * UP_OBJ_FACE: only the objects face has changed. 671 * UP_OBJ_FACE: only the objects face has changed.
718 */ 672 */
719
720void 673void
721update_object (object *op, int action) 674update_object (object *op, int action)
722{ 675{
723 int update_now = 0, flags;
724 MoveType move_on, move_off, move_block, move_slow; 676 MoveType move_on, move_off, move_block, move_slow;
725 677
726 if (op == NULL) 678 if (op == NULL)
727 { 679 {
728 /* this should never happen */ 680 /* this should never happen */
729 LOG (llevDebug, "update_object() called for NULL object.\n"); 681 LOG (llevDebug, "update_object() called for NULL object.\n");
730 return; 682 return;
731 } 683 }
732 684
733 if (op->env != NULL) 685 if (op->env)
734 { 686 {
735 /* Animation is currently handled by client, so nothing 687 /* Animation is currently handled by client, so nothing
736 * to do in this case. 688 * to do in this case.
737 */ 689 */
738 return; 690 return;
752 abort (); 704 abort ();
753#endif 705#endif
754 return; 706 return;
755 } 707 }
756 708
757 flags = GET_MAP_FLAGS (op->map, op->x, op->y); 709 mapspace &m = op->ms ();
758 SET_MAP_FLAGS (op->map, op->x, op->y, flags | P_NEED_UPDATE);
759 move_slow = GET_MAP_MOVE_SLOW (op->map, op->x, op->y);
760 move_on = GET_MAP_MOVE_ON (op->map, op->x, op->y);
761 move_block = GET_MAP_MOVE_BLOCK (op->map, op->x, op->y);
762 move_off = GET_MAP_MOVE_OFF (op->map, op->x, op->y);
763 710
711 if (m.flags_ & P_NEED_UPDATE)
712 /* nop */;
764 if (action == UP_OBJ_INSERT) 713 else if (action == UP_OBJ_INSERT)
765 { 714 {
715 // this is likely overkill, TODO: revisit (schmorp)
766 if (QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(flags & P_BLOCKSVIEW)) 716 if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW))
767 update_now = 1;
768
769 if (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(flags & P_NO_MAGIC)) 717 || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC))
770 update_now = 1; 718 || (op->type == PLAYER && !(m.flags_ & P_PLAYER))
771 719 || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE))
720 || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE))
772 if (QUERY_FLAG (op, FLAG_DAMNED) && !(flags & P_NO_CLERIC)) 721 || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC))
773 update_now = 1;
774
775 if (QUERY_FLAG (op, FLAG_ALIVE) && !(flags & P_IS_ALIVE))
776 update_now = 1;
777
778 if (op->type == SAFE_GROUND && !(flags & P_SAFE))
779 update_now = 1;
780
781 if ((move_on | op->move_on) != move_on) 722 || (m.move_on | op->move_on ) != m.move_on
782 update_now = 1;
783
784 if ((move_off | op->move_off) != move_off) 723 || (m.move_off | op->move_off ) != m.move_off
785 update_now = 1; 724 || (m.move_slow | op->move_slow) != m.move_slow
786
787 /* This isn't perfect, but I don't expect a lot of objects to 725 /* This isn't perfect, but I don't expect a lot of objects to
788 * to have move_allow right now. 726 * to have move_allow right now.
789 */ 727 */
790 if (((move_block | op->move_block) & ~op->move_allow) != move_block) 728 || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block
791 update_now = 1; 729 || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp)
792 730 m.flags_ = P_NEED_UPDATE;
793 if ((move_slow | op->move_slow) != move_slow)
794 update_now = 1;
795 } 731 }
796
797 /* if the object is being removed, we can't make intelligent 732 /* if the object is being removed, we can't make intelligent
798 * decisions, because remove_ob can't really pass the object 733 * decisions, because remove_ob can't really pass the object
799 * that is being removed. 734 * that is being removed.
800 */ 735 */
801 else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE) 736 else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE)
802 update_now = 1; 737 m.flags_ = P_NEED_UPDATE;
803 else if (action == UP_OBJ_FACE) 738 else if (action == UP_OBJ_FACE)
804 /* Nothing to do for that case */ ; 739 /* Nothing to do for that case */ ;
805 else 740 else
806 LOG (llevError, "update_object called with invalid action: %d\n", action); 741 LOG (llevError, "update_object called with invalid action: %d\n", action);
807 742
808 if (update_now)
809 {
810 SET_MAP_FLAGS (op->map, op->x, op->y, flags | P_NO_ERROR | P_NEED_UPDATE);
811 update_position (op->map, op->x, op->y);
812 }
813
814 if (op->more != NULL) 743 if (op->more)
815 update_object (op->more, action); 744 update_object (op->more, action);
816} 745}
817 746
818object::vector object::mortals; 747object::vector object::mortals;
819object::vector object::objects; // not yet used 748object::vector object::objects; // not yet used
1041 /* NO_FIX_PLAYER is set when a great many changes are being 970 /* NO_FIX_PLAYER is set when a great many changes are being
1042 * made to players inventory. If set, avoiding the call 971 * made to players inventory. If set, avoiding the call
1043 * to save cpu time. 972 * to save cpu time.
1044 */ 973 */
1045 if ((otmp = in_player ()) && otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) 974 if ((otmp = in_player ()) && otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER))
1046 fix_player (otmp); 975 otmp->update_stats ();
1047 976
1048 if (above != NULL) 977 if (above != NULL)
1049 above->below = below; 978 above->below = below;
1050 else 979 else
1051 env->inv = below; 980 env->inv = below;
1070 999
1071 /* link the object above us */ 1000 /* link the object above us */
1072 if (above) 1001 if (above)
1073 above->below = below; 1002 above->below = below;
1074 else 1003 else
1075 SET_MAP_TOP (map, x, y, below); /* we were top, set new top */ 1004 map->at (x, y).top = below; /* we were top, set new top */
1076 1005
1077 /* Relink the object below us, if there is one */ 1006 /* Relink the object below us, if there is one */
1078 if (below) 1007 if (below)
1079 below->above = above; 1008 below->above = above;
1080 else 1009 else
1092 dump = dump_object (GET_MAP_OB (map, x, y)); 1021 dump = dump_object (GET_MAP_OB (map, x, y));
1093 LOG (llevError, "%s\n", dump); 1022 LOG (llevError, "%s\n", dump);
1094 free (dump); 1023 free (dump);
1095 } 1024 }
1096 1025
1097 SET_MAP_OB (map, x, y, above); /* goes on above it. */ 1026 map->at (x, y).bottom = above; /* goes on above it. */
1098 } 1027 }
1099 1028
1100 above = 0; 1029 above = 0;
1101 below = 0; 1030 below = 0;
1102 1031
1121 { 1050 {
1122 CLEAR_FLAG (this, FLAG_APPLIED); 1051 CLEAR_FLAG (this, FLAG_APPLIED);
1123 tmp->container = 0; 1052 tmp->container = 0;
1124 } 1053 }
1125 1054
1126 tmp->contr->socket->floorbox_update (); 1055 tmp->contr->ns->floorbox_update ();
1127 } 1056 }
1128 1057
1129 /* See if player moving off should effect something */ 1058 /* See if player moving off should effect something */
1130 if (check_walk_off 1059 if (check_walk_off
1131 && ((move_type & tmp->move_off) 1060 && ((move_type & tmp->move_off)
1145 last = tmp; 1074 last = tmp;
1146 } 1075 }
1147 1076
1148 /* last == NULL of there are no objects on this space */ 1077 /* last == NULL of there are no objects on this space */
1149 if (!last) 1078 if (!last)
1150 { 1079 map->at (x, y).flags_ = P_NEED_UPDATE;
1151 /* set P_NEED_UPDATE, otherwise update_position will complain. In theory,
1152 * we could preserve the flags (GET_MAP_FLAGS), but update_position figures
1153 * those out anyways, and if there are any flags set right now, they won't
1154 * be correct anyways.
1155 */
1156 SET_MAP_FLAGS (map, x, y, P_NEED_UPDATE);
1157 update_position (map, x, y);
1158 }
1159 else 1080 else
1160 update_object (last, UP_OBJ_REMOVE); 1081 update_object (last, UP_OBJ_REMOVE);
1161 1082
1162 if (QUERY_FLAG (this, FLAG_BLOCKSVIEW) || glow_radius) 1083 if (QUERY_FLAG (this, FLAG_BLOCKSVIEW) || glow_radius)
1163 update_all_los (map, x, y); 1084 update_all_los (map, x, y);
1353 op->below = originator->below; 1274 op->below = originator->below;
1354 1275
1355 if (op->below) 1276 if (op->below)
1356 op->below->above = op; 1277 op->below->above = op;
1357 else 1278 else
1358 SET_MAP_OB (op->map, op->x, op->y, op); 1279 op->ms ().bottom = op;
1359 1280
1360 /* since *below* originator, no need to update top */ 1281 /* since *below* originator, no need to update top */
1361 originator->below = op; 1282 originator->below = op;
1362 } 1283 }
1363 else 1284 else
1409 * If INS_ON_TOP is used, don't do this processing 1330 * If INS_ON_TOP is used, don't do this processing
1410 * Need to find the object that in fact blocks view, otherwise 1331 * Need to find the object that in fact blocks view, otherwise
1411 * stacking is a bit odd. 1332 * stacking is a bit odd.
1412 */ 1333 */
1413 if (!(flag & INS_ON_TOP) && 1334 if (!(flag & INS_ON_TOP) &&
1414 (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_BLOCKSVIEW) && (op->face && !op->face->visibility)) 1335 (get_map_flags (op->map, 0, op->x, op->y, 0, 0) & P_BLOCKSVIEW) && (op->face && !op->face->visibility))
1415 { 1336 {
1416 for (last = top; last != floor; last = last->below) 1337 for (last = top; last != floor; last = last->below)
1417 if (QUERY_FLAG (last, FLAG_BLOCKSVIEW) && (last->type != EXIT)) 1338 if (QUERY_FLAG (last, FLAG_BLOCKSVIEW) && (last->type != EXIT))
1418 break; 1339 break;
1419 /* Check to see if we found the object that blocks view, 1340 /* Check to see if we found the object that blocks view,
1442 1363
1443 if (op->above) 1364 if (op->above)
1444 op->above->below = op; 1365 op->above->below = op;
1445 1366
1446 op->below = NULL; 1367 op->below = NULL;
1447 SET_MAP_OB (op->map, op->x, op->y, op); 1368 op->ms ().bottom = op;
1448 } 1369 }
1449 else 1370 else
1450 { /* get inserted into the stack above top */ 1371 { /* get inserted into the stack above top */
1451 op->above = top->above; 1372 op->above = top->above;
1452 1373
1456 op->below = top; 1377 op->below = top;
1457 top->above = op; 1378 top->above = op;
1458 } 1379 }
1459 1380
1460 if (op->above == NULL) 1381 if (op->above == NULL)
1461 SET_MAP_TOP (op->map, op->x, op->y, op); 1382 op->ms ().top = op;
1462 } /* else not INS_BELOW_ORIGINATOR */ 1383 } /* else not INS_BELOW_ORIGINATOR */
1463 1384
1464 if (op->type == PLAYER) 1385 if (op->type == PLAYER)
1465 op->contr->do_los = 1; 1386 op->contr->do_los = 1;
1466 1387
1467 /* If we have a floor, we know the player, if any, will be above 1388 /* If we have a floor, we know the player, if any, will be above
1468 * it, so save a few ticks and start from there. 1389 * it, so save a few ticks and start from there.
1469 */ 1390 */
1470 if (!(flag & INS_MAP_LOAD)) 1391 if (!(flag & INS_MAP_LOAD))
1471 for (tmp = floor ? floor : GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 1392 if (object *pl = op->ms ().player ())
1472 if (tmp->type == PLAYER)
1473 tmp->contr->socket->floorbox_update (); 1393 pl->contr->ns->floorbox_update ();
1474 1394
1475 /* If this object glows, it may affect lighting conditions that are 1395 /* If this object glows, it may affect lighting conditions that are
1476 * visible to others on this map. But update_all_los is really 1396 * visible to others on this map. But update_all_los is really
1477 * an inefficient way to do this, as it means los for all players 1397 * an inefficient way to do this, as it means los for all players
1478 * on the map will get recalculated. The players could very well 1398 * on the map will get recalculated. The players could very well
1512 1432
1513 return op; 1433 return op;
1514} 1434}
1515 1435
1516/* this function inserts an object in the map, but if it 1436/* this function inserts an object in the map, but if it
1517 * finds an object of its own type, it'll remove that one first. 1437 * finds an object of its own type, it'll remove that one first.
1518 * op is the object to insert it under: supplies x and the map. 1438 * op is the object to insert it under: supplies x and the map.
1519 */ 1439 */
1520void 1440void
1521replace_insert_ob_in_map (const char *arch_string, object *op) 1441replace_insert_ob_in_map (const char *arch_string, object *op)
1522{ 1442{
1523 object * 1443 object *tmp, *tmp1;
1524 tmp;
1525 object *
1526 tmp1;
1527 1444
1528 /* first search for itself and remove any old instances */ 1445 /* first search for itself and remove any old instances */
1529 1446
1530 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 1447 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above)
1531 if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */ 1448 if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */
1765 add_weight (this, (op->weight + op->carrying)); 1682 add_weight (this, (op->weight + op->carrying));
1766 1683
1767 otmp = this->in_player (); 1684 otmp = this->in_player ();
1768 if (otmp && otmp->contr) 1685 if (otmp && otmp->contr)
1769 if (!QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) 1686 if (!QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER))
1770 fix_player (otmp); 1687 otmp->update_stats ();
1771 1688
1772 op->map = 0; 1689 op->map = 0;
1773 op->env = this; 1690 op->env = this;
1774 op->above = 0; 1691 op->above = 0;
1775 op->below = 0; 1692 op->below = 0;
2241 mp = m; 2158 mp = m;
2242 nx = x + freearr_x[i]; 2159 nx = x + freearr_x[i];
2243 ny = y + freearr_y[i]; 2160 ny = y + freearr_y[i];
2244 2161
2245 mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny); 2162 mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny);
2163
2246 if (mflags & P_OUT_OF_MAP) 2164 if (mflags & P_OUT_OF_MAP)
2247 {
2248 max = maxfree[i]; 2165 max = maxfree[i];
2249 }
2250 else 2166 else
2251 { 2167 {
2252 blocked = GET_MAP_MOVE_BLOCK (mp, nx, ny); 2168 blocked = GET_MAP_MOVE_BLOCK (mp, nx, ny);
2253 2169
2254 if ((move_type & blocked) == move_type) 2170 if ((move_type & blocked) == move_type)
2255 {
2256 max = maxfree[i]; 2171 max = maxfree[i];
2257 }
2258 else if (mflags & P_IS_ALIVE) 2172 else if (mflags & P_IS_ALIVE)
2259 { 2173 {
2260 for (tmp = GET_MAP_OB (mp, nx, ny); tmp != NULL; tmp = tmp->above) 2174 for (tmp = GET_MAP_OB (mp, nx, ny); tmp; tmp = tmp->above)
2261 {
2262 if ((QUERY_FLAG (tmp, FLAG_MONSTER) || tmp->type == PLAYER) && (tmp != exclude || (tmp->head && tmp->head != exclude))) 2175 if ((QUERY_FLAG (tmp, FLAG_MONSTER) || tmp->type == PLAYER) && (tmp != exclude || (tmp->head && tmp->head != exclude)))
2263 {
2264 break; 2176 break;
2265 } 2177
2266 }
2267 if (tmp) 2178 if (tmp)
2268 {
2269 return freedir[i]; 2179 return freedir[i];
2270 }
2271 } 2180 }
2272 } 2181 }
2273 } 2182 }
2183
2274 return 0; 2184 return 0;
2275} 2185}
2276 2186
2277/* 2187/*
2278 * distance(object 1, object 2) will return the square of the 2188 * distance(object 1, object 2) will return the square of the
2280 */ 2190 */
2281 2191
2282int 2192int
2283distance (const object *ob1, const object *ob2) 2193distance (const object *ob1, const object *ob2)
2284{ 2194{
2285 int 2195 int i;
2286 i;
2287 2196
2288 i = (ob1->x - ob2->x) * (ob1->x - ob2->x) + (ob1->y - ob2->y) * (ob1->y - ob2->y); 2197 i = (ob1->x - ob2->x) * (ob1->x - ob2->x) + (ob1->y - ob2->y) * (ob1->y - ob2->y);
2289 return i; 2198 return i;
2290} 2199}
2291 2200
2296 */ 2205 */
2297 2206
2298int 2207int
2299find_dir_2 (int x, int y) 2208find_dir_2 (int x, int y)
2300{ 2209{
2301 int 2210 int q;
2302 q;
2303 2211
2304 if (y) 2212 if (y)
2305 q = x * 100 / y; 2213 q = x * 100 / y;
2306 else if (x) 2214 else if (x)
2307 q = -300 * x; 2215 q = -300 * x;
2433 * find a path to that monster that we found. If not, 2341 * find a path to that monster that we found. If not,
2434 * we don't bother going toward it. Returns 1 if we 2342 * we don't bother going toward it. Returns 1 if we
2435 * can see a direct way to get it 2343 * can see a direct way to get it
2436 * Modified to be map tile aware -.MSW 2344 * Modified to be map tile aware -.MSW
2437 */ 2345 */
2438
2439
2440int 2346int
2441can_see_monsterP (maptile *m, int x, int y, int dir) 2347can_see_monsterP (maptile *m, int x, int y, int dir)
2442{ 2348{
2443 sint16 dx, dy; 2349 sint16 dx, dy;
2444 int
2445 mflags; 2350 int mflags;
2446 2351
2447 if (dir < 0) 2352 if (dir < 0)
2448 return 0; /* exit condition: invalid direction */ 2353 return 0; /* exit condition: invalid direction */
2449 2354
2450 dx = x + freearr_x[dir]; 2355 dx = x + freearr_x[dir];
2463 return 0; 2368 return 0;
2464 2369
2465 /* yes, can see. */ 2370 /* yes, can see. */
2466 if (dir < 9) 2371 if (dir < 9)
2467 return 1; 2372 return 1;
2373
2468 return can_see_monsterP (m, x, y, reduction_dir[dir][0]) | 2374 return can_see_monsterP (m, x, y, reduction_dir[dir][0])
2469 can_see_monsterP (m, x, y, reduction_dir[dir][1]) | can_see_monsterP (m, x, y, reduction_dir[dir][2]); 2375 | can_see_monsterP (m, x, y, reduction_dir[dir][1])
2376 | can_see_monsterP (m, x, y, reduction_dir[dir][2]);
2470} 2377}
2471
2472
2473 2378
2474/* 2379/*
2475 * can_pick(picker, item): finds out if an object is possible to be 2380 * can_pick(picker, item): finds out if an object is possible to be
2476 * picked up by the picker. Returnes 1 if it can be 2381 * picked up by the picker. Returnes 1 if it can be
2477 * picked up, otherwise 0. 2382 * picked up, otherwise 0.
2488 return /*QUERY_FLAG(who,FLAG_WIZ)|| */ 2393 return /*QUERY_FLAG(who,FLAG_WIZ)|| */
2489 (item->weight > 0 && !QUERY_FLAG (item, FLAG_NO_PICK) && 2394 (item->weight > 0 && !QUERY_FLAG (item, FLAG_NO_PICK) &&
2490 !QUERY_FLAG (item, FLAG_ALIVE) && !item->invisible && (who->type == PLAYER || item->weight < who->weight / 3)); 2395 !QUERY_FLAG (item, FLAG_ALIVE) && !item->invisible && (who->type == PLAYER || item->weight < who->weight / 3));
2491} 2396}
2492 2397
2493
2494/* 2398/*
2495 * create clone from object to another 2399 * create clone from object to another
2496 */ 2400 */
2497object * 2401object *
2498object_create_clone (object *asrc) 2402object_create_clone (object *asrc)
2517 { 2421 {
2518 dst = tmp; 2422 dst = tmp;
2519 tmp->head = 0; 2423 tmp->head = 0;
2520 } 2424 }
2521 else 2425 else
2522 {
2523 tmp->head = dst; 2426 tmp->head = dst;
2524 }
2525 2427
2526 tmp->more = 0; 2428 tmp->more = 0;
2527 2429
2528 if (prev) 2430 if (prev)
2529 prev->more = tmp; 2431 prev->more = tmp;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines