ChrisNeedham24 / microcosm

A little 4X game written using Pyxel.
GNU General Public License v3.0
11 stars 8 forks source link

Jump to idle settlement overlay bug #141

Closed ChrisNeedham24 closed 11 months ago

ChrisNeedham24 commented 1 year ago

This bug crashes the game if it occurs - though it would happen rarely due to the circumstances in which it occurs.

Steps to reproduce:

  1. Ensure that you have an idle settlement, i.e. one without an ongoing construction, as well as a deployed unit.
  2. Select the deployed unit.
  3. Press the J key - you should see the settlement highlighted in red, but the unit overlay still displayed instead of the settlement overlay.
  4. At this point, you can exit the bug state by clicking anywhere apart from the settlement (though if you click on the settlement, the unit will somehow move into the same quad. However, to recreate the bug, we now need to press the TAB key.
  5. The settlement should still be highlighted, but the unit overlay should no longer be displayed. Under normal circumstances, we would expect the settlement overlay to be displayed.
  6. Lastly, click anywhere apart from the settlement itself - the game should crash.

The bug is due to the fact that the unit overlay isn't removed when pressing the J key when a unit is selected - you can reference how the TAB key is handled in game_input_handler.py to see how it should work.