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.142 by root, Sun May 18 17:52:53 2008 UTC vs.
Revision 1.147 by root, Mon Sep 29 10:20:48 2008 UTC

22 */ 22 */
23 23
24#include <unistd.h> 24#include <unistd.h>
25 25
26#include "global.h" 26#include "global.h"
27
28#include "loader.h" 27#include "loader.h"
29
30#include "path.h" 28#include "path.h"
31 29
32/* This rolls up wall, blocks_magic, blocks_view, etc, all into 30/* This rolls up wall, blocks_magic, blocks_view, etc, all into
33 * one function that just returns a P_.. value (see map.h) 31 * one function that just returns a P_.. value (see map.h)
34 * it will also do map translation for tiled maps, returning 32 * it will also do map translation for tiled maps, returning
260 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 258 for (mapspace *ms = spaces + size (); ms-- > spaces; )
261 for (object *tmp = ms->bot; tmp; tmp = tmp->above) 259 for (object *tmp = ms->bot; tmp; tmp = tmp->above)
262 tmp->flag [flag] = value; 260 tmp->flag [flag] = value;
263} 261}
264 262
263void
264maptile::post_load_original ()
265{
266 if (!spaces)
267 return;
268
269 set_object_flag (FLAG_OBJ_ORIGINAL);
270
271 for (mapspace *ms = spaces + size (); ms-- > spaces; )
272 for (object *tmp = ms->bot; tmp; tmp = tmp->above)
273 INVOKE_OBJECT (RESET, tmp);
274}
275
265/* link_multipart_objects go through all the objects on the map looking 276/* link_multipart_objects go through all the objects on the map looking
266 * for objects whose arch says they are multipart yet according to the 277 * for objects whose arch says they are multipart yet according to the
267 * info we have, they only have the head (as would be expected when 278 * info we have, they only have the head (as would be expected when
268 * they are saved). 279 * they are saved).
269 */ 280 */
340 ms.flags_ = 0; 351 ms.flags_ = 0;
341 } 352 }
342 else 353 else
343 { 354 {
344 f.parse_warn (format ("object %s out of range", op->debug_desc ())); 355 f.parse_warn (format ("object %s out of range", op->debug_desc ()));
356 op->destroy_inv (false); // be explicit about dropping
345 op->destroy (); 357 op->destroy (true);
346 } 358 }
347 } 359 }
348 360
349 continue; 361 continue;
350 362
703 unique = 1; 715 unique = 1;
704 716
705 if (op->head_ () == op && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) 717 if (op->head_ () == op && (QUERY_FLAG (op, FLAG_UNIQUE) || unique))
706 { 718 {
707 op->destroy_inv (false); 719 op->destroy_inv (false);
708 op->destroy (); 720 op->destroy (true);
709 } 721 }
710 722
711 op = above; 723 op = above;
712 } 724 }
713 } 725 }
804 816
805 object *head = op->head_ (); 817 object *head = op->head_ ();
806 if (op == head) 818 if (op == head)
807 { 819 {
808 op->destroy_inv (false); 820 op->destroy_inv (false);
809 op->destroy (); 821 op->destroy (true);
810 } 822 }
811 else if (head->map != op->map) 823 else if (head->map != op->map)
812 { 824 {
813 LOG (llevDebug, "bad luck for object crossing map borders: %s", head->debug_desc ()); 825 LOG (llevDebug, "bad luck for object crossing map borders: %s", head->debug_desc ());
814 head->destroy (); 826 head->destroy (true);
815 } 827 }
816 } 828 }
817 829
818 sfree0 (spaces, size ()); 830 sfree0 (spaces, size ());
819 } 831 }
925 destroy = 1; 937 destroy = 1;
926 } 938 }
927 939
928 /* adjust overall chance below */ 940 /* adjust overall chance below */
929 if (destroy && rndm (0, 1)) 941 if (destroy && rndm (0, 1))
930 op->destroy (); 942 op->destroy (true);
931 } 943 }
932} 944}
933 945
934/* 946/*
935 * Updates every button on the map (by calling update_button() for them). 947 * Updates every button on the map (by calling update_button() for them).
1103 else if (QUERY_FLAG (tmp, FLAG_SEE_ANYWHERE)) 1115 else if (QUERY_FLAG (tmp, FLAG_SEE_ANYWHERE))
1104 { 1116 {
1105 middle = tmp; 1117 middle = tmp;
1106 anywhere = 1; 1118 anywhere = 1;
1107 } 1119 }
1120
1108 /* Find the highest visible face around. If equal 1121 /* Find the highest visible face around. If equal
1109 * visibilities, we still want the one nearer to the 1122 * visibilities, we still want the one nearer to the
1110 * top 1123 * top
1111 */ 1124 */
1112 else if (!middle || (::faces [tmp->face].visibility > ::faces [middle->face].visibility && !anywhere)) 1125 else if (!middle || (::faces [tmp->face].visibility > ::faces [middle->face].visibility && !anywhere))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines