Skip to content

Commit 5238f65

Browse files
Goober5000JohnAFernandez
authored andcommitted
fix incorrect setting of disabled/disarmed flags when cheating
Normally the disabled/disarmed flags are only set if the destroyed subsystem is actually an engine or turret. This should be done for cheats as well, otherwise, for example, destroying any subsystem on a non-engined ship will cause it to become disabled.
1 parent 47cd2a0 commit 5238f65

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

code/io/keycontrol.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -873,13 +873,17 @@ void process_debug_keys(int k)
873873

874874
do_subobj_hit_stuff(objp, Player_obj, &g_subobj_pos, Player_ai->targeted_subsys->system_info->subobj_num, (float) -Player_ai->targeted_subsys->system_info->type, NULL); //100.0f);
875875

876-
if ( sp->subsys_info[SUBSYSTEM_ENGINE].aggregate_current_hits <= 0.0f ) {
877-
mission_log_add_entry(LOG_SHIP_DISABLED, sp->ship_name, NULL );
878-
sp->flags.set(Ship::Ship_Flags::Disabled); // add the disabled flag
876+
if ( Player_ai->targeted_subsys->system_info->type == SUBSYSTEM_ENGINE ) {
877+
if ( sp->subsys_info[SUBSYSTEM_ENGINE].aggregate_current_hits <= 0.0f ) {
878+
mission_log_add_entry(LOG_SHIP_DISABLED, sp->ship_name, NULL );
879+
sp->flags.set(Ship::Ship_Flags::Disabled); // add the disabled flag
880+
}
879881
}
880882

881-
if ( sp->subsys_info[SUBSYSTEM_TURRET].aggregate_current_hits <= 0.0f ) {
882-
mission_log_add_entry(LOG_SHIP_DISARMED, sp->ship_name, NULL );
883+
if ( Player_ai->targeted_subsys->system_info->type == SUBSYSTEM_TURRET ) {
884+
if ( sp->subsys_info[SUBSYSTEM_TURRET].aggregate_current_hits <= 0.0f ) {
885+
mission_log_add_entry(LOG_SHIP_DISARMED, sp->ship_name, NULL );
886+
}
883887
}
884888
}
885889
}

0 commit comments

Comments
 (0)