1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.25 2006/09/04 17:36:12 root Exp $"; |
3 | * "$Id: map.C,v 1.26 2006/09/07 09:37:12 pippijn 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 | |
… | |
… | |
155 | { |
155 | { |
156 | char buf[MAX_BUF]; |
156 | char buf[MAX_BUF]; |
157 | #ifndef WIN32 |
157 | #ifndef WIN32 |
158 | char *endbuf; |
158 | char *endbuf; |
159 | struct stat statbuf; |
159 | struct stat statbuf; |
160 | int mode = 0, i; |
160 | int mode = 0; |
161 | #endif |
161 | #endif |
162 | |
162 | |
163 | if (prepend_dir) |
163 | if (prepend_dir) |
164 | strcpy (buf, create_pathname(name)); |
164 | strcpy (buf, create_pathname(name)); |
165 | else |
165 | else |
… | |
… | |
1055 | * Return the map object we load into (this can change from the passed |
1055 | * Return the map object we load into (this can change from the passed |
1056 | * option if we can't find the original map) |
1056 | * option if we can't find the original map) |
1057 | */ |
1057 | */ |
1058 | |
1058 | |
1059 | static mapstruct *load_temporary_map(mapstruct *m) { |
1059 | static mapstruct *load_temporary_map(mapstruct *m) { |
1060 | int comp; |
|
|
1061 | char buf[MAX_BUF]; |
1060 | char buf[MAX_BUF]; |
1062 | |
1061 | |
1063 | if (!m->tmpname) { |
1062 | if (!m->tmpname) { |
1064 | LOG(llevError, "No temporary filename for map %s\n", m->path); |
1063 | LOG(llevError, "No temporary filename for map %s\n", m->path); |
1065 | strcpy(buf, m->path); |
1064 | strcpy(buf, m->path); |
… | |
… | |
1199 | */ |
1198 | */ |
1200 | |
1199 | |
1201 | int |
1200 | int |
1202 | new_save_map (mapstruct * m, int flag) |
1201 | new_save_map (mapstruct * m, int flag) |
1203 | { |
1202 | { |
1204 | char filename[MAX_BUF], buf[MAX_BUF], buf_s[MAX_BUF], shop[MAX_BUF]; |
1203 | char filename[MAX_BUF], buf[MAX_BUF], shop[MAX_BUF]; |
1205 | int i; |
1204 | int i; |
1206 | |
1205 | |
1207 | if (flag && !*m->path) |
1206 | if (flag && !*m->path) |
1208 | { |
1207 | { |
1209 | LOG (llevError, "Tried to save map without path.\n"); |
1208 | LOG (llevError, "Tried to save map without path.\n"); |
… | |
… | |
1607 | */ |
1606 | */ |
1608 | |
1607 | |
1609 | int calculate_difficulty(mapstruct *m) { |
1608 | int calculate_difficulty(mapstruct *m) { |
1610 | object *op; |
1609 | object *op; |
1611 | archetype *at; |
1610 | archetype *at; |
1612 | int x, y, i, diff; |
1611 | int x, y, i; |
1613 | long monster_cnt = 0; |
1612 | long monster_cnt = 0; |
1614 | double avgexp = 0; |
1613 | double avgexp = 0; |
1615 | sint64 total_exp = 0; |
1614 | sint64 total_exp = 0; |
1616 | |
1615 | |
1617 | if (MAP_DIFFICULTY (m)) |
1616 | if (MAP_DIFFICULTY (m)) |