noxworld-dev / opennox

OpenNox main repository.
GNU General Public License v3.0
463 stars 25 forks source link

Fix the invalid pointer check #714

Closed blmarket closed 2 months ago

blmarket commented 2 months ago

Current Go code is not equivalent with corresponding C code: https://github.com/noxworld-dev/opennox/blob/dev/src/legacy/GAME1_1.c#L5178

Logical explanation:

Only the listHead is guaranteed to have field_2 set to itself, while list members does not have such guarantee. So the best way to check the listItem is to check the current pointer is same with field_2 (or head)

Required sign-off