1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.19 2006/08/31 18:59:23 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 | |
622 | mapstruct *get_linked_map(void) { |
616 | mapstruct *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")) { |
… | |
… | |
1482 | m->path); |
1473 | m->path); |
1483 | } |
1474 | } |
1484 | else |
1475 | else |
1485 | last->next = m->next; |
1476 | last->next = m->next; |
1486 | |
1477 | |
1487 | free (m); |
1478 | delete m; |
1488 | } |
1479 | } |
1489 | |
1480 | |
1490 | |
1481 | |
1491 | |
1482 | |
1492 | /* |
1483 | /* |