Phobos-developers / Phobos

Ares-compatible C&C Red Alert 2: Yuri's Revenge engine extension
GNU Lesser General Public License v3.0
300 stars 95 forks source link

Probably incorrect jumping in `PassableTerrain` related hooks #1320

Closed TaranDahl closed 4 months ago

TaranDahl commented 4 months ago

Description

Happens when you set IsPassable=true on a terrain, and place that terrain on an impassable tile. You will get a buggy tile. When a unit is pathfinding from some tile beside that buggy tile, it may consider that tile passable, and go into it. However, you can't directly order your unit to go into that impassable tile. Sometimes the unit will significantly slow down and pass through that tile. Sometimes the unit goes into the tile and gets stuck. AI units also encounter this problem, and it seems that they are more likely to get stuck. If you destroy the terrain in that buggy tile, it will returned to normal. As it is never seen happening on infantries, I suspect it is caused by DEFINE_HOOK(0x73FB71, UnitClass_CanEnterCell_PassableTerrain, 0x6). It seems that the hook skipped some necessary checks about the tile's passability. Here is an example. In the Dance of Blood campaign of MentalOmega336, I set IsPassable=true on every tree type, and there always be some attacking units that get stuck here. buggytile

Phobos Version

B43 or any other version with passable terrain function.

Conditions to reproduce

Set IsPassable=true on a terrain, and place that terrain on an impassable tile.

INI code

[SomeTerrainType]
IsPassable=yes

Steps to reproduce

Already detailed in the Description.

Expected behaviour

The unit should only go into the tile when both the tile and terrain type are passable for it.

Actual behaviour

When automatical pathfinding, the unit goes into the tile when the terrain is passable, and ignore the tile's passability.

Additional context

No response

Checklist

Starkku commented 4 months ago

Should be fixed in 1a5a619

TaranDahl commented 4 months ago

Should be fixed in 1a5a619

It works. Thanks a lot.