View Issue Details

IDProjectCategoryView StatusLast Update
0002745FSSCPFREDpublic2012-12-23 23:25
ReporterFUBAR-BDHR Assigned ToValathil  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.15 
Summary0002745: FRED will let you add individual ships in a wing as reinforcement units
DescriptionWhile testing the patch for 0002009 I ran into this one. Not sure what this will do in game but it can't be good to have 1 (or more) ships in a wing as reinforcement units.
Steps To ReproduceOpen FRED. Drop in a couple of ships, create a wing, go to ship editor, edit 1 of the ships, turn reinforcement flag on. Save mission.

Note this can also be done with multiple ships selected like the entire wing.

Attaching mission with 1 ship of a wing of 2 as reinforcement unit.
TagsNo tags attached.

Relationships

related to 0002009 resolvedCommanderDJ No warning if reinforcements exceed limit 

Activities

FUBAR-BDHR

2012-12-03 03:44

developer  

2745.fs2 (4,416 bytes)

FUBAR-BDHR

2012-12-03 03:55

developer   ~0014266

Tested in game. This appears to not affect FS2 at all. Wings arrive normally and reinforcements do not appear on list. Only question is should parsing catch this.

FUBAR-BDHR

2012-12-03 05:13

developer  

2745.patch (1,222 bytes)   
Index: mission/missionparse.cpp
===================================================================
--- mission/missionparse.cpp	(revision 9390)
+++ mission/missionparse.cpp	(working copy)
@@ -2403,8 +2403,19 @@
 		objp->flags |= OF_PROTECTED;
 
 	if (parse_flags & P_SF_REINFORCEMENT)
-		shipp->flags |= SF_REINFORCEMENT;
+	{
+		// Individual ships in wings can't be reinforecments - FUBAR
+		if (shipp->wingnum >= 0)
+		{ 
+			Warning (LOCATION, "Ship %s is a reinforcment unit but is a member of a wing.  Ignoring flag.", shipp->ship_name);
+		}
+		else
+		{
+			shipp->flags |= SF_REINFORCEMENT;
+		}
+	}
 
+
 	Assert(!((parse_flags & P_OF_NO_SHIELDS) && (parse_flags2 & P2_OF_FORCE_SHIELDS_ON)));
 	if (parse_flags & P_OF_NO_SHIELDS)
 		objp->flags |= OF_NO_SHIELDS;
@@ -4916,7 +4927,16 @@
 			return;
 		}
 	} else {
-		instance = rforce_obj->wingnum;
+		// Individual ships in wings can't be reinforecments - FUBAR
+		if (rforce_obj->wingnum >= 0)
+		{
+			Warning(LOCATION, "Reinforcement %s is part of a wing - Ignoring", ptr->name);
+			return;
+		}
+		else
+		{
+			instance = rforce_obj->wingnum;
+		}
 	}
 
 	// now, if the reinforcement is a wing, then set the number of waves of the wing == number of
2745.patch (1,222 bytes)   

FUBAR-BDHR

2012-12-03 05:15

developer  

2745_patchtest.fs2 (12,607 bytes)

FUBAR-BDHR

2012-12-03 05:15

developer   ~0014267

Attached FS2 side parsing patch and test mission.

MjnMixael

2012-12-14 06:22

manager   ~0014446

Attached patched needs to be looked at and tested.

FUBAR-BDHR

2012-12-14 07:29

developer   ~0014449

It's not a patch for the actual issue just a catch game side.

CommanderDJ

2012-12-18 23:40

developer  

2745_2.patch (1,293 bytes)   
Index: code/mission/missionparse.cpp
===================================================================
--- code/mission/missionparse.cpp	(revision 9452)
+++ code/mission/missionparse.cpp	(working copy)
@@ -2410,8 +2410,18 @@
 		objp->flags |= OF_PROTECTED;
 
 	if (parse_flags & P_SF_REINFORCEMENT)
-		shipp->flags |= SF_REINFORCEMENT;
-
+	{
+		//Individual ships in wings can't be reinforcements - FUBAR
+		if(shipp->wingnum >= 0)
+		{
+			Warning(LOCATION, "Ship %s is a reinforcement unit but is a member of a wing. Ignoring flag.", shipp->ship_name);
+		}
+		else
+		{
+			shipp->flags |= SF_REINFORCEMENT;
+		}
+	}
+	
 	if ((parse_flags & P_OF_NO_SHIELDS) && (parse_flags2 & P2_OF_FORCE_SHIELDS_ON))
 	{
 		Warning(LOCATION, "The parser found a ship with both the \"force-shields-on\" and \"no-shields\" flags; this is inconsistent!");
@@ -4933,7 +4943,16 @@
 			return;
 		}
 	} else {
-		instance = rforce_obj->wingnum;
+		// Individual ships in wings can't be reinforcements - FUBAR
+		if (rforce_obj->wingnum >= 0)
+		{
+			Warning(LOCATION, "Reinforcement %s is part of a wing - Ignoring", ptr->name);
+			return;
+		}
+		else
+		{
+			instance = rforce_obj->wingnum;
+		}
 	}
 
 	// now, if the reinforcement is a wing, then set the number of waves of the wing == number of
