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.18 by root, Thu Aug 31 17:54:14 2006 UTC vs.
Revision 1.20 by root, Sun Sep 3 00:18:40 2006 UTC

1/* 1/*
2 * static char *rcsid_map_c = 2 * static char *rcsid_map_c =
3 * "$Id: map.C,v 1.18 2006/08/31 17:54:14 root Exp $"; 3 * "$Id: map.C,v 1.20 2006/09/03 00:18:40 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
482 op->x += tmp->x; 482 op->x += tmp->x;
483 op->y += tmp->y; 483 op->y += tmp->y;
484 op->head = tmp; 484 op->head = tmp;
485 op->map = m; 485 op->map = m;
486 last->more = op; 486 last->more = op;
487 if (tmp->name != op->name) {
488 if (op->name) free_string(op->name);
489 op->name = add_string(tmp->name); 487 op->name = tmp->name;
490 }
491 if (tmp->title != op->title) {
492 if (op->title) free_string(op->title);
493 op->title = add_string(tmp->title); 488 op->title = tmp->title;
494 }
495 /* we could link all the parts onto tmp, and then just 489 /* we could link all the parts onto tmp, and then just
496 * call insert_ob_in_map once, but the effect is the same, 490 * call insert_ob_in_map once, but the effect is the same,
497 * as insert_ob_in_map will call itself with each part, and 491 * as insert_ob_in_map will call itself with each part, and
498 * the coding is simpler to just to it here with each part. 492 * the coding is simpler to just to it here with each part.
499 */ 493 */
618 * Modified to no longer take a path option which was not being 612 * Modified to no longer take a path option which was not being
619 * used anyways. MSW 2001-07-01 613 * used anyways. MSW 2001-07-01
620 */ 614 */
621 615
622mapstruct *get_linked_map(void) { 616mapstruct *get_linked_map(void) {
623 mapstruct *map=(mapstruct *) calloc(1,sizeof(mapstruct)); 617 mapstruct *map = new mapstruct;
624 mapstruct *mp; 618 mapstruct *mp;
625
626 if(map==NULL)
627 fatal(OUT_OF_MEMORY);
628 619
629 for(mp=first_map;mp!=NULL&&mp->next!=NULL;mp=mp->next); 620 for(mp=first_map;mp!=NULL&&mp->next!=NULL;mp=mp->next);
630 if(mp==NULL) 621 if(mp==NULL)
631 first_map=map; 622 first_map=map;
632 else 623 else
888 * what really should be used. 879 * what really should be used.
889 */ 880 */
890 else if (!strcmp(key,"oid")) { 881 else if (!strcmp(key,"oid")) {
891 fp.get (m, atoi(value)); 882 fp.get (m, atoi(value));
892 } else if (!strcmp(key, "attach")) { 883 } else if (!strcmp(key, "attach")) {
893 m->attach = add_string (value); 884 m->attach = value;
894 } else if (!strcmp(key,"hp") || !strcmp(key, "enter_x")) { 885 } else if (!strcmp(key,"hp") || !strcmp(key, "enter_x")) {
895 m->enter_x = atoi(value); 886 m->enter_x = atoi(value);
896 } else if (!strcmp(key,"sp") || !strcmp(key, "enter_y")) { 887 } else if (!strcmp(key,"sp") || !strcmp(key, "enter_y")) {
897 m->enter_y = atoi(value); 888 m->enter_y = atoi(value);
898 } else if (!strcmp(key,"x") || !strcmp(key, "width")) { 889 } else if (!strcmp(key,"x") || !strcmp(key, "width")) {
1393 clean_object(op); 1384 clean_object(op);
1394 remove_ob(op); 1385 remove_ob(op);
1395 free_object(op); 1386 free_object(op);
1396 } 1387 }
1397 } 1388 }
1398#ifdef MANY_CORES
1399 /* I see periodic cores on metalforge where a map has been swapped out, but apparantly
1400 * an item on that map was not saved - look for that condition and die as appropriate -
1401 * this leaves more of the map data intact for better debugging.
1402 */
1403 for (op=objects; op!=NULL; op=op->next) {
1404 if (!QUERY_FLAG(op, FLAG_REMOVED) && op->map == m) {
1405 LOG(llevDebug,"free_all_objects: object %s still on map after it should have been freed\n", op->name);
1406 abort();
1407 }
1408 }
1409#endif
1410} 1389}
1411 1390
1412/* 1391/*
1413 * Frees everything allocated by the given mapstructure. 1392 * Frees everything allocated by the given mapstructure.
1414 * don't free tmpname - our caller is left to do that 1393 * don't free tmpname - our caller is left to do that
1494 m->path); 1473 m->path);
1495 } 1474 }
1496 else 1475 else
1497 last->next = m->next; 1476 last->next = m->next;
1498 1477
1499 free (m); 1478 delete m;
1500} 1479}
1501 1480
1502 1481
1503 1482
1504/* 1483/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines