Use partial_range to load textures

This commit is contained in:
Kp 2014-12-20 04:36:11 +00:00
parent 2b1ac84613
commit b68a403e41
2 changed files with 7 additions and 4 deletions

View file

@ -70,7 +70,7 @@ struct mfi {
int vertex_howmany;
int vertex_sizeof;
int texture_offset;
int texture_howmany;
uint32_t texture_howmany;
int texture_sizeof;
int walls_offset;
int walls_howmany;

View file

@ -47,6 +47,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "dxxsconf.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
static void validate_selected_segments(void);
@ -70,7 +71,7 @@ struct group_fileinfo {
int segment_howmany;
int segment_sizeof;
int texture_offset;
int texture_howmany;
uint32_t texture_howmany;
int texture_sizeof;
} group_fileinfo;
@ -1282,10 +1283,12 @@ static int med_load_group( const char *filename, group::vertex_array_type_t &ver
if (PHYSFSX_fseek( LoadFile, group_fileinfo.texture_offset, SEEK_SET ))
Error( "Error seeking to texture_offset in gamemine.c" );
for (i=0; i< group_fileinfo.texture_howmany; i++ )
range_for (auto &i, partial_range(old_tmap_list, group_fileinfo.texture_howmany))
{
if (PHYSFS_read( LoadFile, &old_tmap_list[i], group_fileinfo.texture_sizeof, 1 )!=1)
array<char, FILENAME_LEN> a;
if (PHYSFS_read(LoadFile, a.data(), std::min(static_cast<size_t>(group_fileinfo.texture_sizeof), a.size()), 1) != 1)
Error( "Error reading old_tmap_list[i] in gamemine.c" );
i.copy_if(a);
}
}