Block direct changes to Highest_segment_index

Route updates through helper functions.
This commit is contained in:
Kp 2016-01-09 16:38:12 +00:00
parent f48eddeece
commit 96898bab0a
4 changed files with 9 additions and 9 deletions

View file

@ -203,7 +203,7 @@ struct group
}
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
#define Highest_segment_index Segments.highest
#define Highest_segment_index static_cast<const unsigned &>(Segments.highest)
namespace dsx {
DEFINE_VALPTRIDX_SUBTYPE(seg, segment, segnum_t, Segments);

View file

@ -321,7 +321,7 @@ segnum_t get_free_segment_number(void)
if (Segments[segnum].segnum == segment_none) {
Num_segments++;
if (segnum > Highest_segment_index)
Highest_segment_index = segnum;
Segments.set_count(segnum + 1);
return segnum;
}
@ -689,7 +689,7 @@ static void compress_segments(void)
} // end if (seg > hole)
} // end if
Highest_segment_index = Num_segments-1;
Segments.set_count(Num_segments);
med_create_new_segment_from_cursegp();
}

View file

@ -617,7 +617,7 @@ int load_mine_data(PHYSFS_file *LoadFile)
Error( "Error seeking to segment_offset in gamemine.c" );
Highest_segment_index = mine_fileinfo.segment_howmany-1;
Segments.set_count(mine_fileinfo.segment_howmany);
for (segnum_t ii = 0; ii < mine_fileinfo.segment_howmany; ++ii)
{
@ -772,16 +772,16 @@ int load_mine_data(PHYSFS_file *LoadFile)
Num_vertices = mine_fileinfo.vertex_howmany;
Num_segments = mine_fileinfo.segment_howmany;
Highest_vertex_index = Num_vertices-1;
Highest_segment_index = Num_segments-1;
Segments.set_count(Num_segments);
reset_objects(1); //one object, the player
#ifdef EDITOR
Highest_vertex_index = MAX_SEGMENT_VERTICES-1;
Highest_segment_index = MAX_SEGMENTS-1;
Segments.set_count(MAX_SEGMENTS);
set_vertex_counts();
Highest_vertex_index = Num_vertices-1;
Highest_segment_index = Num_segments-1;
Segments.set_count(Num_segments);
warn_if_concave_segments();
#endif
@ -1012,7 +1012,7 @@ int load_mine_data_compiled(PHYSFS_file *LoadFile)
}
Highest_vertex_index = Num_vertices-1;
Highest_segment_index = Num_segments-1;
Segments.set_count(Num_segments);
validate_segment_all(); // Fill in side type and normals.

View file

@ -1464,7 +1464,7 @@ int create_new_mine(void)
Num_vertices = 0; // Number of vertices in global array.
Highest_vertex_index = 0;
Num_segments = 0; // Number of segments in global array, will get increased in med_create_segment
Highest_segment_index = 0;
Segments.set_count(1);
Cursegp = segptridx(segment_first); // Say current segment is the only segment.
Curside = WBACK; // The active side is the back side
Markedsegp = segment_none; // Say there is no marked segment.