Author Topic: Exploitable bug in TileEngine::unitOpensDoor  (Read 127 times)

Offline Xilmi

  • Commander
  • *****
  • Posts: 617
    • View Profile
Exploitable bug in TileEngine::unitOpensDoor
« on: April 13, 2024, 01:45:51 pm »
This issue was brought up to me by the streamer https://www.twitch.tv/dasrifftierchen

And since I could reproduce it in regular OXCE and not just my fork, I thought I better bring it up here.

The bug works as follows:

When a unit with reserved time-units tries to right-click-open a door while doing so would exceed the reserved time-units, the door will still get opened.
However, the time-units will not be spent, the vision will not be updated and the door-opening-sound will not be played.

This is because in TileEngine::unitOpensDoor the function tile->openDoor is called before _save->getBattleGame()->checkReservedTU.

I think TileEngine::unitOpensDoor needs a bit of restructuring to fix this issue.

I attached a screenshot and a save with the situation prepared for testing.