2745_2.patch (1,293 bytes)   

CommanderDJ

2012-12-18 23:41

developer   ~0014531

Last edited: 2012-12-18 23:42

Okay, so what actually needs to be done here? FUBAR's patch did not apply cleanly to latest trunk, so I've uploaded (an equivalent) one that does. I tested it with the mission and it seemed to remedy the issue. So is this enough, if the patch is committed?

Valathil

2012-12-22 21:57

developer   ~0014566

I'd like to see a test by mjn to see if normal reinforcement definition gets interfered by the patch.

FUBAR-BDHR

2012-12-22 22:02

developer   ~0014569

What needs to happen here is for FRED to prevent this from happening just like the fix for 2009 prevents you from going over the limit. So if you try to make a ship a reinforcement and it's part of a wing you are blocked from doing so. You try to form a wing and one or more of the ships are reinforcements then you are blocked from creating the wing. Of course a check at save never hurts either.

My patch is just a FS2 side catch for missions that already have invalid reinforcements.

Valathil

2012-12-22 22:40

developer   ~0014570

Ah i see. I'll try to whip something up.

Valathil

2012-12-23 23:25

developer   ~0014572

Fix committed to trunk@9462.

Related Changesets

fs2open: trunk r9462

2012-12-23 18:58

Valathil


Ported: N/A

Details Diff
Fix for Mantis 2745: Make it impossible in FRED to select individual ships for reinforcements when in a wing. From FUBAR: Check at mission parse and spit out warnings. Affected Issues
0002745
mod - /trunk/fs2_open/code/fred2/fredview.cpp Diff File
mod - /trunk/fs2_open/code/fred2/reinforcementeditordlg.cpp Diff File
mod - /trunk/fs2_open/code/fred2/shipflagsdlg.cpp Diff File
mod - /trunk/fs2_open/code/mission/missionparse.cpp Diff File

Issue History

Date Modified Username Field Change
2012-12-03 03:42 FUBAR-BDHR New Issue
2012-12-03 03:44 FUBAR-BDHR File Added: 2745.fs2
2012-12-03 03:44 FUBAR-BDHR Relationship added related to 0002009
2012-12-03 03:55 FUBAR-BDHR Note Added: 0014266
2012-12-03 05:13 FUBAR-BDHR File Added: 2745.patch
2012-12-03 05:15 FUBAR-BDHR File Added: 2745_patchtest.fs2
2012-12-03 05:15 FUBAR-BDHR Note Added: 0014267
2012-12-14 06:21 MjnMixael Assigned To => FUBAR-BDHR
2012-12-14 06:21 MjnMixael Status new => assigned
2012-12-14 06:22 MjnMixael Note Added: 0014446
2012-12-14 06:22 MjnMixael Status assigned => code review
2012-12-14 07:29 FUBAR-BDHR Note Added: 0014449
2012-12-14 07:29 FUBAR-BDHR Assigned To FUBAR-BDHR =>
2012-12-14 07:29 FUBAR-BDHR Status code review => new
2012-12-18 23:14 CommanderDJ Assigned To => CommanderDJ
2012-12-18 23:14 CommanderDJ Status new => assigned
2012-12-18 23:40 CommanderDJ File Added: 2745_2.patch
2012-12-18 23:41 CommanderDJ Note Added: 0014531
2012-12-18 23:42 CommanderDJ Note Edited: 0014531
2012-12-22 21:57 Valathil Note Added: 0014566
2012-12-22 22:02 FUBAR-BDHR Note Added: 0014569
2012-12-22 22:40 Valathil Note Added: 0014570
2012-12-23 23:25 Valathil Assigned To CommanderDJ => Valathil
2012-12-23 23:25 Valathil Changeset attached => fs2open trunk r9462
2012-12-23 23:25 Valathil Note Added: 0014572
2012-12-23 23:25 Valathil Status assigned => resolved
2012-12-23 23:25 Valathil Resolution open => fixed