1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.c,v 1.6 2006/03/06 22:59:26 root Exp $"; |
3 | * "$Id: map.c,v 1.7 2006/03/07 13:44:42 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 | |
… | |
… | |
38 | #include "path.h" |
38 | #include "path.h" |
39 | |
39 | |
40 | |
40 | |
41 | extern int nrofallocobjects,nroffreeobjects; |
41 | extern int nrofallocobjects,nroffreeobjects; |
42 | |
42 | |
|
|
43 | void (*load_original_map_callback)(mapstruct *map); |
|
|
44 | void (*load_temporary_map_callback)(mapstruct *map); |
|
|
45 | void (*clean_temporary_map_callback)(mapstruct *map); |
43 | |
46 | |
44 | /* |
47 | /* |
45 | * Returns the mapstruct which has a name matching the given argument. |
48 | * Returns the mapstruct which has a name matching the given argument. |
46 | * return NULL if no match is found. |
49 | * return NULL if no match is found. |
47 | */ |
50 | */ |
… | |
… | |
1010 | * cases, no matter if this flag is set or not. |
1013 | * cases, no matter if this flag is set or not. |
1011 | * MAP_STYLE: style map - don't add active objects, don't add to server |
1014 | * MAP_STYLE: style map - don't add active objects, don't add to server |
1012 | * managed map list. |
1015 | * managed map list. |
1013 | */ |
1016 | */ |
1014 | |
1017 | |
1015 | void (*load_original_map_callback)(mapstruct *map); |
|
|
1016 | void (*load_temporary_map_callback)(mapstruct *map); |
|
|
1017 | |
|
|
1018 | mapstruct *load_original_map(const char *filename, int flags) { |
1018 | mapstruct *load_original_map(const char *filename, int flags) { |
1019 | FILE *fp; |
1019 | FILE *fp; |
1020 | mapstruct *m; |
1020 | mapstruct *m; |
1021 | int comp; |
1021 | int comp; |
1022 | char pathname[MAX_BUF]; |
1022 | char pathname[MAX_BUF]; |
… | |
… | |
1664 | } |
1664 | } |
1665 | |
1665 | |
1666 | void clean_tmp_map(mapstruct *m) { |
1666 | void clean_tmp_map(mapstruct *m) { |
1667 | if(m->tmpname == NULL) |
1667 | if(m->tmpname == NULL) |
1668 | return; |
1668 | return; |
|
|
1669 | if (clean_temporary_map_callback) |
|
|
1670 | clean_temporary_map_callback (m); |
1669 | (void) unlink(m->tmpname); |
1671 | (void) unlink(m->tmpname); |
1670 | } |
1672 | } |
1671 | |
1673 | |
1672 | void free_all_maps(void) |
1674 | void free_all_maps(void) |
1673 | { |
1675 | { |