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

Comparing deliantra/server/common/map.C (file contents):
Revision 1.138 by root, Sun May 4 14:12:37 2008 UTC vs.
Revision 1.142 by root, Sun May 18 17:52:53 2008 UTC

641 case KW_sky: thawer.get (sky); break; 641 case KW_sky: thawer.get (sky); break;
642 642
643 case KW_per_player: thawer.get (per_player); break; 643 case KW_per_player: thawer.get (per_player); break;
644 case KW_per_party: thawer.get (per_party); break; 644 case KW_per_party: thawer.get (per_party); break;
645 case KW_no_reset: thawer.get (no_reset); break; 645 case KW_no_reset: thawer.get (no_reset); break;
646 case KW_no_drop: thawer.get (no_drop); break;
646 647
647 case KW_region: default_region = region::find (thawer.get_str ()); break; 648 case KW_region: default_region = region::find (thawer.get_str ()); break;
648 case KW_shopitems: shopitems = parse_shop_string (thawer.get_str ()); break; 649 case KW_shopitems: shopitems = parse_shop_string (thawer.get_str ()); break;
649 650
650 // old names new names 651 // old names new names
724 MAP_OUT (swap_time); 725 MAP_OUT (swap_time);
725 MAP_OUT (reset_time); 726 MAP_OUT (reset_time);
726 MAP_OUT (reset_timeout); 727 MAP_OUT (reset_timeout);
727 MAP_OUT (fixed_resettime); 728 MAP_OUT (fixed_resettime);
728 MAP_OUT (no_reset); 729 MAP_OUT (no_reset);
730 MAP_OUT (no_drop);
729 MAP_OUT (difficulty); 731 MAP_OUT (difficulty);
730 732
731 if (default_region) MAP_OUT2 (region, default_region->name); 733 if (default_region) MAP_OUT2 (region, default_region->name);
732 734
733 if (shopitems) 735 if (shopitems)
981 983
982 if (QUERY_FLAG (op, FLAG_GENERATOR)) 984 if (QUERY_FLAG (op, FLAG_GENERATOR))
983 { 985 {
984 total_exp += op->stats.exp; 986 total_exp += op->stats.exp;
985 987
986 if (archetype *at = type_to_archetype (GENERATE_TYPE (op))) 988 if (archetype *at = op->other_arch)
989 {
987 total_exp += at->stats.exp * 8; 990 total_exp += at->stats.exp * 8;
988
989 monster_cnt++; 991 monster_cnt++;
992 }
993
994 for (object *inv = op->inv; inv; inv = inv->below)
995 {
996 total_exp += op->stats.exp * 8;
997 monster_cnt++;
998 }
990 } 999 }
991 } 1000 }
992 1001
993 avgexp = (double) total_exp / monster_cnt; 1002 avgexp = (double) total_exp / monster_cnt;
994 1003
1033 else 1042 else
1034 darkness = new_level; 1043 darkness = new_level;
1035 1044
1036 /* All clients need to get re-updated for the change */ 1045 /* All clients need to get re-updated for the change */
1037 update_all_map_los (this); 1046 update_all_map_los (this);
1047
1038 return 1; 1048 return 1;
1039} 1049}
1040 1050
1041/* 1051/*
1042 * This function updates various attributes about a specific space 1052 * This function updates various attributes about a specific space
1045 * through, etc) 1055 * through, etc)
1046 */ 1056 */
1047void 1057void
1048mapspace::update_ () 1058mapspace::update_ ()
1049{ 1059{
1050 object *tmp, *last = 0; 1060 object *last = 0;
1051 uint8 flags = P_UPTODATE, light = 0, anywhere = 0; 1061 uint8 flags = P_UPTODATE, light = 0, anywhere = 0;
1052 MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; 1062 MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0;
1053 1063
1054 //object *middle = 0; 1064 //object *middle = 0;
1055 //object *top = 0; 1065 //object *top = 0;
1057 // this seems to generate better code than using locals, above 1067 // this seems to generate better code than using locals, above
1058 object *&top = faces_obj[0] = 0; 1068 object *&top = faces_obj[0] = 0;
1059 object *&middle = faces_obj[1] = 0; 1069 object *&middle = faces_obj[1] = 0;
1060 object *&floor = faces_obj[2] = 0; 1070 object *&floor = faces_obj[2] = 0;
1061 1071
1062 for (tmp = bot; tmp; last = tmp, tmp = tmp->above) 1072 for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above)
1063 { 1073 {
1064 /* This could be made additive I guess (two lights better than 1074 /* This could be made additive I guess (two lights better than
1065 * one). But if so, it shouldn't be a simple additive - 2 1075 * one). But if so, it shouldn't be a simple additive - 2
1066 * light bulbs do not illuminate twice as far as once since 1076 * light bulbs do not illuminate twice as far as once since
1067 * it is a dissapation factor that is cubed. 1077 * it is a dissapation factor that is cubed.
1068 */ 1078 */
1069 if (tmp->glow_radius > light)
1070 light = tmp->glow_radius; 1079 light = max (light, tmp->glow_radius);
1071 1080
1072 /* This call is needed in order to update objects the player 1081 /* This call is needed in order to update objects the player
1073 * is standing in that have animations (ie, grass, fire, etc). 1082 * is standing in that have animations (ie, grass, fire, etc).
1074 * However, it also causes the look window to be re-drawn 1083 * However, it also causes the look window to be re-drawn
1075 * 3 times each time the player moves, because many of the 1084 * 3 times each time the player moves, because many of the
1152 * 1) top face is set, need middle to be set. 1161 * 1) top face is set, need middle to be set.
1153 * 2) middle is set, need to set top. 1162 * 2) middle is set, need to set top.
1154 * 3) neither middle or top is set - need to set both. 1163 * 3) neither middle or top is set - need to set both.
1155 */ 1164 */
1156 1165
1157 for (tmp = last; tmp; tmp = tmp->below) 1166 for (object *tmp = last; tmp; tmp = tmp->below)
1158 { 1167 {
1159 /* Once we get to a floor, stop, since we already have a floor object */ 1168 /* Once we get to a floor, stop, since we already have a floor object */
1160 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) 1169 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR))
1161 break; 1170 break;
1162 1171
1565} 1574}
1566 1575
1567object * 1576object *
1568maptile::insert (object *op, int x, int y, object *originator, int flags) 1577maptile::insert (object *op, int x, int y, object *originator, int flags)
1569{ 1578{
1570 if (!op->flag [FLAG_REMOVED])
1571 op->remove ();
1572
1573 return insert_ob_in_map_at (op, this, originator, flags, x, y); 1579 return insert_ob_in_map_at (op, this, originator, flags, x, y);
1574} 1580}
1575 1581
1576region * 1582region *
1577maptile::region (int x, int y) const 1583maptile::region (int x, int y) const

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines