There are several implementations which are using non-const global variables. These prevent the algorithms from being thread-compatible.
|
static int origx,origy; /* fov origin */ |
|
static ray_data_t **raymap; /* result rays */ |
|
static ray_data_t *raymap2; /* temporary rays */ |
|
static int perimidx; |
|
/* Defines the parameters of the permissiveness */ |
|
/* Derived values defining the actual part of the square used as a range. */ |
|
static int offset; |
|
static int limit; |
|
static view_t **current_view=NULL; |
|
static view_t *views=NULL; |
|
static viewbump_t *bumps=NULL; |
|
static int bumpidx=0; |
|
/* angle ranges */ |
|
double * start_angle = NULL; |
|
double * end_angle = NULL; |
|
/* number of allocated angle pairs */ |
|
int allocated = 0; |
These variables need to be moved into the stack so that they can't be overwritten by reentrant calls.
There are several implementations which are using non-const global variables. These prevent the algorithms from being thread-compatible.
libtcod/src/libtcod/fov_diamond_raycasting.c
Lines 49 to 52 in 0891874
libtcod/src/libtcod/fov_permissive2.c
Lines 49 to 52 in 0891874
libtcod/src/libtcod/fov_permissive2.c
Lines 67 to 70 in 0891874
libtcod/src/libtcod/fov_restrictive.c
Lines 42 to 46 in 0891874
These variables need to be moved into the stack so that they can't be overwritten by reentrant calls.