Use object helper to iterate over render segments

This commit is contained in:
Kp 2014-07-30 02:52:36 +00:00
parent 4151a6989b
commit 6d3850b6c1

View file

@ -63,6 +63,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#endif #endif
#include "args.h" #include "args.h"
#include "compiler-range_for.h"
#include "segiter.h"
#define INITIAL_LOCAL_LIGHT (F1_0/4) // local light value in segment of occurence (of light emission) #define INITIAL_LOCAL_LIGHT (F1_0/4) // local light value in segment of occurence (of light emission)
#ifdef EDITOR #ifdef EDITOR
@ -1440,14 +1443,9 @@ static void build_object_lists(int n_segs)
segnum = Render_list[nn]; segnum = Render_list[nn];
if (segnum != segment_none) { if (segnum != segment_none) {
int objnum; range_for (auto obj, objects_in(Segments[segnum]))
object *obj; {
for (objnum=Segments[segnum].objects;objnum!=object_none;objnum = obj->next) {
int new_segnum,list_pos; int new_segnum,list_pos;
obj = &Objects[objnum];
if (obj->type == OBJ_NONE) if (obj->type == OBJ_NONE)
continue; continue;
@ -1503,7 +1501,7 @@ static void build_object_lists(int n_segs)
} while (did_migrate); } while (did_migrate);
add_obj_to_seglist(objnum,list_pos); add_obj_to_seglist(obj,list_pos);
} }