Simplify some uses of Highest_object_index

This commit is contained in:
Kp 2022-02-06 16:12:31 +00:00
parent da49df78f7
commit fe19f78fcd
4 changed files with 3 additions and 9 deletions

View file

@ -668,7 +668,7 @@ void write_game_text_file(const char *filename)
say_totals(vcobjptridx, my_file, filename);
PHYSFSX_printf(my_file, "\nNumber of segments: %4i\n", Highest_segment_index+1);
PHYSFSX_printf(my_file, "Number of objects: %4i\n", Highest_object_index+1);
PHYSFSX_printf(my_file, "Number of objects: %4i\n", Objects.get_count());
auto &Walls = LevelUniqueWallSubsystemState.Walls;
auto &vcwallptridx = Walls.vcptridx;
PHYSFSX_printf(my_file, "Number of walls: %4i\n", Walls.get_count());

View file

@ -621,17 +621,12 @@ void explode_badass_player(const vmobjptridx_t objp)
static void object_create_debris(fvmsegptridx &vmsegptridx, const object_base &parent, int subobj_num)
{
auto &Objects = LevelUniqueObjectState.Objects;
Assert(parent.type == OBJ_ROBOT || parent.type == OBJ_PLAYER);
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
const auto &&obj = obj_create(OBJ_DEBRIS, 0, vmsegptridx(parent.segnum), parent.pos, &parent.orient, Polygon_models[parent.rtype.pobj_info.model_num].submodel_rads[subobj_num],
object::control_type::debris, object::movement_type::physics, RT_POLYOBJ);
if ((obj == object_none ) && (Highest_object_index >= MAX_OBJECTS-1)) {
// Int3(); // this happens often and is normal :-)
return;
}
if ( obj == object_none )
return; // Not enough debris slots!

View file

@ -1713,7 +1713,7 @@ static int save_game_data(
#define WRITE_HEADER_ENTRY(t, n) do { PHYSFS_writeSLE32(SaveFile, -1); PHYSFS_writeSLE32(SaveFile, n); PHYSFS_writeSLE32(SaveFile, sizeof(t)); } while(0)
WRITE_HEADER_ENTRY(object, Highest_object_index + 1);
WRITE_HEADER_ENTRY(object, Objects.get_count());
auto &Walls = LevelUniqueWallSubsystemState.Walls;
WRITE_HEADER_ENTRY(wall, Walls.get_count());
auto &ActiveDoors = LevelUniqueWallSubsystemState.ActiveDoors;

View file

@ -341,7 +341,7 @@ netplayer_info::player_rank GetMyNetRanking()
// Functions that replace what used to be macros
//
objnum_t objnum_remote_to_local(uint16_t remote_objnum, int8_t owner)
objnum_t objnum_remote_to_local(const uint16_t remote_objnum, const int8_t owner)
{
if (owner == owner_none)
return(remote_objnum);
@ -2221,7 +2221,6 @@ static void multi_do_play_sound(object_array &Objects, const playernum_t pnum, c
const uint8_t once = buf[3];
const fix volume = GET_INTEL_INT(&buf[4]);
assert(plr.objnum <= Highest_object_index);
const auto objnum = plr.objnum;
digi_link_sound_to_object(sound_num, vcobjptridx(objnum), 0, volume, static_cast<sound_stack>(once));
}