diff --git a/common/main/multibot.h b/common/main/multibot.h index d13100581..f869175ca 100644 --- a/common/main/multibot.h +++ b/common/main/multibot.h @@ -34,16 +34,11 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. struct vms_vector; -#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) -#if defined(DXX_BUILD_DESCENT_I) -static const std::size_t MAX_ROBOTS_CONTROLLED = 3; -#elif defined(DXX_BUILD_DESCENT_II) static const std::size_t MAX_ROBOTS_CONTROLLED = 5; -#endif +static const std::size_t HANDS_OFF_PERIOD = MAX_ROBOTS_CONTROLLED; // i.e. one slow above max extern array robot_controlled; extern array robot_agitation, robot_fired; -#endif int multi_can_move_robot(vobjptridx_t objnum, int agitation); void multi_send_robot_position(vobjptridx_t objnum, int fired); diff --git a/similar/main/multibot.cpp b/similar/main/multibot.cpp index e1d695699..8673a93de 100644 --- a/similar/main/multibot.cpp +++ b/similar/main/multibot.cpp @@ -201,7 +201,7 @@ multi_strip_robots(int playernum) Assert((Objects[i].control_type == CT_AI) || (Objects[i].control_type == CT_NONE) || (Objects[i].control_type == CT_MORPH)); Objects[i].ctype.ai_info.REMOTE_OWNER = -1; if (playernum == Player_num) - Objects[i].ctype.ai_info.REMOTE_SLOT_NUM = 4; + Objects[i].ctype.ai_info.REMOTE_SLOT_NUM = HANDS_OFF_PERIOD; else Objects[i].ctype.ai_info.REMOTE_SLOT_NUM = 0; } @@ -561,7 +561,7 @@ void multi_send_boss_teleport(const vobjptridx_t bossobj, segnum_t where) Assert((bossobj->ctype.ai_info.REMOTE_SLOT_NUM >= 0) && (bossobj->ctype.ai_info.REMOTE_SLOT_NUM < MAX_ROBOTS_CONTROLLED)); multi_delete_controlled_robot(bossobj); #if defined(DXX_BUILD_DESCENT_I) - bossobj->ctype.ai_info.REMOTE_SLOT_NUM = 5; // Hands-off period! + bossobj->ctype.ai_info.REMOTE_SLOT_NUM = HANDS_OFF_PERIOD; // Hands-off period! #endif multi_send_boss_action(bossobj, where); } @@ -720,7 +720,7 @@ void multi_do_robot_position(const playernum_t pnum, const ubyte *buf) if (robot->ctype.ai_info.REMOTE_OWNER == -1) { // Robot claim packet must have gotten lost, let this player claim it. - if (robot->ctype.ai_info.REMOTE_SLOT_NUM > 3) { + if (robot->ctype.ai_info.REMOTE_SLOT_NUM >= MAX_ROBOTS_CONTROLLED) { // == HANDS_OFF_PERIOD should do the same trick robot->ctype.ai_info.REMOTE_OWNER = pnum; robot->ctype.ai_info.REMOTE_SLOT_NUM = 0; } @@ -1185,9 +1185,7 @@ void multi_robot_request_change(const vobjptridx_t robot, int player_num) const auto slot = robot->ctype.ai_info.REMOTE_SLOT_NUM; - /* Why 5? Ask Parallax. */ - static constexpr tt::integral_constant hands_off_period{}; - if (slot == hands_off_period) + if (slot == HANDS_OFF_PERIOD) { con_printf(CON_DEBUG, "Suppressing debugger trap for hands off robot %hu with player %i", static_cast(robot), player_num); return; @@ -1208,6 +1206,6 @@ void multi_robot_request_change(const vobjptridx_t robot, int player_num) if (robot_send_pending[slot]) multi_send_robot_position(rcrobot, -1); multi_send_release_robot(rcrobot); - robot->ctype.ai_info.REMOTE_SLOT_NUM = hands_off_period; // Hands-off period + robot->ctype.ai_info.REMOTE_SLOT_NUM = HANDS_OFF_PERIOD; // Hands-off period } }