2018-10-19 22:08 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002763FSSCPHUDpublic2013-01-19 07:31
ReporterFUBAR-BDHR 
Assigned Tom_m 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.6.15 
Target VersionFixed in Version 
Summary0002763: ETS gauge showing up for ships with no shields if default ship had shields
DescriptionIf the default player ship set in FRED has a tabled shield value > 0 and you switch to a ship that has a 0 shield value in the loadout screen you still get the ETS as if the tabled shield value was > 0.
Steps To ReproduceAttaching simple .tbm and mission. Just change from the default Uly that has shields to a Herc which has been set to 0 shields via the .tbm. Launch and you will see that the ETS guage still shows shield power.
Additional InformationWhile this is similar to 0002747 it's not the same issue (although it could be in the same area of the code). I've traced this one back to at least 3.6.10 final so it's been around for quite awhile.
TagsNo tags attached.
Attached Files
  • rar file icon 2763.rar (1,519 bytes) 2012-12-31 16:59
  • patch file icon mantis_2763.patch (2,428 bytes) 2013-01-01 07:46 -
    Index: code/ship/ship.cpp
    ===================================================================
    --- code/ship/ship.cpp	(revision 9478)
    +++ code/ship/ship.cpp	(working copy)
    @@ -9042,20 +9042,6 @@
     		ss = GET_NEXT(ss);
     	}
     
    -	// make sure that shields are disabled/enabled if they need to be - Chief1983
    -	if (!Fred_running) {
    -		if ((p_objp->flags2 & P2_OF_FORCE_SHIELDS_ON) && (sp->ship_max_shield_strength > 0.0f)) {
    -			objp->flags &= ~OF_NO_SHIELDS;
    -		} else if ((p_objp->flags & P_OF_NO_SHIELDS) || (sp->ship_max_shield_strength == 0.0f)) {
    -			objp->flags |= OF_NO_SHIELDS;
    -		// Since there's not a mission flag set to be adjusting this, see if there was a change from a ship that normally has shields to one that doesn't, and vice versa
    -		} else if (!(sip_orig->flags2 & SIF2_INTRINSIC_NO_SHIELDS) && (sip->flags2 & SIF2_INTRINSIC_NO_SHIELDS)) {
    -			objp->flags |= OF_NO_SHIELDS;
    -		} else if ((sip_orig->flags2 & SIF2_INTRINSIC_NO_SHIELDS) && !(sip->flags2 & SIF2_INTRINSIC_NO_SHIELDS) && (sp->ship_max_shield_strength > 0.0f)) {
    -			objp->flags &= ~OF_NO_SHIELDS;
    -		}
    -	}
    -
     	// point to new ship data
     	ship_model_change(n, ship_type);
     	sp->ship_info_index = ship_type;
    @@ -9098,6 +9084,21 @@
     	Assert(sp->ship_max_hull_strength > 0.0f);
     	Assert(objp->hull_strength > 0.0f);
     
    +	// Mantis 2763: moved down to have access to the right ship_max_shield_strength value
    +	// make sure that shields are disabled/enabled if they need to be - Chief1983
    +	if (!Fred_running) {
    +		if ((p_objp->flags2 & P2_OF_FORCE_SHIELDS_ON) && (sp->ship_max_shield_strength > 0.0f)) {
    +			objp->flags &= ~OF_NO_SHIELDS;
    +		} else if ((p_objp->flags & P_OF_NO_SHIELDS) || (sp->ship_max_shield_strength == 0.0f)) {
    +			objp->flags |= OF_NO_SHIELDS;
    +		// Since there's not a mission flag set to be adjusting this, see if there was a change from a ship that normally has shields to one that doesn't, and vice versa
    +		} else if (!(sip_orig->flags2 & SIF2_INTRINSIC_NO_SHIELDS) && (sip->flags2 & SIF2_INTRINSIC_NO_SHIELDS)) {
    +			objp->flags |= OF_NO_SHIELDS;
    +		} else if ((sip_orig->flags2 & SIF2_INTRINSIC_NO_SHIELDS) && !(sip->flags2 & SIF2_INTRINSIC_NO_SHIELDS) && (sp->ship_max_shield_strength > 0.0f)) {
    +			objp->flags &= ~OF_NO_SHIELDS;
    +		}
    +	}
    +
     	// niffiwan: set new armor types
     	sp->armor_type_idx = sip->armor_type_idx;
     	sp->shield_armor_type_idx = sip->shield_armor_type_idx;
    
    patch file icon mantis_2763.patch (2,428 bytes) 2013-01-01 07:46 +

-Relationships
+Relationships

-Notes

~0014602

FUBAR-BDHR (developer)

Seems like there is a problem in change_ship_type() in ship.cpp around line 9052. It's setting OF_NO_SHIELDS based on sp->ship_max_shield_strength but the values haven't been changed for the new ship class yet.

~0014603

m_m (developer)

Patch which fixes the issue has been attached.
As noted by FUBAR-BDHR the value of ship_max_shield_strength still had the old value of the previous ship at the point where the shield check was located. Moving that part of the code down after the shield values had been initialized fixes the issue.

~0014605

FUBAR-BDHR (developer)

Well for some reason it seems to work on everything except my original TBP test mission. I tried everything including a new pilot file there and it just would not work. Created the mission over from scratch and it does work now but unfortunately I didn't save the old mission (I have to quit naming every test mission 0.fs2) so I can't check the mission file to see if something in it caused the issue.

Other then that strange case I haven't been able to get it to show the wrong gauges. Still probably better to have someone else give it another look over.

~0014623

chief1983 (administrator)

Seems to not be breaking anything for FotG after a little bit of testing. Since there haven't been any other complaints I think this passes review.

~0014655

niffiwan (developer)

Looks ready to commit when SVN is available again.

~0014656

m_m (developer)

Fix committed to trunk@9506.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2012-12-31 16:55 FUBAR-BDHR New Issue
2012-12-31 16:56 FUBAR-BDHR Additional Information Updated View Revisions
2012-12-31 16:59 FUBAR-BDHR File Added: 2763.rar
2012-12-31 18:14 FUBAR-BDHR Note Added: 0014602
2013-01-01 07:45 m_m Note Added: 0014603
2013-01-01 07:45 m_m Assigned To => m_m
2013-01-01 07:45 m_m Status new => code review
2013-01-01 07:46 m_m File Added: mantis_2763.patch
2013-01-01 20:45 FUBAR-BDHR Note Added: 0014605
2013-01-10 01:01 chief1983 Note Added: 0014623
2013-01-18 21:59 niffiwan Note Added: 0014655
2013-01-19 07:31 m_m Changeset attached => fs2open trunk r9506
2013-01-19 07:31 m_m Note Added: 0014656
2013-01-19 07:31 m_m Status code review => resolved
2013-01-19 07:31 m_m Resolution open => fixed
+Issue History