Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: niffiwan on August 25, 2011, 06:46:28 am
-
Here's a patch vs trunk for Mantis 2467 (http://scp.indiegames.us/mantis/view.php?id=2467) - "untargeted heat seekers ignore ship protect"
I also took the liberty of adding a warning if the untargeted heat seeker flag was used without the weapon also having a homing type of HEAT.
Let me know what you think.
Thanks
Index: code/weapon/weapons.cpp
===================================================================
--- code/weapon/weapons.cpp (revision 7523)
+++ code/weapon/weapons.cpp (working copy)
@@ -697,6 +697,11 @@
{
Warning(LOCATION,"Weapon %s has the \"inherit parent target\" flag, but not the \"child\" flag. No changes in behavior will occur.", weaponp->name);
}
+
+ if (!(weaponp->wi_flags & WIF_HOMING_HEAT) && (weaponp->wi_flags2 & WIF2_UNTARGETED_HEAT_SEEKER))
+ {
+ Warning(LOCATION,"Weapon %s has the \"untargeted heat seeker\" flag, but Homing Type is not set to \"HEAT\".", weaponp->name);
+ }
}
void parse_shockwave_info(shockwave_create_info *sci, char *pre_char)
@@ -3876,7 +3881,9 @@
}*/
//WMC - Spawn weapons shouldn't go for protected ships
- if((objp->flags & OF_PROTECTED) && (wp->weapon_flags & WF_SPAWNED))
+ // ditto for untargeted heat seekers - niffiwan
+ if((objp->flags & OF_PROTECTED) &&
+ ((wp->weapon_flags & WF_SPAWNED) || (wip->wi_flags2 & WIF2_UNTARGETED_HEAT_SEEKER)))
continue;
// Spawned weapons should never home in on their parent - even in multiplayer dogfights where they would pass the iff test below
[attachment deleted by ninja]
-
Looks excellent, and good job adding the warning. :yes: I presume you've tested it in-mission?
-
Yes, spoon provided me a test mission with a .tbl file (attached to mantis) which I played a number of times, both with & without the patch. With the patch the modified tornado's ignored my ship quite nicely ;)
I also modified the .tbl file & ran a debug build to ensure the warning was generated (see attached).
For future patches, I'll see if I can get Visual C++ 2010 Express installed somewhere so I can create Windows binaries for other people to test with. I'll probably be waiting for testers for ages if I just produce Linux test binaries!
[attachment deleted by ninja]
-
Super. I'll bet someone will be along to merge your patch shortly. I'll do it myself if no one volunteers before this evening.
-
Took a look at it. Aside from the personal preference of putting the %s as '%s' (to better highlight the Weapon name from everything else, especially one with spaces in it), it looks good and I'd like to commit it (with that slight adjustment).
-
Your change sounds good - I agree the quotes will make it clearer. There's 4 or so similar "if blah then warn" statements above that one that should have the same thing done to them.
-
I couldn't agree more, but we will keep this commit strictly to the issue at hand.
Committed to Trunk r7537.
-
Thanks Zacam :D
-
And thank you niffiwan. :)
Now do another one. :D
-
Sir! Yes Sir! :p
-
Tested it just now, looks like this has been completely fixed
Good job :yes: