Spoon came to me and had the following problem. He has a turret with one weapon for huge ships (WIF_HUGE) and one weapon with WIF2_SMALL_ONLY. Now the ai code checks only that ALL weapons on a turret have WIF2_SMALL_ONLY so what happens that if the turret targets a huge ship both weapons fire. I made a really small patch that checks if the target is a huge ship and if not skips the small only weapon. Any reason why this could cause complications or problems please tell me before i commit this.
Index: code/ai/aiturret.cpp
===================================================================
--- code/ai/aiturret.cpp (revision 8155)
+++ code/ai/aiturret.cpp (working copy)
@@ -2084,6 +2084,12 @@
}
}
+ if ( wip->wi_flags2 & WIF2_SMALL_ONLY ) {
+ if ( (lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
+ continue;
+ }
+ }
+
if (lep->type == OBJ_SHIP) {
// Check if we're targeting a protected ship
if (lep->flags & OF_PROTECTED) {