1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.14 2006/08/30 06:06:26 root Exp $"; |
3 | * "$Id: map.C,v 1.16 2006/08/30 16:30:37 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 | |
… | |
… | |
173 | * Can not use strcat because we need to cycle through |
173 | * Can not use strcat because we need to cycle through |
174 | * all the names. |
174 | * all the names. |
175 | */ |
175 | */ |
176 | endbuf = buf + strlen(buf); |
176 | endbuf = buf + strlen(buf); |
177 | |
177 | |
178 | for (i = 0; i < NROF_COMPRESS_METHODS; i++) { |
|
|
179 | if (uncomp[i][0]) |
|
|
180 | strcpy(endbuf, uncomp[i][0]); |
|
|
181 | else |
|
|
182 | *endbuf = '\0'; |
|
|
183 | if (!stat (buf, &statbuf)) |
178 | if (stat (buf, &statbuf)) |
184 | break; |
|
|
185 | } |
|
|
186 | if (i == NROF_COMPRESS_METHODS) |
|
|
187 | return (-1); |
179 | return -1; |
188 | if (!S_ISREG (statbuf.st_mode)) |
180 | if (!S_ISREG (statbuf.st_mode)) |
189 | return (-1); |
181 | return (-1); |
190 | |
182 | |
191 | if (((statbuf.st_mode & S_IRGRP) && getegid() == statbuf.st_gid) || |
183 | if (((statbuf.st_mode & S_IRGRP) && getegid() == statbuf.st_gid) || |
192 | ((statbuf.st_mode & S_IRUSR) && geteuid() == statbuf.st_uid) || |
184 | ((statbuf.st_mode & S_IRUSR) && geteuid() == statbuf.st_uid) || |
… | |
… | |
1181 | /* If we get here, we did not find any map */ |
1173 | /* If we get here, we did not find any map */ |
1182 | if (count==10) return; |
1174 | if (count==10) return; |
1183 | |
1175 | |
1184 | object_thawer thawer (firstname); |
1176 | object_thawer thawer (firstname); |
1185 | |
1177 | |
|
|
1178 | if (!thawer) |
|
|
1179 | return; |
|
|
1180 | |
1186 | m->in_memory=MAP_LOADING; |
1181 | m->in_memory=MAP_LOADING; |
1187 | if (m->tmpname == NULL) /* if we have loaded unique items from */ |
1182 | if (m->tmpname == NULL) /* if we have loaded unique items from */ |
1188 | delete_unique_items(m); /* original map before, don't duplicate them */ |
1183 | delete_unique_items(m); /* original map before, don't duplicate them */ |
1189 | load_object(thawer, NULL, LO_NOREAD,0); |
1184 | load_object(thawer, NULL, LO_NOREAD,0); |
1190 | load_objects (m, thawer, 0); |
1185 | load_objects (m, thawer, 0); |
… | |
… | |
1564 | m=load_overlay_map(name, m); |
1559 | m=load_overlay_map(name, m); |
1565 | if (m==NULL) |
1560 | if (m==NULL) |
1566 | return NULL; |
1561 | return NULL; |
1567 | } |
1562 | } |
1568 | |
1563 | |
|
|
1564 | if (flags & MAP_PLAYER_UNIQUE) |
|
|
1565 | INVOKE_MAP (SWAPIN, m); |
|
|
1566 | |
1569 | } else { |
1567 | } else { |
1570 | /* If in this loop, we found a temporary map, so load it up. */ |
1568 | /* If in this loop, we found a temporary map, so load it up. */ |
1571 | |
1569 | |
1572 | m=load_temporary_map (m); |
1570 | m=load_temporary_map (m); |
1573 | if(m==NULL) return NULL; |
1571 | if(m==NULL) return NULL; |