Remove highest_valid

This commit is contained in:
Kp 2016-02-12 04:02:28 +00:00
parent e07c9a5f87
commit 2fd6a425b0
38 changed files with 130 additions and 174 deletions

View file

@ -1,7 +0,0 @@
#pragma once
template <typename T>
T &highest_valid(T &t)
{
return t;
}

View file

@ -68,7 +68,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "segiter.h"
#include "compiler-exchange.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#ifdef EDITOR
@ -425,7 +424,7 @@ static void thief_message(const char * format, ... )
// Return true if marker #id has been placed.
static int marker_exists_in_mine(int id)
{
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_MARKER)
if (get_marker_id(objp) == id)
@ -508,7 +507,7 @@ void set_escort_special_goal(int special_key)
// Return id of boss.
static int get_boss_id(void)
{
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_ROBOT)
{
@ -596,7 +595,7 @@ static objnum_t exists_in_mine(segnum_t start_seg, int objtype, int objid, int s
// Couldn't find what we're looking for by looking at connectivity.
// See if it's in the mine. It could be hidden behind a trigger or switch
// which the buddybot doesn't understand.
range_for (const auto &&segnum, highest_valid(vcsegptridx))
range_for (const auto &&segnum, vcsegptridx)
{
auto objnum = exists_in_mine_2(segnum, objtype, objid, special);
if (objnum != object_none)
@ -611,7 +610,7 @@ static objnum_t exists_in_mine(segnum_t start_seg, int objtype, int objid, int s
static segnum_t find_exit_segment(void)
{
// ---------- Find exit doors ----------
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
range_for (const auto j, segp->children)
if (j == segment_exit)

View file

@ -62,7 +62,6 @@
#include "compiler-exchange.h"
#include "compiler-make_unique.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include <algorithm>
@ -474,7 +473,7 @@ void ogl_cache_level_textures(void)
ogl_cache_polymodel_textures(Player_ship->model_num);
ogl_cache_vclipn_textures(Player_ship->expl_vclip_num);
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
if (objp->type == OBJ_POWERUP && objp->render_type==RT_POWERUP)
{

View file

@ -38,7 +38,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "texmap.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
// -----------------------------------------------------------------------------
// Return light intensity at an instance of a vertex on a side in a segment.
@ -160,7 +159,7 @@ static void propagate_light_intensity(const vsegptr_t segp, int sidenum)
// on user-defined light sources.
int LightAmbientLighting()
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
for (int side=0;side<MAX_SIDES_PER_SEGMENT;side++)
propagate_light_intensity(segp, side);

View file

@ -56,7 +56,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "cntrlcen.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "segiter.h"
#define OBJ_SCALE (F1_0/2)
@ -275,7 +274,7 @@ static int compute_num_players(void)
{
int count = 0;
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_PLAYER)
count++;
@ -456,7 +455,7 @@ int ObjectDelete(void)
// Return value: 0 = in mine, 1 = not in mine
static int move_object_within_mine(const vobjptridx_t obj, const vms_vector &newpos)
{
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (get_seg_masks(obj->pos, segp, 0).centermask == 0) {
int fate;

View file

@ -46,7 +46,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "medwall.h"
#include "dxxsconf.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
@ -691,7 +690,7 @@ static int med_move_group(int delta_flag, const vsegptridx_t base_seg, int base_
in_vertex_list[Segments[gs].verts[v]] = 1;
// For all segments which are not in GroupList[current_group].segments, mark all their vertices in the out list.
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (!GroupList[current_group].segments.contains(segp))
{

View file

@ -31,7 +31,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gamesave.h"
#include "kdefs.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
// ---------- Create a bridge segment between current segment/side and marked segment/side ----------
int CreateBridge()
@ -189,7 +188,7 @@ int CreateAdjacentJointsAll()
med_combine_duplicate_vertices(Vertex_active);
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
for (int s=0; s<MAX_SIDES_PER_SEGMENT; s++)
{

View file

@ -32,7 +32,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "kdefs.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#define XDIM 0
#define YDIM 1
@ -52,7 +51,7 @@ static void validate_modified_segments(void)
for (int v=0; v<Modified_vertex_index; v++) {
v0 = Modified_vertices[v];
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp->segnum != segment_none)
{

View file

@ -54,7 +54,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "fuelcen.h"
#include "meddraw.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "segiter.h"
#ifdef OGL
@ -564,7 +563,7 @@ static void draw_mine_all(int automap_flag)
n_used = 0;
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp->segnum != segment_none)
{
@ -624,7 +623,7 @@ static void draw_group_segments(void)
static void draw_special_segments(void)
{
// Highlight matcens, fuelcens, etc.
range_for (const auto &&segp, highest_valid(vcsegptr))
range_for (const auto &&segp, vcsegptr)
{
if (segp->segnum != segment_none)
{

View file

@ -54,7 +54,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-exchange.h"
#include "compiler-make_unique.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
static int wall_add_to_side(const vsegptridx_t segp, int side, sbyte type);
@ -654,7 +653,7 @@ int wall_remove_side(const vsegptridx_t seg, short side)
Walls.set_count(Num_walls - 2);
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
if (segp->segnum != segment_none)
for (int w=0;w<MAX_SIDES_PER_SEGMENT;w++)
@ -907,7 +906,7 @@ int check_walls()
int matcen_num;
unsigned wall_count = 0;
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp->segnum != segment_none) {
// Check fuelcenters
@ -974,7 +973,7 @@ int delete_all_walls()
{
if (ui_messagebox(-2, -2, 2, "Are you sure that walls are hosed so\n badly that you want them ALL GONE!?\n", "YES!", "No") == 1)
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
range_for (auto &side, segp->sides)
side.wall_num = wall_none;
@ -1079,7 +1078,7 @@ void check_wall_validity(void)
for (int i=0; i<MAX_WALLS; i++)
wall_flags[i] = 0;
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp->segnum != segment_none)
for (int j=0; j<MAX_SIDES_PER_SEGMENT; j++) {

View file

@ -50,7 +50,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "hostage.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
@ -571,7 +570,7 @@ static void change_vertex_occurrences(int dest, int src)
g.vertices.replace(src, dest);
// now scan all segments, changing occurrences of src to dest
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
if (segp->segnum != segment_none)
range_for (auto &v, segp->verts)
@ -932,7 +931,7 @@ void set_vertex_counts(void)
Vertex_active[v] = 0;
// Count number of occurrences of each vertex.
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
if (segp->segnum != segment_none)
range_for (auto &v, segp->verts)
@ -1247,7 +1246,7 @@ int med_form_joint(const vsegptridx_t seg1, int side1, const vsegptridx_t seg2,
validation_list[0] = seg2;
for (v=0; v<4; v++)
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp->segnum != segment_none)
range_for (auto &sv, segp->verts)
@ -1550,7 +1549,7 @@ void find_concave_segs()
{
Warning_segs.clear();
range_for (const auto &&s, highest_valid(vcsegptridx))
range_for (const auto &&s, vcsegptridx)
if (s->segnum != segment_none)
if (check_seg_concavity(s))
Warning_segs.emplace_back(s);
@ -1599,7 +1598,7 @@ int med_find_adjacent_segment_side(const vsegptridx_t sp, int side, segptridx_t
abs_verts[v] = sp->verts[Side_to_verts[side][v]];
// Scan all segments, looking for a segment which contains the four abs_verts
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp != sp)
{
@ -1660,7 +1659,7 @@ int med_find_closest_threshold_segment_side(const vsegptridx_t sp, int side, seg
closest_seg_dist = JOINT_THRESHOLD;
// Scan all segments, looking for a segment which contains the four abs_verts
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp != sp)
for (s=0;s<MAX_SIDES_PER_SEGMENT;s++) {

View file

@ -43,7 +43,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "seguvs.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
namespace dcx {
static void cast_all_light_in_mine(int quick_flag);
@ -70,7 +69,7 @@ static fix get_average_light_at_vertex(int vnum, segnum_t *segs)
num_occurrences = 0;
total_light = 0;
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
auto e = end(segp->verts);
auto relvnum = std::distance(std::find(begin(segp->verts), e, vnum), e);
@ -257,7 +256,7 @@ static void assign_default_lighting(const vsegptr_t segp)
void assign_default_lighting_all(void)
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
if (segp->segnum != segment_none)
assign_default_lighting(segp);
@ -803,7 +802,7 @@ static void fix_bogus_uvs_seg(const vsegptridx_t segp)
int fix_bogus_uvs_all(void)
{
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp->segnum != segment_none)
fix_bogus_uvs_seg(segp);
@ -936,7 +935,7 @@ static void cast_light_from_side(const vsegptridx_t segp, int light_side, fix li
// -- Old way, before 5/8/95 -- inverse_segment_magnitude = fixdiv(F1_0/5, vm_vec_mag(&vector_to_center));
// -- Old way, before 5/8/95 -- vm_vec_scale_add(&light_location, &light_location, &vector_to_center, inverse_segment_magnitude);
range_for (const auto &&rsegp, highest_valid(vsegptr))
range_for (const auto &&rsegp, vsegptr)
{
fix dist_to_rseg;
@ -1059,7 +1058,7 @@ static void calim_zero_light_values(void)
{
int sidenum, vertnum;
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++) {
side *sidep = &segp->sides[sidenum];
@ -1085,7 +1084,7 @@ static void cast_light_from_side_to_center(const vsegptridx_t segp, int light_si
const auto vector_to_center = vm_vec_sub(segment_center, vert_light_location);
const auto light_location = vm_vec_scale_add(vert_light_location, vector_to_center, F1_0/64);
range_for (const auto &&rsegp, highest_valid(vsegptr))
range_for (const auto &&rsegp, vsegptr)
{
fix dist_to_rseg;
//if ((segp == &Segments[Bugseg]) && (rsegp == &Segments[Bugseg]))
@ -1153,7 +1152,7 @@ static void calim_process_all_lights(int quick_light)
{
int sidenum;
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++) {
// if (!IS_CHILD(segp->children[sidenum])) {

View file

@ -45,7 +45,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "piggy.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#define TMAPS_PER_PAGE 12
@ -267,7 +266,7 @@ void do_replacements(void)
Assert(old_tmap_num >= 0);
Assert(new_tmap_num >= 0);
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
for (int sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++) {
const auto sidep = &segp->sides[sidenum];

View file

@ -80,7 +80,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
//end addition -MM
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "segiter.h"
#include "partial_range.h"
@ -506,7 +505,7 @@ void init_ai_objects(void)
{
Point_segs_free_ptr = Point_segs.begin();
range_for (const auto &&o, highest_valid(vobjptr))
range_for (const auto &&o, vobjptr)
{
if (o->type == OBJ_ROBOT && o->control_type == CT_AI)
init_ai_object(o, o->ctype.ai_info.behavior, o->ctype.ai_info.hide_segment);
@ -1935,7 +1934,7 @@ static objptridx_t create_gated_robot(const vsegptridx_t segp, int object_id, co
return object_none;
#endif
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_ROBOT)
if (objp->matcen_creator == BOSS_GATE_MATCEN_NUM)
@ -2082,7 +2081,7 @@ static void init_boss_segments(boss_special_segment_array_t &segptr, int size_ch
#endif
// See if there is a boss. If not, quick out.
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if (objp->type == OBJ_ROBOT && Robot_info[get_robot_id(objp)].boss_flag)
{
@ -3079,7 +3078,7 @@ void do_ai_frame(const vobjptridx_t obj)
cobjptr_t min_obj = nullptr;
fix min_dist = F1_0*200, cur_dist;
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_ROBOT && objp != obj)
{
@ -4257,7 +4256,7 @@ static void set_player_awareness_all(void)
process_awareness_events(New_awareness);
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT && objp->control_type == CT_AI)
{
@ -4307,7 +4306,7 @@ static void dump_ai_objects_all()
if (Ai_error_message[0])
fprintf(Ai_dump_file, "Error message: %s\n", Ai_error_message);
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
ai_static *aip = &objp->ctype.ai_info;
ai_local *ailp = &objp->ctype.ai_info.ail;
@ -4370,7 +4369,7 @@ void do_ai_frame_all(void)
// Clear if supposed misisle camera is not a weapon, or just every so often, just in case.
if (((d_tick_count & 0x0f) == 0) || (Ai_last_missile_camera->type != OBJ_WEAPON)) {
Ai_last_missile_camera = nullptr;
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
objp->ctype.ai_info.SUB_FLAGS &= ~SUB_FLAGS_CAMERA_AWAKE;
@ -4380,7 +4379,7 @@ void do_ai_frame_all(void)
// (Moved here from do_boss_stuff() because that only gets called if robot aware of player.)
if (Boss_dying) {
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if (objp->type == OBJ_ROBOT)
if (Robot_info[get_robot_id(objp)].boss_flag)

View file

@ -48,7 +48,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "game.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
// Length in segments of avoidance path
@ -597,7 +596,7 @@ void validate_all_paths(void)
{
#if PATH_VALIDATION
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT) {
ai_static *aip = &objp->ctype.ai_info;
@ -1333,7 +1332,7 @@ void ai_path_garbage_collect()
validate_all_paths();
#endif
// Create a list of objects which have paths of length 1 or more.
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
if ((objp->type == OBJ_ROBOT) && ((objp->control_type == CT_AI)
#if defined(DXX_BUILD_DESCENT_II)
@ -1372,7 +1371,7 @@ void ai_path_garbage_collect()
{
force_dump_ai_objects_all("***** Finish ai_path_garbage_collect *****");
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
const auto &aip = objp->ctype.ai_info;
@ -1416,7 +1415,7 @@ void maybe_ai_path_garbage_collect(void)
// Should be called at the start of each level.
void ai_reset_all_paths(void)
{
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT && objp->control_type == CT_AI)
{
@ -1501,7 +1500,7 @@ static void test_create_all_paths(void)
Point_segs_free_ptr = Point_segs.begin();
range_for (const auto &&segp0, highest_valid(vcsegptridx))
range_for (const auto &&segp0, vcsegptridx)
{
if (segp0->segnum != segment_none)
{

View file

@ -85,7 +85,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-make_unique.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#define LEAVE_TIME 0x4000
@ -617,7 +616,7 @@ static void draw_automap(automap *am)
}
}
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
switch( objp->type ) {
case OBJ_HOSTAGE:
@ -1400,7 +1399,7 @@ void automap_build_edge_list(automap *am, int add_all_edges)
if (add_all_edges) {
// Cheating, add all edges as visited
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
#ifdef EDITOR
if (segp->segnum != segment_none)
@ -1411,7 +1410,7 @@ void automap_build_edge_list(automap *am, int add_all_edges)
}
} else {
// Not cheating, add visited edges, and then unvisited edges
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
#ifdef EDITOR
if (segp->segnum != segment_none)
@ -1420,7 +1419,7 @@ void automap_build_edge_list(automap *am, int add_all_edges)
add_segment_edges(am, segp);
}
}
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
#ifdef EDITOR
if (segp->segnum != segment_none)

View file

@ -51,7 +51,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "args.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
namespace dsx {
@ -454,7 +453,7 @@ void init_controlcen_for_level(void)
{
objptr_t cntrlcen_objnum = nullptr, boss_objnum = nullptr;
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if (objp->type == OBJ_CNTRLCEN)
{

View file

@ -64,7 +64,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "piggy.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
@ -229,7 +228,7 @@ static void write_exit_text(PHYSFS_File *my_file)
// ---------- Find exit doors ----------
count = 0;
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
for (j=0; j<MAX_SIDES_PER_SEGMENT; j++)
if (segp->children[j] == segment_exit)
@ -324,7 +323,7 @@ static void write_key_text(PHYSFS_File *my_file)
blue_count2 = 0;
gold_count2 = 0;
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
if (objp->type == OBJ_POWERUP)
if (get_powerup_id(objp) == POW_KEY_BLUE) {
@ -398,7 +397,7 @@ static void write_control_center_text(PHYSFS_File *my_file)
PHYSFSX_printf(my_file, "Control Center stuff:\n");
count = 0;
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
if (segp->special == SEGMENT_IS_CONTROLCEN)
{
@ -444,7 +443,7 @@ static void write_segment_text(PHYSFS_File *my_file)
PHYSFSX_printf(my_file, "-----------------------------------------------------------------------------\n");
PHYSFSX_printf(my_file, "Segment stuff:\n");
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
PHYSFSX_printf(my_file, "Segment %4hu: ", static_cast<uint16_t>(segp));
if (segp->special != 0)
@ -454,7 +453,7 @@ static void write_segment_text(PHYSFS_File *my_file)
PHYSFSX_printf(my_file, "\n");
}
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
int depth;
@ -546,7 +545,7 @@ static void write_wall_text(PHYSFS_File *my_file)
for (unsigned i=0; i<sizeof(wall_flags)/sizeof(wall_flags[0]); i++)
wall_flags[i] = 0;
range_for (const auto &&segp, highest_valid(vcsegptr))
range_for (const auto &&segp, vcsegptr)
{
for (j=0; j<MAX_SIDES_PER_SEGMENT; j++) {
const auto sidep = &segp->sides[j];
@ -569,7 +568,7 @@ static void write_player_text(PHYSFS_File *my_file)
PHYSFSX_printf(my_file, "-----------------------------------------------------------------------------\n");
PHYSFSX_printf(my_file, "Players:\n");
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
if (objp->type == OBJ_PLAYER)
{
@ -740,7 +739,7 @@ static void determine_used_textures_level(int load_level_flag, int shareware_fla
load_level(Registered_level_names[level_num]);
}
range_for (const auto &&segp, highest_valid(vcsegptr))
range_for (const auto &&segp, vcsegptr)
{
for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++)
{
@ -802,7 +801,7 @@ static void determine_used_textures_level(int load_level_flag, int shareware_fla
// Process robots.
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->render_type == RT_POLYOBJ) {
polymodel *po = &Polygon_models[objp->rtype.pobj_info.model_num];
@ -826,7 +825,7 @@ static void determine_used_textures_level(int load_level_flag, int shareware_fla
Ignore_tmap_num2_error = 0;
// Process walls and segment sides.
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++) {
const auto sidep = &segp->sides[sidenum];
@ -992,7 +991,7 @@ static void say_totals(PHYSFS_File *my_file, const char *level_name)
min_obj_val = 0x7fff0000;
objnum_t min_objnum = object_none;
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
if (!used_objects[objp] && objp->type != OBJ_NONE)
{
@ -1011,7 +1010,7 @@ static void say_totals(PHYSFS_File *my_file, const char *level_name)
objtype = Objects[min_objnum].type;
objid = Objects[min_objnum].id;
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
if (!used_objects[objp]) {
if ((objp->type == objtype && objp->id == objid) ||

View file

@ -86,7 +86,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-begin.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
using std::min;
using std::max;
@ -311,7 +310,7 @@ void start_endlevel_sequence()
#if defined(DXX_BUILD_DESCENT_II)
// Dematerialize Buddy!
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
if (Robot_info[get_robot_id(objp)].companion) {
@ -1533,7 +1532,7 @@ try_again:
//children == -2
exit_segnum = segment_none;
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
for (int sidenum=0;sidenum<6;sidenum++)
if (segp->children[sidenum] == segment_exit)

View file

@ -65,7 +65,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "byteutil.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
@ -104,7 +103,7 @@ static objptridx_t object_create_explosion_sub(const objptridx_t objp, const vse
fix damage;
// -- now legal for badass explosions on a wall. Assert(objp != NULL);
range_for (const auto &&obj0p, highest_valid(vobjptridx))
range_for (const auto &&obj0p, vobjptridx)
{
// Weapons used to be affected by badass explosions, but this introduces serious problems.
// When a smart bomb blows up, if one of its children goes right towards a nearby wall, it will

View file

@ -56,7 +56,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "poison.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
@ -422,7 +421,7 @@ static void robotmaker_proc( FuelCenter * robotcen )
int my_station_num = robotcen-Station;
// Make sure this robotmaker hasn't put out its max without having any of them killed.
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_ROBOT)
if ((objp->matcen_creator ^ 0x80) == my_station_num)

View file

@ -112,7 +112,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#endif
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
@ -1329,7 +1328,7 @@ array<int, 2> Coop_view_player{{-1,-1}};
//returns ptr to escort robot, or NULL
objptridx_t find_escort()
{
range_for (const auto &&o, highest_valid(vobjptridx))
range_for (const auto &&o, vobjptridx)
{
if (o->type == OBJ_ROBOT && Robot_info[get_robot_id(o)].companion)
return objptridx_t(o);
@ -1564,7 +1563,7 @@ void GameProcessFrame(void)
#if defined(DXX_BUILD_DESCENT_II)
void compute_slide_segs()
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
uint8_t slide_textures = 0;
for (int sidenum=0;sidenum<6;sidenum++) {
@ -1601,7 +1600,7 @@ static void update_uv(array<uvl, 4> &uvls, uvl &i, fix a)
// -----------------------------------------------------------------------------
static void slide_textures(void)
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
if (const auto slide_seg = segp->slide_textures)
{
@ -1844,7 +1843,7 @@ static int mark_player_path_to_segment(segnum_t segnum)
int create_special_path(void)
{
// ---------- Find exit doors ----------
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
for (int j=0; j<MAX_SIDES_PER_SEGMENT; j++)
if (segp->children[j] == segment_exit)

View file

@ -110,7 +110,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-array.h"
#include "compiler-exchange.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include <SDL.h>
@ -1073,7 +1072,7 @@ static void kill_all_robots(void)
//int boss_index = -1;
// Kill all bots except for Buddy bot and boss. However, if only boss and buddy left, kill boss.
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
{
@ -1093,7 +1092,7 @@ static void kill_all_robots(void)
// Toast the buddy if nothing else toasted!
if (dead_count == 0)
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
if (Robot_info[get_robot_id(objp)].companion) {
@ -1117,7 +1116,7 @@ static void kill_and_so_forth(void)
{
HUD_init_message_literal(HM_DEFAULT, "Killing, awarding, etc.!");
range_for (const auto &&o, highest_valid(vobjptridx))
range_for (const auto &&o, vobjptridx)
{
switch (o->type) {
case OBJ_ROBOT:
@ -1160,7 +1159,7 @@ static void kill_all_snipers(void)
int dead_count=0;
// Kill all snipers.
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
if (objp->ctype.ai_info.behavior == ai_behavior::AIB_SNIPE)
@ -1177,7 +1176,7 @@ static void kill_thief(void) __attribute_used;
static void kill_thief(void)
{
// Kill thief.
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
if (Robot_info[get_robot_id(objp)].thief)
@ -1192,7 +1191,7 @@ static void kill_buddy(void) __attribute_used;
static void kill_buddy(void)
{
// Kill buddy.
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
if (Robot_info[get_robot_id(objp)].companion)

View file

@ -53,7 +53,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gamesave.h"
#include "poison.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#define REMOVE_EXT(s) (*(strchr( (s), '.' ))='\0')
@ -704,7 +703,7 @@ int load_mine_data(PHYSFS_File *LoadFile)
#if defined(DXX_BUILD_DESCENT_II)
if (mine_top_fileinfo.fileinfo_version >= 20)
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
segment2_read(segp, LoadFile);
fuelcen_activate(segp, segp->special);

View file

@ -61,7 +61,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "object.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#ifdef OGL
#include "ogl_init.h"
@ -481,7 +480,7 @@ static bool choose_missile_viewer()
/* Find new missile */
objptridx_t local_player_missile = object_none, other_player_missile = object_none;
const auto game_mode = Game_mode;
range_for (const auto &&o, highest_valid(vobjptridx))
range_for (const auto &&o, vobjptridx)
{
if (o->type != OBJ_WEAPON)
continue;

View file

@ -73,7 +73,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "dxxsconf.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#if defined(DXX_BUILD_DESCENT_I)
@ -1118,7 +1117,7 @@ static int load_game_data(PHYSFS_File *LoadFile)
//fix old wall structs
if (game_top_fileinfo_version < 17) {
range_for (const auto &&segp, highest_valid(vcsegptridx))
range_for (const auto &&segp, vcsegptridx)
{
for (int sidenum=0;sidenum<6;sidenum++)
{
@ -1581,7 +1580,7 @@ static int save_game_data(PHYSFS_File *SaveFile)
//==================== SAVE OBJECT INFO ===========================
object_offset = PHYSFS_tell(SaveFile);
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
write_object(objp, game_top_fileinfo_version, SaveFile);
}

View file

@ -51,7 +51,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-range_for.h"
#include "partial_range.h"
#include "highest_valid.h"
using std::min;
@ -468,7 +467,7 @@ int check_segment_connections(void)
{
int errors=0;
range_for (const auto &&seg, highest_valid(vcsegptridx))
range_for (const auto &&seg, vcsegptridx)
{
for (int sidenum=0;sidenum<6;sidenum++) {
const auto v = create_abs_vertex_lists(seg, sidenum);
@ -623,7 +622,7 @@ segptridx_t find_point_seg(const vms_vector &p,const segptridx_t segnum)
// slowing down lighting, and in about 98% of cases, it would just return -1 anyway.
// Matt: This really should be fixed, though. We're probably screwing up our lighting in a few places.
if (!Doing_lighting_hack_flag) {
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (get_seg_masks(p, segp, 0).centermask == 0)
return segp;
@ -1487,7 +1486,7 @@ void validate_segment(const vsegptridx_t sp)
// For all used segments (number <= Highest_segment_index), segnum field must be != -1.
void validate_segment_all(void)
{
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
#ifdef EDITOR
if (segp->segnum != segment_none)
@ -1698,7 +1697,7 @@ int add_light(const vsegptridx_t segnum, sidenum_fast_t sidenum)
// Parse the Light_subtracted array, turning on or off all lights.
void apply_all_changed_light(void)
{
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
for (int j=0; j<MAX_SIDES_PER_SEGMENT; j++)
if (segp->light_subtracted & (1 << j))
@ -1741,7 +1740,7 @@ void apply_all_changed_light(void)
// to change the status of static light in the mine.
void clear_light_subtracted(void)
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
segp->light_subtracted = 0;
}
@ -1793,7 +1792,7 @@ void set_ambient_sound_flags()
// Now, all segments containing ambient lava or water sound makers are flagged.
// Additionally flag all segments which are within range of them.
// Mark all segments which are sources of the sound.
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
range_for (auto &s, sound_textures)
{

View file

@ -113,7 +113,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "fmtcheck.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#if defined(DXX_BUILD_DESCENT_I)
@ -177,7 +176,7 @@ static int count_number_of_robots()
{
int robot_count;
robot_count = 0;
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_ROBOT)
robot_count++;
@ -191,7 +190,7 @@ static int count_number_of_hostages()
{
int count;
count = 0;
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_HOSTAGE)
count++;
@ -210,7 +209,7 @@ static void gameseq_init_network_players()
ConsoleObject = &Objects[0];
k = 0;
j = 0;
range_for (const auto &&o, highest_valid(vobjptridx))
range_for (const auto &&o, vobjptridx)
{
if (( o->type==OBJ_PLAYER ) || (o->type == OBJ_GHOST) || (o->type == OBJ_COOP))
{
@ -542,7 +541,7 @@ static void set_sound_sources()
Dont_start_sound_objects = 1;
#endif
range_for (const auto &&seg, highest_valid(vcsegptridx))
range_for (const auto &&seg, vcsegptridx)
{
for (sidenum=0;sidenum<MAX_SIDES_PER_SEGMENT;sidenum++) {
int tm,ec,sn;
@ -1670,7 +1669,7 @@ namespace dsx {
static void filter_objects_from_level()
{
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if (objp->type==OBJ_POWERUP)
{
@ -1934,7 +1933,7 @@ void copy_defaults_to_robot(const vobjptr_t objp)
// This function should be called at level load time.
static void copy_defaults_to_robot_all(void)
{
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type == OBJ_ROBOT)
copy_defaults_to_robot(objp);

View file

@ -61,7 +61,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "playsave.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#define NEWHOMER
@ -1145,7 +1144,7 @@ objptridx_t find_homing_object_complete(const vms_vector &curpos, const vobjptri
#endif
objptridx_t best_objnum = object_none;
range_for (const auto &&curobjp, highest_valid(vobjptridx))
range_for (const auto &&curobjp, vobjptridx)
{
int is_proximity = 0;
fix dot;
@ -2113,7 +2112,7 @@ static void create_smart_children(const vobjptridx_t objp, const uint_fast32_t n
if (Game_mode & GM_MULTI)
d_srand(8321L);
range_for (const auto &&curobjp, highest_valid(vcobjptridx))
range_for (const auto &&curobjp, vcobjptridx)
{
if (((curobjp->type == OBJ_ROBOT && !curobjp->ctype.ai_info.CLOAKED) || curobjp->type == OBJ_PLAYER) && curobjp != parent.num)
{

View file

@ -59,7 +59,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "wall.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
using std::min;
@ -523,7 +522,7 @@ void set_dynamic_light(render_state_t &rstate)
cast_muzzle_flash_light(n_render_vertices, render_vertices, vert_segnum_list);
range_for (const auto &&obj, highest_valid(vobjptridx))
range_for (const auto &&obj, vobjptridx)
{
const auto &&obj_light_emission = compute_light_emission(obj);

View file

@ -85,7 +85,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-begin.h"
#include "compiler-exchange.h"
#include "partial_range.h"
#include "highest_valid.h"
constexpr tt::integral_constant<int8_t, -1> owner_none{};
@ -2711,7 +2710,7 @@ void multi_powcap_count_powerups_in_mine(void)
void powerup_cap_state::recount()
{
m_powerups = {};
range_for (const auto &&obj, highest_valid(vcobjptr))
range_for (const auto &&obj, vcobjptr)
{
if (obj->type == OBJ_POWERUP)
{
@ -3528,7 +3527,7 @@ void multi_prep_level(void)
unsigned inv_remaining = (AllowedItems & NETFLAG_DOINVUL) ? MAX_ALLOWED_INVULNERABILITY : 0;
unsigned cloak_remaining = (AllowedItems & NETFLAG_DOCLOAK) ? MAX_ALLOWED_CLOAK : 0;
update_item_state duplicates;
range_for (const auto &&o, highest_valid(vobjptridx))
range_for (const auto &&o, vobjptridx)
{
if ((o->type == OBJ_HOSTAGE) && !(Game_mode & GM_MULTI_COOP))
{
@ -3629,7 +3628,7 @@ static void apply_segment_goal_texture(const vsegptr_t seg, ubyte team_mask)
void multi_apply_goal_textures()
{
range_for (const auto &&seg, highest_valid(vsegptr))
range_for (const auto &&seg, vsegptr)
{
uint8_t team_mask;
if (seg->special==SEGMENT_IS_GOAL_BLUE)
@ -3690,7 +3689,7 @@ int multi_delete_extra_objects()
// This function also prints the total number of available multiplayer
// positions in this level, even though this should always be 8 or more!
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if ((objp->type==OBJ_PLAYER) || (objp->type==OBJ_GHOST))
nnp++;

View file

@ -57,7 +57,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-range_for.h"
#include "compiler-type_traits.h"
#include "highest_valid.h"
#include "partial_range.h"
static int multi_add_controlled_robot(const vobjptridx_t objnum, int agitation);
@ -403,7 +402,7 @@ void multi_send_thief_frame()
if (!(Game_mode & GM_MULTI_ROBOTS))
return;
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if (objp->type == OBJ_ROBOT)
{

View file

@ -65,7 +65,6 @@
#include "compiler-range_for.h"
#include "compiler-lengthof.h"
#include "compiler-static_assert.h"
#include "highest_valid.h"
#include "partial_range.h"
#if defined(DXX_BUILD_DESCENT_I)
@ -1792,7 +1791,7 @@ static void net_udp_process_monitor_vector(uint32_t vector)
{
if (!vector)
return;
range_for (const auto &&seg, highest_valid(vsegptr))
range_for (const auto &&seg, vsegptr)
{
int tm, ec, bm;
range_for (auto &j, seg->sides)
@ -1861,7 +1860,7 @@ static int net_udp_create_monitor_vector(void)
}
}
range_for (const auto &&seg, highest_valid(vcsegptr))
range_for (const auto &&seg, vcsegptr)
{
int tm, ec;
range_for (auto &j, seg->sides)
@ -2036,7 +2035,7 @@ static int net_udp_verify_objects(int remote, int local)
if ((remote-local) > 10)
return(2);
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
if (objp->type == OBJ_PLAYER || objp->type == OBJ_GHOST)
nplayers++;
@ -5407,7 +5406,7 @@ void net_udp_read_pdata_packet(UDP_frame_info *pd)
static void net_udp_send_smash_lights (const playernum_t pnum)
{
// send the lights that have been blown out
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
if (segp->light_subtracted)
multi_send_light_specific(pnum, segp, segp->light_subtracted);

View file

@ -96,7 +96,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-exchange.h"
#include "compiler-type_traits.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#define ND_EVENT_EOF 0 // EOF
@ -305,7 +304,7 @@ static typename tt::enable_if<tt::is_integral<T>::value, int>::type newdemo_read
cobjptridx_t newdemo_find_object(object_signature_t signature)
{
range_for (const auto &&objp, highest_valid(vcobjptridx))
range_for (const auto &&objp, vcobjptridx)
{
if ( (objp->type != OBJ_NONE) && (objp->signature == signature))
return objp;
@ -1890,7 +1889,7 @@ static int newdemo_read_frame_information(int rewrite)
done = 0;
if (Newdemo_vcr_state != ND_STATE_PAUSED)
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
segp->objects = object_none;
}
@ -3392,7 +3391,7 @@ static void interpolate_frame(fix d_play, fix d_recorded)
if (InterpolStep <= 0)
{
range_for (auto &i, partial_range(cur_objs, num_cur_objs)) {
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (i.signature == objp->signature) {
sbyte render_type = i.render_type;
@ -3601,7 +3600,7 @@ void newdemo_playback_one_frame()
// interpolated position and orientation can be preserved.
range_for (auto &i, partial_const_range(cur_objs, 1 + num_objs)) {
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (i.signature == objp->signature) {
objp->orient = i.orient;

View file

@ -81,7 +81,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-exchange.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
using std::min;
@ -118,7 +117,7 @@ void object_goto_next_viewer()
objnum_t start_obj;
start_obj = Viewer - Objects; //get viewer object number
range_for (const auto &&i, highest_valid(vcobjptr))
range_for (const auto &&i, vcobjptr)
{
(void)i;
start_obj++;
@ -139,7 +138,7 @@ void object_goto_next_viewer()
objptridx_t obj_find_first_of_type(int type)
{
range_for (const auto &&i, highest_valid(vobjptridx))
range_for (const auto &&i, vobjptridx)
{
if (i->type==type)
return i;
@ -902,7 +901,7 @@ object_signature_t obj_get_signature()
{
static short sig = 0; // Yes! Short! a) We do not need higher values b) the demo system only stores shorts
uint_fast32_t lsig = sig;
for (const auto &range = highest_valid(vcobjptridx);;)
for (const auto &&range = make_range(vcobjptridx);;)
{
if (unlikely(lsig == std::numeric_limits<decltype(sig)>::max()))
lsig = 0;
@ -980,7 +979,7 @@ static void free_object_slots(uint_fast32_t num_used)
if (MAX_OBJECTS - num_already_free < num_used)
return;
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->flags & OF_SHOULD_BE_DEAD)
{
@ -1528,7 +1527,7 @@ static void obj_delete_all_that_should_be_dead()
objnum_t local_dead_player_object=object_none;
// Move all objects
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if ((objp->type!=OBJ_NONE) && (objp->flags&OF_SHOULD_BE_DEAD) ) {
Assert(!(objp->type==OBJ_FIREBALL && objp->ctype.expl_info.delete_time!=-1));
@ -1560,12 +1559,12 @@ void obj_relink(const vobjptridx_t objnum,const vsegptridx_t newsegnum)
// for getting out of messed up linking situations (i.e. caused by demo playback)
void obj_relink_all(void)
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
segp->objects = object_none;
}
range_for (const auto &&obj, highest_valid(vobjptridx))
range_for (const auto &&obj, vobjptridx)
{
if (obj->type != OBJ_NONE)
{
@ -1855,7 +1854,7 @@ void object_move_all()
ConsoleObject->mtype.phys_info.flags &= ~PF_LEVELLING;
// Move all objects
range_for (const auto &&objp, highest_valid(vobjptridx))
range_for (const auto &&objp, vobjptridx)
{
if ( (objp->type != OBJ_NONE) && (!(objp->flags&OF_SHOULD_BE_DEAD)) ) {
object_move_one( objp );
@ -1978,7 +1977,7 @@ void set_powerup_id(object &o, powerup_type_t id)
//go through all objects and make sure they have the correct segment numbers
void fix_object_segs()
{
range_for (const auto &&o, highest_valid(vobjptridx))
range_for (const auto &&o, vobjptridx)
{
if (o->type != OBJ_NONE)
if (update_object_seg(o) == 0) {
@ -2039,7 +2038,7 @@ static int object_is_clearable_weapon(const vcobjptr_t obj, int clear_all)
//if clear_all is set, clear even proximity bombs
void clear_transient_objects(int clear_all)
{
range_for (const auto &&obj, highest_valid(vobjptridx))
range_for (const auto &&obj, vobjptridx)
{
if (object_is_clearable_weapon(obj, clear_all) ||
obj->type == OBJ_FIREBALL ||

View file

@ -58,7 +58,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "ai.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#include "segiter.h"
@ -322,7 +321,7 @@ void paging_touch_all()
#if defined(DXX_BUILD_DESCENT_I)
show_boxed_message(TXT_LOADING, 0);
#endif
range_for (const auto &&segp, highest_valid(vcsegptr))
range_for (const auto &&segp, vcsegptr)
{
paging_touch_segment(segp);
}

View file

@ -79,7 +79,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-exchange.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
#include "partial_range.h"
#if defined(DXX_BUILD_DESCENT_I)
@ -997,7 +996,7 @@ int state_save_all_sub(const char *filename, const char *desc)
#endif
//Finish all morph objects
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
if (objp->type != OBJ_NONE && objp->render_type == RT_MORPH)
{
@ -1022,7 +1021,7 @@ int state_save_all_sub(const char *filename, const char *desc)
i = Highest_object_index+1;
PHYSFS_write(fp, &i, sizeof(int), 1);
//PHYSFS_write(fp, Objects, sizeof(object), i);
range_for (const auto &&objp, highest_valid(vcobjptr))
range_for (const auto &&objp, vcobjptr)
{
object_rw obj_rw;
state_object_to_object_rw(objp, &obj_rw);
@ -1072,7 +1071,7 @@ int state_save_all_sub(const char *filename, const char *desc)
trigger_write(fp, t);
//Save tmap info
range_for (const auto &&segp, highest_valid(vcsegptr))
range_for (const auto &&segp, vcsegptr)
{
range_for (const auto &j, segp->sides)
segment_side_wall_tmap_write(fp, j);
@ -1161,7 +1160,7 @@ int state_save_all_sub(const char *filename, const char *desc)
PHYSFS_write(fp, &PaletteBlueAdd, sizeof(int), 1);
if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL )
{
range_for (const auto &&segp, highest_valid(vcsegptr))
range_for (const auto &&segp, vcsegptr)
{
PHYSFSX_writeU8(fp, segp->light_subtracted);
}
@ -1477,7 +1476,7 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
Do_appearance_effect = 0; // Don't do this for middle o' game stuff.
//Clear out all the objects from the lvl file
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
segp->objects = object_none;
}
@ -1486,7 +1485,7 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
//Read objects, and pop 'em into their respective segments.
i = PHYSFSX_readSXE32(fp, swap);
Objects.set_count(i);
range_for (const auto &&objp, highest_valid(vobjptr))
range_for (const auto &&objp, vobjptr)
{
object_rw obj_rw;
PHYSFS_read(fp, &obj_rw, sizeof(obj_rw), 1);
@ -1494,7 +1493,7 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
state_object_rw_to_object(&obj_rw, objp);
}
range_for (const auto &&obj, highest_valid(vobjptridx))
range_for (const auto &&obj, vobjptridx)
{
obj->rtype.pobj_info.alt_textures = -1;
auto segnum = exchange(obj->segnum, segment_none);
@ -1571,7 +1570,7 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
trigger_read(fp, t);
//Restore tmap info (to temp values so we can use compiled-in tmap info to compute static_light
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
for (j=0; j<6; j++ ) {
segp->sides[j].wall_num = PHYSFSX_readSXE16(fp, swap);
@ -1706,7 +1705,7 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
if (version >= 16) {
if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL )
{
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
PHYSFS_read(fp, &segp->light_subtracted, sizeof(segp->light_subtracted), 1);
}
@ -1721,7 +1720,7 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
}
apply_all_changed_light();
} else {
range_for (const auto &&segp, highest_valid(vsegptr))
range_for (const auto &&segp, vsegptr)
{
segp->light_subtracted = 0;
}
@ -1746,7 +1745,7 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
#endif
// static_light should now be computed - now actually set tmap info
range_for (const auto &&segp, highest_valid(vsegptridx))
range_for (const auto &&segp, vsegptridx)
{
for (j=0; j<6; j++ ) {
segp->sides[j].tmap_num = TempTmapNum[segp][j];

View file

@ -52,7 +52,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "compiler-range_for.h"
#include "compiler-type_traits.h"
#include "highest_valid.h"
#include "partial_range.h"
static uint_fast32_t POrderList (uint_fast32_t num);
@ -1160,7 +1159,7 @@ void process_super_mines_frame(void)
continue;
const auto parent_num = io->ctype.laser_info.parent_num;
const auto &bombpos = io->pos;
range_for (const auto &&jo, highest_valid(vobjptridx))
range_for (const auto &&jo, vobjptridx)
{
if (unlikely(jo == parent_num))
continue;