Author Topic: SMALL_ONLY Weapon Turrets (Commited)  (Read 1330 times)

0 Members and 1 Guest are viewing this topic.

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
SMALL_ONLY Weapon Turrets (Commited)
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.

Code: [Select]
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) {
« Last Edit: January 10, 2012, 12:34:07 pm by Valathil »
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: SMALL_ONLY Weapon Turrets
I can't see anything that would go wrong there.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: SMALL_ONLY Weapon Turrets
All of my tests have shown no problems with this fix  :yes:
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

  

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Re: SMALL_ONLY Weapon Turrets (Commited)
Commited per revision 8157
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