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: CargoPickerDialog strg-to-transfer multi stack problem  (Read 571 times)

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
CargoPickerDialog strg-to-transfer multi stack problem
« on: September 14, 2020, 11:35:44 AM »

While in the process of testing a cargo picker, I noticed the following:

https://i.imgur.com/S12ETrJ.mp4

This is reproducible and works with any item stack.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: CargoPickerDialog strg-to-transfer multi stack problem
« Reply #1 on: September 14, 2020, 06:36:09 PM »

Hmm - I'm having a hard time reproducing this with the "hand in AI cores" dialog. I've got 3 stacks of each type of AI core; pick up the first one, put it down, ctrl-click all 3 to transfer, then ctrl-click the first one back and then again to hand in, and nothing seems to go wrong. Am I missing something?
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: CargoPickerDialog strg-to-transfer multi stack problem
« Reply #2 on: October 18, 2020, 02:00:03 PM »

Solved.

for future reference:
calling cargo.removeEmptyStacks(); on recreateTextPanel() for the target Cargo causes this.

I am unsure why I did that in the first place, but that was it.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: CargoPickerDialog strg-to-transfer multi stack problem
« Reply #3 on: October 18, 2020, 02:29:47 PM »

Huh, ok. Sounds a bit odd, but, well, if you've got it sorted out!
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: CargoPickerDialog strg-to-transfer multi stack problem
« Reply #4 on: October 19, 2020, 01:59:45 AM »

calling cargo.removeEmptyStacks(); on recreateTextPanel() for the target Cargo causes this.
You are causing desynchronization between UI that displays your cargo object, and the cargo object itself.
Going frame by frame, after you have 4 items in Selected, you remove first one, then call cargo.removeEmptyStacks() - now your cargo object has 3 elements in it (as opposed to 4, with first one empty), when you transfer another one, it sees first 3 are occupied, so UI places it at 4th slot (since according to cargo object it's empty).
Logged