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.39 by root, Tue Dec 12 20:53:02 2006 UTC vs.
Revision 1.40 by root, Tue Dec 12 21:39:56 2006 UTC

532{ 532{
533 int i, j; 533 int i, j;
534 int unique; 534 int unique;
535 object *op, *prev = NULL, *last_more = NULL, *otmp; 535 object *op, *prev = NULL, *last_more = NULL, *otmp;
536 536
537 op = get_object (); 537 op = object::create ();
538 op->map = m; /* To handle buttons correctly */ 538 op->map = m; /* To handle buttons correctly */
539 539
540 while ((i = load_object (fp, op, mapflags))) 540 while ((i = load_object (fp, op, mapflags)))
541 { 541 {
542 /* if the archetype for the object is null, means that we 542 /* if the archetype for the object is null, means that we
572 } 572 }
573 573
574 if (mapflags & MAP_STYLE) 574 if (mapflags & MAP_STYLE)
575 remove_from_active_list (op); 575 remove_from_active_list (op);
576 576
577 op = get_object (); 577 op = object::create ();
578 op->map = m; 578 op->map = m;
579 } 579 }
580 580
581 for (i = 0; i < m->width; i++) 581 for (i = 0; i < m->width; i++)
582 { 582 {
592 SET_FLAG (otmp, FLAG_OBJ_ORIGINAL); 592 SET_FLAG (otmp, FLAG_OBJ_ORIGINAL);
593 } 593 }
594 } 594 }
595 } 595 }
596 596
597 op->destroy (0); 597 op->destroy ();
598 link_multipart_objects (m); 598 link_multipart_objects (m);
599} 599}
600 600
601/* This saves all the objects on the map in a non destructive fashion. 601/* This saves all the objects on the map in a non destructive fashion.
602 * Modified by MSW 2001-07-01 to do in a single pass - reduces code, 602 * Modified by MSW 2001-07-01 to do in a single pass - reduces code,
1298 1298
1299 for (i = 0; i < MAP_WIDTH (m); i++) 1299 for (i = 0; i < MAP_WIDTH (m); i++)
1300 for (j = 0; j < MAP_HEIGHT (m); j++) 1300 for (j = 0; j < MAP_HEIGHT (m); j++)
1301 { 1301 {
1302 unique = 0; 1302 unique = 0;
1303
1303 for (op = get_map_ob (m, i, j); op; op = next) 1304 for (op = get_map_ob (m, i, j); op; op = next)
1304 { 1305 {
1305 next = op->above; 1306 next = op->above;
1307
1306 if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) 1308 if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE))
1307 unique = 1; 1309 unique = 1;
1310
1308 if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) 1311 if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique))
1309 { 1312 {
1310 clean_object (op); 1313 clean_object (op);
1314
1311 if (QUERY_FLAG (op, FLAG_IS_LINKED)) 1315 if (QUERY_FLAG (op, FLAG_IS_LINKED))
1312 remove_button_link (op); 1316 remove_button_link (op);
1313 op->remove (); 1317
1314 op->destroy (0); 1318 op->destroy ();
1315 } 1319 }
1316 } 1320 }
1317 } 1321 }
1318} 1322}
1319 1323
1514 object *tmp, *next; 1518 object *tmp, *next;
1515 1519
1516 for (tmp = op->inv; tmp; tmp = next) 1520 for (tmp = op->inv; tmp; tmp = next)
1517 { 1521 {
1518 next = tmp->below; 1522 next = tmp->below;
1523
1519 clean_object (tmp); 1524 clean_object (tmp);
1520 if (QUERY_FLAG (tmp, FLAG_IS_LINKED)) 1525 if (QUERY_FLAG (tmp, FLAG_IS_LINKED))
1521 remove_button_link (tmp); 1526 remove_button_link (tmp);
1522 tmp->remove (); 1527
1523 tmp->destroy (0); 1528 tmp->destroy ();
1524 } 1529 }
1525} 1530}
1526 1531
1527/* 1532/*
1528 * Remove and free all objects in the given map. 1533 * Remove and free all objects in the given map.
1544 if (op == previous_obj) 1549 if (op == previous_obj)
1545 { 1550 {
1546 LOG (llevDebug, "free_all_objects: Link error, bailing out.\n"); 1551 LOG (llevDebug, "free_all_objects: Link error, bailing out.\n");
1547 break; 1552 break;
1548 } 1553 }
1554
1549 previous_obj = op; 1555 previous_obj = op;
1556
1550 if (op->head != NULL) 1557 if (op->head != NULL)
1551 op = op->head; 1558 op = op->head;
1552 1559
1553 /* If the map isn't in memory, free_object will remove and 1560 /* If the map isn't in memory, free_object will remove and
1554 * free objects in op's inventory. So let it do the job. 1561 * free objects in op's inventory. So let it do the job.
1555 */ 1562 */
1556 if (m->in_memory == MAP_IN_MEMORY) 1563 if (m->in_memory == MAP_IN_MEMORY)
1557 clean_object (op); 1564 clean_object (op);
1558 op->remove (); 1565
1559 op->destroy (0); 1566 op->destroy ();
1560 } 1567 }
1561 } 1568 }
1562} 1569}
1563 1570
1564/* 1571/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines