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

Offline Xilmi

  • Commander
  • *****
  • Posts: 632
    • 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.

Offline Xilmi

  • Commander
  • *****
  • Posts: 632
    • View Profile
Re: Exploitable bug in TileEngine::unitOpensDoor
« Reply #1 on: May 27, 2024, 10:57:17 pm »
Fixed it now in my branch. The issue was caused by kneeling being also reserved. The TUs reserved for shooting were already considered before the door would open. But not the TUs reserved for kneeling.

Offline Yankes

  • Commander
  • *****
  • Posts: 3246
    • View Profile
Re: Exploitable bug in TileEngine::unitOpensDoor
« Reply #2 on: May 27, 2024, 11:08:38 pm »
Could you link commit that fix it?

Offline psavola

  • Commander
  • *****
  • Posts: 677
    • View Profile