Queues failing when an action cannot complete

It seems that if you have a fleet queued to a hostile planet, and assuming 1 that has also been invaded when you originally owned it, the queue won’t complete any actions after arriving and so the fleet will stay there rather than carry out the rest of the queue i.e. return to the origin planet.

Previously the queue would fail, check it has failed and then run the next item in the list.

Consider the following fleet queue:

  1. Move to X
  2. Unload 100k metal, 100k mineral, 50k pop
  3. Move to Y

Currently, all unload orders are skipped if the planet does not have room to store all of that 50k pop. Since soldiers are also now limited I expect the same bug to apply here.

What happens:

  • Fleet moves to X
  • Fleet unloads nothing
  • Fleet moves to Y

What I would expect to happen is:

  • Fleet moves to X
  • Fleet unloads metal
  • Fleet unloads mineral
  • Fleet attempts to unload pop, amount unloaded gets limited to available storage.

P.S. Sorry if there is an issue about this, but couldn’t see anything relevant.

This seems like it relates to the same issue so joined them together. Clearly if something stops 1 part of the queue the rest fails.

This are different, and completely unrelated issues (unfortunately). I’ve fixed the one @Ingus reported, and looked into the other one…

The invalid storage thing was simply caused by an interesting typo…

Due to the way Loading / Unloading of resources works, TurnEngine attempts to perform somewhat of a ‘brute force’ to get everything where it’s supposed to do. It looks something like this:

while (true) {
  transferChildUnits [Resources|Workers|Soldiers]
  transferParentUnits [Ships]

  if (Nothing was Transferred) {
    Break the Loop.

This is designed to ensure that any ‘incremental’ loading happens properly (ships / resources). Once nothing has been transferred, then it’s assumed all that has been sent is all that CAN be sent.

So when performing a transfer, the ‘Remaining’ count to be transferred is calculated and set, so that after a loop has completed, it can attempt to move more. Here’s where the unfortunate typo occured:

count.setAmountRemainingToTransfer(availableStorage - amountTransferred);

So after transferring the metal, it set the remaining count to the maximum capacity of the planet. A second pass of the loop occurs because it’s unable to store the workers (therefore, needs to see if transferring a parent would help), and ultimately broke when trying to transfer more resources than were available to start with (a somewhat fortunate fail-safe).

Interestingly, there are a couple of other situations which would have caused this, for example, if you attempted to load 1 mineral, and 1 soldier into a Trader it would load 700,000 mineral (max capacity of the trader).

Either way, all fixed up now.

1 Like