Update open-coded tests for segment_none

This commit is contained in:
Kp 2015-05-28 03:08:39 +00:00
parent 4007b297ec
commit ea2c2df250
6 changed files with 10 additions and 7 deletions

View file

@ -166,7 +166,8 @@ int wall_add_closed_wall()
int wall_add_external_wall()
{
if (Cursegp->children[Curside] == -2) {
if (Cursegp->children[Curside] == segment_exit)
{
editor_status( "Wall is already external!" );
return 1;
}

View file

@ -647,7 +647,8 @@ int check_effect_blowup(const vsegptridx_t seg,int side,const vms_vector &pnt, c
if ((sound_num=Effects[ec].sound_num)!=-1) //kill sound
digi_kill_sound_linked_to_segment(seg,side,sound_num);
if (Effects[ec].dest_eclip!=-1 && Effects[Effects[ec].dest_eclip].segnum==-1) {
if (Effects[ec].dest_eclip!=-1 && Effects[Effects[ec].dest_eclip].segnum == segment_none)
{
int bm_num;
eclip *new_ec;

View file

@ -227,7 +227,8 @@ static void write_exit_text(PHYSFS_file *my_file)
count = 0;
range_for (const auto i, highest_valid(Segments))
for (j=0; j<MAX_SIDES_PER_SEGMENT; j++)
if (Segments[i].children[j] == -2) {
if (Segments[i].children[j] == segment_exit)
{
PHYSFSX_printf(my_file, "Segment %3hu, side %i is an exit door.\n", static_cast<uint16_t>(i), j);
count++;
}

View file

@ -1200,7 +1200,7 @@ void do_endlevel_flythrough(flythrough_data *flydata)
exit_side = Side_opposite[entry_side];
}
if (flydata->first_time || entry_side==-1 || pseg->children[exit_side]==-1)
if (flydata->first_time || entry_side==-1 || pseg->children[exit_side] == segment_none)
exit_side = find_exit_side(obj);
{ //find closest side to align to
@ -1216,7 +1216,7 @@ void do_endlevel_flythrough(flythrough_data *flydata)
//where we are heading (center of exit_side)
auto dest_point = compute_center_point_on_side(pseg,exit_side);
if (pseg->children[exit_side] == -2)
if (pseg->children[exit_side] == segment_exit)
nextcenter = dest_point;
else
compute_segment_center(nextcenter,&Segments[pseg->children[exit_side]]);

View file

@ -478,7 +478,7 @@ int pick_connected_segment(const vobjptr_t objp, int max_depth)
auto wall_num = segp->sides[snrand].wall_num;
sidenum++;
if ((wall_num == wall_none || door_is_openable_by_player(segp, snrand)) && segp->children[snrand] > -1)
if ((wall_num == wall_none || door_is_openable_by_player(segp, snrand)) && IS_CHILD(segp->children[snrand]))
{
if (!visited[segp->children[snrand]]) {
seg_queue[head++] = segp->children[snrand];

View file

@ -920,7 +920,7 @@ static int fvi_sub(vms_vector &intp,segnum_t &ints,const vms_vector &p0,const vc
//if what we have hit is a door, check the adjoining seg
if ( (thisobjnum == Players[Player_num].objnum) && (cheats.ghostphysics) ) {
if (seg->children[side] >= 0 )
if (IS_CHILD(seg->children[side]))
wid_flag |= WID_FLY_FLAG;
}