1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.c,v 1.5 2006/02/22 19:08:43 root Exp $"; |
3 | * "$Id: map.c,v 1.6 2006/03/06 22:59:26 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 | |
… | |
… | |
1010 | * cases, no matter if this flag is set or not. |
1010 | * 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 |
1011 | * MAP_STYLE: style map - don't add active objects, don't add to server |
1012 | * managed map list. |
1012 | * managed map list. |
1013 | */ |
1013 | */ |
1014 | |
1014 | |
|
|
1015 | void (*load_original_map_callback)(mapstruct *map); |
|
|
1016 | void (*load_temporary_map_callback)(mapstruct *map); |
|
|
1017 | |
1015 | mapstruct *load_original_map(const char *filename, int flags) { |
1018 | mapstruct *load_original_map(const char *filename, int flags) { |
1016 | FILE *fp; |
1019 | FILE *fp; |
1017 | mapstruct *m; |
1020 | mapstruct *m; |
1018 | int comp; |
1021 | int comp; |
1019 | char pathname[MAX_BUF]; |
1022 | char pathname[MAX_BUF]; |
… | |
… | |
1049 | close_and_delete(fp, comp); |
1052 | close_and_delete(fp, comp); |
1050 | m->in_memory=MAP_IN_MEMORY; |
1053 | m->in_memory=MAP_IN_MEMORY; |
1051 | if (!MAP_DIFFICULTY(m)) |
1054 | if (!MAP_DIFFICULTY(m)) |
1052 | MAP_DIFFICULTY(m)=calculate_difficulty(m); |
1055 | MAP_DIFFICULTY(m)=calculate_difficulty(m); |
1053 | set_map_reset_time(m); |
1056 | set_map_reset_time(m); |
|
|
1057 | if (load_original_map_callback) |
|
|
1058 | load_original_map_callback(m); |
1054 | return (m); |
1059 | return (m); |
1055 | } |
1060 | } |
1056 | |
1061 | |
1057 | /* |
1062 | /* |
1058 | * Loads a map, which has been loaded earlier, from file. |
1063 | * Loads a map, which has been loaded earlier, from file. |
… | |
… | |
1098 | |
1103 | |
1099 | m->in_memory=MAP_LOADING; |
1104 | m->in_memory=MAP_LOADING; |
1100 | load_objects (m, fp, 0); |
1105 | load_objects (m, fp, 0); |
1101 | close_and_delete(fp, comp); |
1106 | close_and_delete(fp, comp); |
1102 | m->in_memory=MAP_IN_MEMORY; |
1107 | m->in_memory=MAP_IN_MEMORY; |
|
|
1108 | if (load_temporary_map_callback) |
|
|
1109 | load_temporary_map_callback(m); |
1103 | return m; |
1110 | return m; |
1104 | } |
1111 | } |
1105 | |
1112 | |
1106 | /* |
1113 | /* |
1107 | * Loads a map, which has been loaded earlier, from file. |
1114 | * Loads a map, which has been loaded earlier, from file. |