Pass object & to [gs]et_*_id
This commit is contained in:
parent
be62f446f1
commit
1cdd4ac2ce
|
@ -398,14 +398,14 @@ struct obj_position
|
|||
|
||||
DEFINE_VALPTRIDX_SUBTYPE(obj, object, objnum_t, Objects);
|
||||
|
||||
static inline ubyte get_hostage_id(const vcobjptr_t o)
|
||||
static inline uint8_t get_hostage_id(const object &o)
|
||||
{
|
||||
return o->id;
|
||||
return o.id;
|
||||
}
|
||||
|
||||
static inline ubyte get_player_id(const vcobjptr_t o)
|
||||
static inline uint8_t get_player_id(const object &o)
|
||||
{
|
||||
return o->id;
|
||||
return o.id;
|
||||
}
|
||||
|
||||
static inline powerup_type_t get_powerup_id(const vcobjptr_t o)
|
||||
|
@ -413,41 +413,41 @@ static inline powerup_type_t get_powerup_id(const vcobjptr_t o)
|
|||
return static_cast<powerup_type_t>(o->id);
|
||||
}
|
||||
|
||||
static inline ubyte get_reactor_id(const vcobjptr_t o)
|
||||
static inline uint8_t get_reactor_id(const object &o)
|
||||
{
|
||||
return o->id;
|
||||
return o.id;
|
||||
}
|
||||
|
||||
static inline ubyte get_robot_id(const vcobjptr_t o)
|
||||
static inline uint8_t get_robot_id(const object &o)
|
||||
{
|
||||
return o->id;
|
||||
return o.id;
|
||||
}
|
||||
|
||||
static inline weapon_type_t get_weapon_id(const vcobjptr_t o)
|
||||
static inline weapon_type_t get_weapon_id(const object &o)
|
||||
{
|
||||
return static_cast<weapon_type_t>(o->id);
|
||||
return static_cast<weapon_type_t>(o.id);
|
||||
}
|
||||
|
||||
static inline void set_hostage_id(const vobjptr_t o, ubyte id)
|
||||
static inline void set_hostage_id(object &o, ubyte id)
|
||||
{
|
||||
o->id = id;
|
||||
o.id = id;
|
||||
}
|
||||
|
||||
static inline void set_player_id(const vobjptr_t o, ubyte id)
|
||||
static inline void set_player_id(object &o, ubyte id)
|
||||
{
|
||||
o->id = id;
|
||||
o.id = id;
|
||||
}
|
||||
|
||||
void set_powerup_id(vobjptr_t o, powerup_type_t id);
|
||||
void set_powerup_id(object &o, powerup_type_t id);
|
||||
|
||||
static inline void set_robot_id(const vobjptr_t o, ubyte id)
|
||||
static inline void set_robot_id(object &o, ubyte id)
|
||||
{
|
||||
o->id = id;
|
||||
o.id = id;
|
||||
}
|
||||
|
||||
static inline void set_weapon_id(const vobjptr_t o, weapon_type_t id)
|
||||
static inline void set_weapon_id(object &o, weapon_type_t id)
|
||||
{
|
||||
o->id = id;
|
||||
o.id = id;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -107,8 +107,8 @@ static void call_init_ai_object(const vobjptr_t objp, ai_behavior behavior)
|
|||
static int RobotNextType()
|
||||
{
|
||||
if (Cur_object_index != object_none ) {
|
||||
const auto &&obj = vobjptr(Cur_object_index);
|
||||
if ( Objects[Cur_object_index].type == OBJ_ROBOT ) {
|
||||
object * obj = &Objects[Cur_object_index];
|
||||
obj->id++;
|
||||
if (obj->id >= N_robot_types )
|
||||
obj->id = 0;
|
||||
|
@ -135,8 +135,8 @@ static int RobotNextType()
|
|||
static int RobotPrevType()
|
||||
{
|
||||
if (Cur_object_index != object_none ) {
|
||||
const auto &&obj = vobjptr(Cur_object_index);
|
||||
if ( Objects[Cur_object_index].type == OBJ_ROBOT ) {
|
||||
object * obj = &Objects[Cur_object_index];
|
||||
if (obj->id == 0 )
|
||||
obj->id = N_robot_types-1;
|
||||
else
|
||||
|
@ -686,7 +686,7 @@ int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r)
|
|||
ui_dprintf_at( MainWindow, GOODY_X+108, GOODY_Y+48, "%i", Cur_goody_count);
|
||||
|
||||
if ( Cur_object_index != object_none ) {
|
||||
int id = get_robot_id(&Objects[Cur_object_index]);
|
||||
const auto id = get_robot_id(Objects[Cur_object_index]);
|
||||
|
||||
ui_dprintf_at( MainWindow, 12, 6, "Robot: %3d ", Cur_object_index );
|
||||
ui_dprintf_at( MainWindow, 12, 22, " Id: %3d", id);
|
||||
|
|
|
@ -519,11 +519,11 @@ static int effect_parent_is_guidebot(const laser_parent &laser)
|
|||
{
|
||||
if (laser.parent_type != OBJ_ROBOT)
|
||||
return 0;
|
||||
const object *robot = &Objects[laser.parent_num];
|
||||
const auto &&robot = vcobjptr(laser.parent_num);
|
||||
if (robot->signature != laser.parent_signature)
|
||||
/* parent replaced, no idea what it once was */
|
||||
return 0;
|
||||
const ubyte robot_id = get_robot_id(robot);
|
||||
const auto robot_id = get_robot_id(robot);
|
||||
const robot_info *robptr = &Robot_info[robot_id];
|
||||
return robot_is_companion(robptr);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ void read_flying_controls(const vobjptr_t obj)
|
|||
const auto &&rotmat = vm_angles_2_matrix(rotangs);
|
||||
m->orient = vm_matrix_x_matrix(m->orient, rotmat);
|
||||
|
||||
const auto speed = Weapon_info[get_weapon_id(m)].speed[Difficulty_level];
|
||||
const auto speed = Weapon_info[get_weapon_id(*m)].speed[Difficulty_level];
|
||||
|
||||
vm_vec_copy_scale(m->mtype.phys_info.velocity, m->orient.fvec, speed);
|
||||
if (Game_mode & GM_MULTI)
|
||||
|
|
|
@ -406,7 +406,7 @@ void multi_send_thief_frame()
|
|||
{
|
||||
if (Objects[i].type == OBJ_ROBOT)
|
||||
{
|
||||
if (robot_is_thief(&Robot_info[get_robot_id(&Objects[i])]))
|
||||
if (robot_is_thief(&Robot_info[get_robot_id(Objects[i])]))
|
||||
{
|
||||
if ((multi_i_am_master() && (Objects[i].ctype.ai_info.REMOTE_OWNER == -1)) || (Objects[i].ctype.ai_info.REMOTE_OWNER == Player_num))
|
||||
{
|
||||
|
|
|
@ -1928,7 +1928,7 @@ void net_udp_send_objects(void)
|
|||
(Objects[i].type != OBJ_CNTRLCEN) && (Objects[i].type != OBJ_GHOST) &&
|
||||
(Objects[i].type != OBJ_ROBOT) && (Objects[i].type != OBJ_HOSTAGE)
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
&& !(Objects[i].type==OBJ_WEAPON && get_weapon_id(&Objects[i])==PMINE_ID)
|
||||
&& !(Objects[i].type == OBJ_WEAPON && get_weapon_id(Objects[i]) == PMINE_ID)
|
||||
#endif
|
||||
)
|
||||
continue;
|
||||
|
|
|
@ -1247,7 +1247,7 @@ void obj_delete(const vobjptridx_t obj)
|
|||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if (obj->type==OBJ_WEAPON && get_weapon_id(obj)==GUIDEDMISS_ID && obj->ctype.laser_info.parent_type==OBJ_PLAYER)
|
||||
{
|
||||
int pnum=get_player_id(&Objects[obj->ctype.laser_info.parent_num]);
|
||||
const auto pnum = get_player_id(vcobjptr(obj->ctype.laser_info.parent_num));
|
||||
|
||||
if (pnum!=Player_num) {
|
||||
Guided_missile[pnum]=NULL;
|
||||
|
@ -1986,13 +1986,13 @@ int update_object_seg(const vobjptridx_t obj)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void set_powerup_id(const vobjptr_t o, powerup_type_t id)
|
||||
void set_powerup_id(object &o, powerup_type_t id)
|
||||
{
|
||||
o->id = id;
|
||||
o->size = Powerup_info[id].size;
|
||||
o.id = id;
|
||||
o.size = Powerup_info[id].size;
|
||||
const auto vclip_num = Powerup_info[id].vclip_num;
|
||||
o->rtype.vclip_info.vclip_num = vclip_num;
|
||||
o->rtype.vclip_info.frametime = Vclip[vclip_num].frame_time;
|
||||
o.rtype.vclip_info.vclip_num = vclip_num;
|
||||
o.rtype.vclip_info.frametime = Vclip[vclip_num].frame_time;
|
||||
}
|
||||
|
||||
//go through all objects and make sure they have the correct segment numbers
|
||||
|
|
Loading…
Reference in a new issue