beyond-all-reason / Beyond-All-Reason

Main game repository for Beyond All Reason.
https://www.beyondallreason.info/
Other
1.8k stars 302 forks source link

fix commandinsert math #3923

Closed keelefi closed 2 weeks ago

keelefi commented 2 weeks ago

The check to add at end of command queue has incorrect math.

Fix by correcting the math.

Test steps

  1. Load skirmish against InactiveAI and start game.
  2. Use commander to place a command queue of solars along a path from north to south (vertically on screen)
  3. Place solars in the middle using prepend_between i.e. with shift+space

Prior to this change the solars are not placed between the solars queued earlier.

After this change the solars are placed between the solars queued earlier.

Rippsy commented 2 weeks ago

For reference After fix video: https://discord.com/channels/549281623154229250/549281623577722899/1305568489750134895 Before fix video: https://discord.com/channels/549281623154229250/549281623577722899/1305568504099110923

Note, spatial insert before 2nd to last and last still has issues vs ideal which works on horizontal https://discord.com/channels/549281623154229250/549281623577722899/1305564843666968608

But overall this is a vast improvement

saurtron commented 2 weeks ago

good catch!, I tried and could reproduce the problem and your fix.

also btw, isn't there a similar error a few lines before?

At the end of that long line the y component gets summed twice into the 3rd sqrt. Might be a good idea to fix that too.

I think a way to reproduce that is to build a column up to down, then another one in queue too between the last two but somewhat to the right. then insert in between the last two of the first column. Instead of queueing where one would expect it (between the last two in the column) will queue after the last one. (there might be a more simple way to do it or describe it lol)

badinsert2

keelefi commented 2 weeks ago

also btw, isn't there a similar error a few lines before?

At the end of that long line the y component gets summed twice into the 3rd sqrt. Might be a good idea to fix that too.

Fixed, thank you!