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.98 by root, Sun Dec 31 17:17:22 2006 UTC vs.
Revision 1.101 by root, Mon Jan 1 17:30:33 2007 UTC

624 return; 624 return;
625 } 625 }
626 626
627 mapspace &m = op->ms (); 627 mapspace &m = op->ms ();
628 628
629 if (m.flags_ & P_NEED_UPDATE) 629 if (!(m.flags_ & P_UPTODATE))
630 /* nop */; 630 /* nop */;
631 else if (action == UP_OBJ_INSERT) 631 else if (action == UP_OBJ_INSERT)
632 { 632 {
633 // this is likely overkill, TODO: revisit (schmorp) 633 // this is likely overkill, TODO: revisit (schmorp)
634 if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) 634 if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW))
643 /* This isn't perfect, but I don't expect a lot of objects to 643 /* This isn't perfect, but I don't expect a lot of objects to
644 * to have move_allow right now. 644 * to have move_allow right now.
645 */ 645 */
646 || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block 646 || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block
647 || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp) 647 || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp)
648 m.flags_ = P_NEED_UPDATE; 648 m.flags_ = 0;
649 } 649 }
650 /* if the object is being removed, we can't make intelligent 650 /* if the object is being removed, we can't make intelligent
651 * decisions, because remove_ob can't really pass the object 651 * decisions, because remove_ob can't really pass the object
652 * that is being removed. 652 * that is being removed.
653 */ 653 */
654 else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE) 654 else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE)
655 m.flags_ = P_NEED_UPDATE; 655 m.flags_ = 0;
656 else if (action == UP_OBJ_FACE) 656 else if (action == UP_OBJ_FACE)
657 /* Nothing to do for that case */ ; 657 /* Nothing to do for that case */ ;
658 else 658 else
659 LOG (llevError, "update_object called with invalid action: %d\n", action); 659 LOG (llevError, "update_object called with invalid action: %d\n", action);
660 660
986 else if (map) 986 else if (map)
987 { 987 {
988 if (type == PLAYER) 988 if (type == PLAYER)
989 { 989 {
990 --map->players; 990 --map->players;
991 map->last_access = runtime; 991 map->touch ();
992 } 992 }
993 993
994 map->dirty = true; 994 map->dirty = true;
995 995
996 /* link the object above us */ 996 /* link the object above us */
1072 } 1072 }
1073 1073
1074 /* last == NULL if there are no objects on this space */ 1074 /* last == NULL if there are no objects on this space */
1075 //TODO: this makes little sense, why only update the topmost object? 1075 //TODO: this makes little sense, why only update the topmost object?
1076 if (!last) 1076 if (!last)
1077 map->at (x, y).flags_ = P_NEED_UPDATE; 1077 map->at (x, y).flags_ = 0;
1078 else 1078 else
1079 update_object (last, UP_OBJ_REMOVE); 1079 update_object (last, UP_OBJ_REMOVE);
1080 1080
1081 if (flag [FLAG_BLOCKSVIEW] || glow_radius) 1081 if (flag [FLAG_BLOCKSVIEW] || glow_radius)
1082 update_all_los (map, x, y); 1082 update_all_los (map, x, y);
1376 1376
1377 if (op->type == PLAYER) 1377 if (op->type == PLAYER)
1378 { 1378 {
1379 op->contr->do_los = 1; 1379 op->contr->do_los = 1;
1380 ++op->map->players; 1380 ++op->map->players;
1381 op->map->last_access = runtime; 1381 op->map->touch ();
1382 } 1382 }
1383 1383
1384 op->map->dirty = true; 1384 op->map->dirty = true;
1385 1385
1386 /* If we have a floor, we know the player, if any, will be above 1386 /* If we have a floor, we know the player, if any, will be above
1395 * visible to others on this map. But update_all_los is really 1395 * visible to others on this map. But update_all_los is really
1396 * an inefficient way to do this, as it means los for all players 1396 * an inefficient way to do this, as it means los for all players
1397 * on the map will get recalculated. The players could very well 1397 * on the map will get recalculated. The players could very well
1398 * be far away from this change and not affected in any way - 1398 * be far away from this change and not affected in any way -
1399 * this should get redone to only look for players within range, 1399 * this should get redone to only look for players within range,
1400 * or just updating the P_NEED_UPDATE for spaces within this area 1400 * or just updating the P_UPTODATE for spaces within this area
1401 * of effect may be sufficient. 1401 * of effect may be sufficient.
1402 */ 1402 */
1403 if (op->map->darkness && (op->glow_radius != 0)) 1403 if (op->map->darkness && (op->glow_radius != 0))
1404 update_all_los (op->map, op->x, op->y); 1404 update_all_los (op->map, op->x, op->y);
1405 1405
2613object::flag_desc (char *desc, int len) const 2613object::flag_desc (char *desc, int len) const
2614{ 2614{
2615 char *p = desc; 2615 char *p = desc;
2616 bool first = true; 2616 bool first = true;
2617 2617
2618 *p = 0;
2619
2618 for (int i = 0; i < NUM_FLAGS; i++) 2620 for (int i = 0; i < NUM_FLAGS; i++)
2619 { 2621 {
2620 if (len <= 10) // magic constant! 2622 if (len <= 10) // magic constant!
2621 { 2623 {
2622 snprintf (p, len, ",..."); 2624 snprintf (p, len, ",...");
2623 break; 2625 break;
2624 } 2626 }
2625 2627
2626 if (flag[i]) 2628 if (flag [i])
2627 { 2629 {
2628 int cnt = snprintf (p, len, "%s%d", first ? "" : ",", i); 2630 int cnt = snprintf (p, len, "%s%d", first ? "" : ",", i);
2629 len -= cnt; 2631 len -= cnt;
2630 p += cnt; 2632 p += cnt;
2631 first = false; 2633 first = false;
2633 } 2635 }
2634 2636
2635 return desc; 2637 return desc;
2636} 2638}
2637 2639
2638// return a suitable string describing an objetc in enough detail to find it 2640// return a suitable string describing an object in enough detail to find it
2639const char * 2641const char *
2640object::debug_desc (char *info) const 2642object::debug_desc (char *info) const
2641{ 2643{
2642 char flagdesc[512]; 2644 char flagdesc[512];
2643 char info2[256 * 4]; 2645 char info2[256 * 4];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines