1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.20 2006/09/03 00:18:40 root Exp $"; |
3 | * "$Id: map.C,v 1.21 2006/09/03 22:45:55 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 | |
… | |
… | |
503 | * file pointer. |
503 | * file pointer. |
504 | * mapflags is the same as we get with load_original_map |
504 | * mapflags is the same as we get with load_original_map |
505 | */ |
505 | */ |
506 | |
506 | |
507 | void load_objects (mapstruct *m, object_thawer &fp, int mapflags) { |
507 | void load_objects (mapstruct *m, object_thawer &fp, int mapflags) { |
508 | int i,j,bufstate=LO_NEWFILE; |
508 | int i,j; |
509 | int unique; |
509 | int unique; |
510 | object *op, *prev=NULL,*last_more=NULL, *otmp; |
510 | object *op, *prev=NULL,*last_more=NULL, *otmp; |
511 | |
511 | |
512 | op=get_object(); |
512 | op=get_object(); |
513 | op->map = m; /* To handle buttons correctly */ |
513 | op->map = m; /* To handle buttons correctly */ |
514 | |
514 | |
515 | while((i = load_object (fp, op, bufstate, mapflags))) { |
515 | while((i = load_object (fp, op, mapflags))) { |
516 | /* Since the loading of the map header does not load an object |
|
|
517 | * anymore, we need to pass LO_NEWFILE for the first object loaded, |
|
|
518 | * and then switch to LO_REPEAT for faster loading. |
|
|
519 | */ |
|
|
520 | bufstate = LO_REPEAT; |
|
|
521 | |
|
|
522 | /* if the archetype for the object is null, means that we |
516 | /* if the archetype for the object is null, means that we |
523 | * got an invalid object. Don't do anything with it - the game |
517 | * got an invalid object. Don't do anything with it - the game |
524 | * or editor will not be able to do anything with it either. |
518 | * or editor will not be able to do anything with it either. |
525 | */ |
519 | */ |
526 | if (op->arch==NULL) { |
520 | if (op->arch==NULL) { |
… | |
… | |
1170 | return; |
1164 | return; |
1171 | |
1165 | |
1172 | m->in_memory=MAP_LOADING; |
1166 | m->in_memory=MAP_LOADING; |
1173 | if (m->tmpname == NULL) /* if we have loaded unique items from */ |
1167 | if (m->tmpname == NULL) /* if we have loaded unique items from */ |
1174 | delete_unique_items(m); /* original map before, don't duplicate them */ |
1168 | delete_unique_items(m); /* original map before, don't duplicate them */ |
1175 | load_object(thawer, NULL, LO_NOREAD,0); |
|
|
1176 | load_objects (m, thawer, 0); |
1169 | load_objects (m, thawer, 0); |
1177 | |
1170 | |
1178 | m->in_memory=MAP_IN_MEMORY; |
1171 | m->in_memory=MAP_IN_MEMORY; |
1179 | } |
1172 | } |
1180 | |
1173 | |
… | |
… | |
1526 | if (flags & MAP_PLAYER_UNIQUE) |
1519 | if (flags & MAP_PLAYER_UNIQUE) |
1527 | LOG(llevDebug, "Trying to load map %s.\n", name); |
1520 | LOG(llevDebug, "Trying to load map %s.\n", name); |
1528 | else |
1521 | else |
1529 | LOG(llevDebug, "Trying to load map %s.\n", create_pathname(name)); |
1522 | LOG(llevDebug, "Trying to load map %s.\n", create_pathname(name)); |
1530 | |
1523 | |
|
|
1524 | //0.427459955215454 /var/crossfire/players/Saladon/_scorn_apartment_apartments |
|
|
1525 | //0.414906024932861 |
|
|
1526 | //0.427063941955566 |
|
|
1527 | eval_pv ("$x = Event::time", 1);//D |
1531 | if (!(m = load_original_map(name, (flags & MAP_PLAYER_UNIQUE)))) |
1528 | if (!(m = load_original_map(name, (flags & MAP_PLAYER_UNIQUE)))) |
1532 | return (NULL); |
1529 | return (NULL); |
|
|
1530 | eval_pv ("warn \"LOAD \", Event::time - $x", 1);//D |
1533 | |
1531 | |
1534 | fix_auto_apply(m); /* Chests which open as default */ |
1532 | fix_auto_apply(m); /* Chests which open as default */ |
1535 | |
1533 | |
1536 | /* If a player unique map, no extra unique object file to load. |
1534 | /* If a player unique map, no extra unique object file to load. |
1537 | * if from the editor, likewise. |
1535 | * if from the editor, likewise. |