Author Topic: SVN Trunk 7th May + Subsystem Fixes  (Read 5523 times)

0 Members and 1 Guest are viewing this topic.

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
SVN Trunk 7th May + Subsystem Fixes
Here's are a bunch of fixes for a rather specific series of subsystem bugs that have (especially) been plaguing the WCS and TBP teams. The bug was caused by having a ship in the mission file with a subsystem called Engine and being able to change to a ship in loadout that had a name like Engine01 etc. The problem was that if a SEXP did anything to the Engine subsystem it would then crash when it came across Engine01.

The bug affected several SEXPs including

ship-subsys-guardian-threshold (where it was first noticed)
hits-left-subsystem
distance-subsystem
set-scanned/unscanned
is-ai-class
sabotage/repair-subsystem
set-subsystem-strength
set-cargo
ship-subsys-targetable/untargatable
change-subsystem-name

Some of those would crash in retail, some only in debug while others simply give the wrong answer or do nothing. The solution to some of those problems was to add a new <all engines> and <all turrets> option to those SEXPs. For some of the others I can stop them crashing but there is no sensible way to make them give an answer (How do you give a sensible answer for distance-subsystem when you change from a ship with one engine to a ship with multiple engines!).

Anyway since this is a fairly widespread change it needs some heavy testing (especially for but not limited to people who do actually use those SEXPs on player ships), so I'm posting a build here. If you get bugs you can't reproduce in chief's build tell me.


Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: SVN Trunk 7th May + Subsystem Fixes
Maybe it should just be agreed upon that 'Engine', 'Engines', and 'Engine01' are treated interchangably, and the mods will just have to be aware of that.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
Re: SVN Trunk 7th May + Subsystem Fixes
Err.. good to know this is a problem... so how was this fixed now. What does the game do now?

e.g. if I have guardianed subsystems Engine01 and Engine02 and chose a ship with Engine or Engines?

What if the other way around.. or what if changine from two engine subsystems to three, or stuff like that?

Will it sill be possible to just protect one engine and leave the other one unguarded? Will that always be the case when switching from
a ship with one engine to a ship with more than one?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: SVN Trunk 7th May + Subsystem Fixes
The easiest solution is to use the <all engines> option.

Goober gave me a suggestion for how to protect only one engine although I can't think why you'd ever want to do that.

when-argument
-Engine
-Engine01
-whatever trigger
-ship-subsys-guardian-threshold
--<argument>

I'll have to add a slight change to the code to allow that to work but it will work once the code hits SVN.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: SVN Trunk 7th May + Subsystem Fixes
(How do you give a sensible answer for distance-subsystem when you change from a ship with one engine to a ship with multiple engines!)
If the subsystem doesn't exist, NaN is probably the best return value.


Maybe it should just be agreed upon that 'Engine', 'Engines', and 'Engine01' are treated interchangably, and the mods will just have to be aware of that.
The subsystem code already treats engine/engines and communication/communications as equal (and has since 3.6) but treating engine/engine01 as equal is just asking for trouble.  Karajorma and I talked about it at length a few weeks ago; that's where he came up with the <all x> option.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: SVN Trunk 7th May + Subsystem Fixes
Quote
If the subsystem doesn't exist, NaN is probably the best return value.

Yep. What I did was to fix the SEXPs to check if the ship has changed its class at any point. If it hasn't it will still report it as an error or write a warning to the debug output (I might fix that to a warning in all cases). If it has changed it will simply ignore it and return NaN.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: SVN Trunk 7th May + Subsystem Fixes
Yeah I like the all x idea better too.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Current projects: Vasudan Imperium
    • Steam
    • User page on the FreeSpace Wiki
Re: SVN Trunk 7th May + Subsystem Fixes
I don't suppose you could implement an <any engine> or <any turret> too? That might patch the hole in the 'engine01' 'engine02' scenario you're talking about.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: SVN Trunk 7th May + Subsystem Fixes
The easiest solution is to use the <all engines> option.

Goober gave me a suggestion for how to protect only one engine although I can't think why you'd ever want to do that.

when-argument
-Engine
-Engine01
-whatever trigger
-ship-subsys-guardian-threshold
--<argument>

I'll have to add a slight change to the code to allow that to work but it will work once the code hits SVN.

That's exactly what I usually do...I have never experienced problems with it. :nod:
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: SVN Trunk 7th May + Subsystem Fixes
I don't suppose you could implement an <any engine> or <any turret> too? That might patch the hole in the 'engine01' 'engine02' scenario you're talking about.

You mean pick the first one it comes across? Hmmm. I suppose that might be possible.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]