A collection of tools and algorithms for developing traditional roguelikes. Such as field-of-view, pathfinding, and a tile-based terminal emulator.
BSD 3-Clause "New" or "Revised" License
970
stars
63
forks
source link
Some field-of-view implementations are not reentrant. #47
Closed
HexDecimal closed 3 years ago
There are several implementations which are using non-const global variables. These prevent the algorithms from being thread-compatible.
https://github.com/libtcod/libtcod/blob/08918748a5c8c0b594fe59ec595d7947938fc823/src/libtcod/fov_diamond_raycasting.c#L49-L52
https://github.com/libtcod/libtcod/blob/08918748a5c8c0b594fe59ec595d7947938fc823/src/libtcod/fov_permissive2.c#L49-L52 https://github.com/libtcod/libtcod/blob/08918748a5c8c0b594fe59ec595d7947938fc823/src/libtcod/fov_permissive2.c#L67-L70
https://github.com/libtcod/libtcod/blob/08918748a5c8c0b594fe59ec595d7947938fc823/src/libtcod/fov_restrictive.c#L42-L46
These variables need to be moved into the stack so that they can't be overwritten by reentrant calls.