Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: [0.9a RC10] Unexpected Behaviour: BaseToggleAbility.deactivate() not guaranteed  (Read 1063 times)

Darloth

  • Admiral
  • *****
  • Posts: 592
    • View Profile

It's possible to call BaseToggleAbility.deactivate() and not actually deactivate an ability, if some time between the start of the ability and the call to deactivate, it's become no longer usable.

This is due to line 205, which is
Code
		if (isActive() && isUsable()) {

While I can't say for sure this is a bug as such, it was -really- unexpected behaviour as I was in fact checking isUsable() and then calling deactivate() to untoggle it if it became unusable.

Apologies if this is intended behaviour, but I was expecting only the check for isActive when I'm trying to deactivate something.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile

Hmm, I think you're right - changed it to only check isActive().
Logged