Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Dragon on June 25, 2011, 02:19:11 pm

Title: A bug in $Substitute feature
Post by: Dragon on June 25, 2011, 02:19:11 pm
I think I've found a bug when using $Substitute to add tracers to my gatling gun.
Upon trying to fire the weapon, this happened:
Code: [Select]
Assert: position != NULL
File: weapons.cpp
Line: 4979
'Alpha 1' is trying to fire a weapon that is not selected

<no module>! KiFastSystemCallRet
<no module>! WaitForSingleObject + 18 bytes
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! <no symbol>
<no module>! RegisterWaitForInputIdle + 73 bytes
The reason seems obvious to me, the weapon has $Substitute: set with +frequency: 5 , while the ship has 6 guns. That would have caused the tracer to appear at the very start of firing sequence, a situation which FSO doesn't seem to like. Am I correct?
If I am, could this be fixed?
Title: Re: A bug in $Substitute feature
Post by: Iss Mneur on June 25, 2011, 04:51:52 pm
I doubt it, that particular assert is usually triggered by you putting the weapon on a turret.

That said, I take it based on your conclusion that if you change the frequency that the assert disappears?
Title: Re: A bug in $Substitute feature
Post by: Dragon on June 25, 2011, 05:05:22 pm
No, I didn't had time to do further testing (I based my conclusion on the fact this weapon seems to work on other craft). The ship I'm flying has a turret, but it doesn't use $Substitute (and this turret gun also works, while it's installed on other ship). In fact, I don't think there was anything else that could cause problems. The weapon was a gatling gun (with spinup) and the ship used Chief's weapon linking (which works with $Substitute). I now suspect the spinup, which could have caused a crash on release build, on a different weapon (I ended up not re-checking it on debug due to lack of time). I'm sorry my testing was so lax, but tommorow I'm going to a paramillitary camp and I had to pack everything, so I was quite busy.
Title: Re: A bug in $Substitute feature
Post by: Dragon on July 24, 2011, 07:47:04 am
OK, an update.
EDIT: Nevermind, it turned out that the cause was a stupid table error, I accidently left $Substitute in the tracer bullet entry. Now it works.  :)