Use range_for for properties_read_cmp
This commit is contained in:
parent
8d2d69d663
commit
71bde6f35f
|
@ -23,6 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -161,8 +162,6 @@ int gamedata_init()
|
||||||
// Read compiled properties data from descent.pig
|
// Read compiled properties data from descent.pig
|
||||||
void properties_read_cmp(PHYSFS_file * fp)
|
void properties_read_cmp(PHYSFS_file * fp)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
// bitmap_index is a short
|
// bitmap_index is a short
|
||||||
|
|
||||||
NumTextures = PHYSFSX_readInt(fp);
|
NumTextures = PHYSFSX_readInt(fp);
|
||||||
|
@ -209,14 +208,14 @@ void properties_read_cmp(PHYSFS_file * fp)
|
||||||
|
|
||||||
bitmap_index_read_n(Gauges, MAX_GAUGE_BMS, fp);
|
bitmap_index_read_n(Gauges, MAX_GAUGE_BMS, fp);
|
||||||
|
|
||||||
for (i = 0; i < MAX_POLYGON_MODELS; i++)
|
range_for (auto &i, Dying_modelnums)
|
||||||
Dying_modelnums[i] = PHYSFSX_readInt(fp);
|
i = PHYSFSX_readInt(fp);
|
||||||
for (i = 0; i < MAX_POLYGON_MODELS; i++)
|
range_for (auto &i, Dead_modelnums)
|
||||||
Dead_modelnums[i] = PHYSFSX_readInt(fp);
|
i = PHYSFSX_readInt(fp);
|
||||||
|
|
||||||
bitmap_index_read_n(ObjBitmaps, MAX_OBJ_BITMAPS, fp);
|
bitmap_index_read_n(ObjBitmaps, MAX_OBJ_BITMAPS, fp);
|
||||||
for (i = 0; i < MAX_OBJ_BITMAPS; i++)
|
range_for (auto &i, ObjBitmapPtrs)
|
||||||
ObjBitmapPtrs[i] = PHYSFSX_readShort(fp);
|
i = PHYSFSX_readShort(fp);
|
||||||
|
|
||||||
player_ship_read(&only_player_ship, fp);
|
player_ship_read(&only_player_ship, fp);
|
||||||
|
|
||||||
|
@ -229,8 +228,8 @@ void properties_read_cmp(PHYSFS_file * fp)
|
||||||
Num_total_object_types = PHYSFSX_readInt(fp);
|
Num_total_object_types = PHYSFSX_readInt(fp);
|
||||||
PHYSFS_read( fp, ObjType, sizeof(ubyte), MAX_OBJTYPE );
|
PHYSFS_read( fp, ObjType, sizeof(ubyte), MAX_OBJTYPE );
|
||||||
PHYSFS_read( fp, ObjId, sizeof(ubyte), MAX_OBJTYPE );
|
PHYSFS_read( fp, ObjId, sizeof(ubyte), MAX_OBJTYPE );
|
||||||
for (i = 0; i < MAX_OBJTYPE; i++)
|
range_for (auto &i, ObjStrength)
|
||||||
ObjStrength[i] = PHYSFSX_readFix(fp);
|
i = PHYSFSX_readFix(fp);
|
||||||
|
|
||||||
First_multi_bitmap_num = PHYSFSX_readInt(fp);
|
First_multi_bitmap_num = PHYSFSX_readInt(fp);
|
||||||
Reactors[0].n_guns = PHYSFSX_readInt(fp);
|
Reactors[0].n_guns = PHYSFSX_readInt(fp);
|
||||||
|
@ -245,12 +244,8 @@ void properties_read_cmp(PHYSFS_file * fp)
|
||||||
|
|
||||||
#ifdef EDITOR
|
#ifdef EDITOR
|
||||||
//Build tmaplist
|
//Build tmaplist
|
||||||
Num_tmaps = 0;
|
auto &&effect_range = partial_range(Effects, Num_effects);
|
||||||
for (i=0; i < TextureEffects; i++)
|
Num_tmaps = TextureEffects + std::count_if(effect_range.begin(), effect_range.end(), [](const eclip &e) { return e.changing_wall_texture >= 0; });
|
||||||
Num_tmaps++;
|
|
||||||
for (uint_fast32_t i = 0; i < Num_effects; i++)
|
|
||||||
if (Effects[i].changing_wall_texture >= 0)
|
|
||||||
Num_tmaps++;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif defined(DXX_BUILD_DESCENT_II)
|
#elif defined(DXX_BUILD_DESCENT_II)
|
||||||
|
|
Loading…
Reference in a new issue