Author Topic: Bug in TileEngine::setDangerZone  (Read 1243 times)

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 605
    • View Profile
Bug in TileEngine::setDangerZone
« on: November 10, 2022, 07:15:31 pm »
Code: [Select]
if (calculateLineVoxel(originVoxel, targetVoxel, false, &trajectory, unit, unit) == V_EMPTY)
needs to be changed to:

Code: [Select]
if (calculateLineVoxel(originVoxel, targetVoxel, true, &trajectory, unit, unit) == V_EMPTY)
Otherwise only the tile where the grenade lands will be considered dangerous.

Reason:
calculateLineVoxel, when called with storeTrajectory = false will only return a trajectory when something would block the line. But in this case we want to see whether the line is free.

So the trajectory-size was always 0 on the tiles that were empty.

When it is called with "true", it works. Alternatively you can leave it at "false" and set the tile as dangerous when the trajectory-size is 0 because that means that nothing would be in the way of the blast-wave.