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.182 by root, Sun Feb 7 04:22:33 2010 UTC vs.
Revision 1.187 by root, Thu Apr 15 21:49:15 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001-2003,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001-2003 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
662 case KW_end: 662 case KW_end:
663 thawer.next (); 663 thawer.next ();
664 return true; 664 return true;
665 665
666 default: 666 default:
667 if (!thawer.parse_error ("map", 0)) 667 if (!thawer.parse_error ("map"))
668 return false; 668 return false;
669 break; 669 break;
670 } 670 }
671 671
672 thawer.next (); 672 thawer.next ();
690 int unique = 0; 690 int unique = 0;
691 for (object *op = spaces [i].bot; op; ) 691 for (object *op = spaces [i].bot; op; )
692 { 692 {
693 object *above = op->above; 693 object *above = op->above;
694 694
695 if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) 695 if (op->flag [FLAG_IS_FLOOR] && op->flag [FLAG_UNIQUE])
696 unique = 1; 696 unique = 1;
697 697
698 if (op->head_ () == op && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) 698 if (op->head_ () == op && (op->flag [FLAG_UNIQUE] || unique))
699 op->destroy (); 699 op->destroy ();
700 700
701 op = above; 701 op = above;
702 } 702 }
703 } 703 }
854 for (object *above, *op = ms->bot; op; op = above) 854 for (object *above, *op = ms->bot; op; op = above)
855 { 855 {
856 above = op->above; 856 above = op->above;
857 857
858 // do not decay anything above unique floor tiles (yet :) 858 // do not decay anything above unique floor tiles (yet :)
859 if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) 859 if (op->flag [FLAG_IS_FLOOR] && op->flag [FLAG_UNIQUE])
860 break; 860 break;
861 861
862 bool destroy = 0; 862 bool destroy = 0;
863 863
864 if (QUERY_FLAG (op, FLAG_IS_FLOOR) 864 if (op->flag [FLAG_IS_FLOOR]
865 || QUERY_FLAG (op, FLAG_OBJ_ORIGINAL) 865 || op->flag [FLAG_OBJ_ORIGINAL]
866 || QUERY_FLAG (op, FLAG_UNIQUE) 866 || op->flag [FLAG_UNIQUE]
867 || QUERY_FLAG (op, FLAG_OVERLAY_FLOOR) 867 || op->flag [FLAG_OVERLAY_FLOOR]
868 || QUERY_FLAG (op, FLAG_UNPAID) 868 || op->flag [FLAG_UNPAID]
869 || op->is_alive ()) 869 || op->is_alive ())
870 ; // do not decay 870 ; // do not decay
871 else if (op->is_weapon ()) 871 else if (op->is_weapon ())
872 { 872 {
873 op->stats.dam--; 873 op->stats.dam--;
929 sint64 total_exp = 0; 929 sint64 total_exp = 0;
930 930
931 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 931 for (mapspace *ms = spaces + size (); ms-- > spaces; )
932 for (object *op = ms->bot; op; op = op->above) 932 for (object *op = ms->bot; op; op = op->above)
933 { 933 {
934 if (QUERY_FLAG (op, FLAG_MONSTER)) 934 if (op->flag [FLAG_MONSTER])
935 { 935 {
936 total_exp += op->stats.exp; 936 total_exp += op->stats.exp;
937 monster_cnt++; 937 monster_cnt++;
938 } 938 }
939 939
940 if (QUERY_FLAG (op, FLAG_GENERATOR)) 940 if (op->flag [FLAG_GENERATOR])
941 { 941 {
942 total_exp += op->stats.exp; 942 total_exp += op->stats.exp;
943 943
944 if (archetype *at = op->other_arch) 944 if (archetype *at = op->other_arch)
945 { 945 {
1127 */ 1127 */
1128 1128
1129 for (object *tmp = last; tmp; tmp = tmp->below) 1129 for (object *tmp = last; tmp; tmp = tmp->below)
1130 { 1130 {
1131 /* Once we get to a floor, stop, since we already have a floor object */ 1131 /* Once we get to a floor, stop, since we already have a floor object */
1132 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) 1132 if (tmp->flag [FLAG_IS_FLOOR])
1133 break; 1133 break;
1134 1134
1135 /* If two top faces are already set, quit processing */ 1135 /* If two top faces are already set, quit processing */
1136 if (top && middle) 1136 if (top && middle)
1137 break; 1137 break;
1420 * 1420 *
1421 * currently, the only flag supported (0x1) is don't translate for 1421 * currently, the only flag supported (0x1) is don't translate for
1422 * closest body part of 'op1' 1422 * closest body part of 'op1'
1423 */ 1423 */
1424void 1424void
1425get_rangevector (object *op1, object *op2, rv_vector * retval, int flags) 1425get_rangevector (object *op1, object *op2, rv_vector *retval, int flags)
1426{ 1426{
1427 if (!adjacent_map (op1->map, op2->map, &retval->distance_x, &retval->distance_y)) 1427 if (!adjacent_map (op1->map, op2->map, &retval->distance_x, &retval->distance_y))
1428 { 1428 {
1429 /* be conservative and fill in _some_ data */ 1429 /* be conservative and fill in _some_ data */
1430 retval->distance = 10000; 1430 retval->distance = 10000;
1433 retval->direction = 0; 1433 retval->direction = 0;
1434 retval->part = 0; 1434 retval->part = 0;
1435 } 1435 }
1436 else 1436 else
1437 { 1437 {
1438 object *best;
1439
1440 retval->distance_x += op2->x - op1->x; 1438 retval->distance_x += op2->x - op1->x;
1441 retval->distance_y += op2->y - op1->y; 1439 retval->distance_y += op2->y - op1->y;
1442 1440
1443 best = op1; 1441 object *best = op1;
1442
1444 /* If this is multipart, find the closest part now */ 1443 /* If this is multipart, find the closest part now */
1445 if (!(flags & 0x1) && op1->more) 1444 if (!(flags & 1) && op1->more)
1446 { 1445 {
1447 int best_distance = retval->distance_x * retval->distance_x + retval->distance_y * retval->distance_y, tmpi; 1446 int best_distance = retval->distance_x * retval->distance_x + retval->distance_y * retval->distance_y, tmpi;
1448 1447
1449 /* we just take the offset of the piece to head to figure 1448 /* we just take the offset of the piece to head to figure
1450 * distance instead of doing all that work above again 1449 * distance instead of doing all that work above again
1563 */ 1562 */
1564 for (int i = 1000; --i;) 1563 for (int i = 1000; --i;)
1565 { 1564 {
1566 object *pick = at (gen (width), gen (height)).bot; 1565 object *pick = at (gen (width), gen (height)).bot;
1567 1566
1568 // do not prefer big monsters just because they are big. 1567 // must be head: do not prefer big monsters just because they are big.
1569 if (pick && pick->is_head ()) 1568 if (pick && pick->is_head ())
1570 return pick->head_ (); 1569 return pick;
1571 } 1570 }
1572 1571
1573 // instead of crashing in the unlikely(?) case, try to return *something* 1572 // instead of crashing in the unlikely(?) case, try to return *something*
1574 return archetype::find (shstr_bug); 1573 return archetype::find (shstr_bug);
1575} 1574}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines