OpenXcom Forum

Contributions => Programming => Topic started by: karadoc on February 17, 2018, 12:22:42 pm

Title: Fixed bug in TileEngine::voxelCheck related to stairs / slopes.
Post by: karadoc on February 17, 2018, 12:22:42 pm
Melee attacks against units standing on slopes would often fail to do any damage. This was a long standing and well known bug. Today I tracked it down. It turns out to be a mistake in TileEngine::voxelCheck.


The gist of the problem is that the voxel check wasn't finding the unit to deal the damage because it wasn't including the terrain height of the unit. It wasn't including the terrain height of the unit because it was instead including the terrain height of the tile above the unit... which was unhelpful.

The fix is easy, and I've posted it here (https://github.com/karadoc/OpenXcom/commit/e5a9bb26941e8e62494622237ac983110256ce0b) (along with a description of the problem).

I suspect a side effect of this will be that units on slopes will be hit more often in general; because voxelCheck is used for many things, and this problem would affect all of them. Nevertheless it is a bug fix.