Fixed a small issue and cleaned up the code a little
This commit is contained in:
parent
3707bcfa22
commit
d07e5929fd
@ -3380,28 +3380,34 @@ int map_readallmaps (void)
|
|||||||
|
|
||||||
for(i = 0; i < map_num; i++) {
|
for(i = 0; i < map_num; i++) {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
bool success = false;
|
||||||
|
|
||||||
// show progress
|
|
||||||
if( enable_grf ){
|
if( enable_grf ){
|
||||||
|
// show progress
|
||||||
ShowStatus("Loading maps [%i/%i]: %s"CL_CLL"\r", i, map_num, map[i].name);
|
ShowStatus("Loading maps [%i/%i]: %s"CL_CLL"\r", i, map_num, map[i].name);
|
||||||
|
|
||||||
// try to load the map
|
// try to load the map
|
||||||
if( !map_readgat(&map[i]) ){
|
success = map_readgat(&map[i]) != 0;
|
||||||
map_delmapid(i);
|
|
||||||
maps_removed++;
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
// try to load the map
|
// try to load the map
|
||||||
if( ( map_cache_buffer[1] != NULL && !map_readfromcache( &map[i], map_cache_buffer[1], map_cache_decode_buffer ) ) && // Read from import first, in case of override
|
// Read from import first, in case of override
|
||||||
!map_readfromcache( &map[i], map_cache_buffer[0], map_cache_decode_buffer ) ){
|
if( map_cache_buffer[1] != NULL ){
|
||||||
|
success = map_readfromcache( &map[i], map_cache_buffer[1], map_cache_decode_buffer ) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nothing was found in import - try to find it in the main file
|
||||||
|
if( !success ){
|
||||||
|
success = map_readfromcache( &map[i], map_cache_buffer[0], map_cache_decode_buffer ) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The map was not found - remove it
|
||||||
|
if( !success ){
|
||||||
map_delmapid(i);
|
map_delmapid(i);
|
||||||
maps_removed++;
|
maps_removed++;
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
map[i].index = mapindex_name2id(map[i].name);
|
map[i].index = mapindex_name2id(map[i].name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user