arx/ArxLibertatis — Issue #135: assertion triggered in pathfinder
Author: adejr
Created: 2011-11-16 09:31:21+00:00
State: open

PathFinder.cpp: ln363: PathFinder::wanderAround(...):

size_t r = (size_t)(rnd() * (float)map_d[next].nblinked);
arx_assert(r < (size_t)map_d[next].nblinked);

rnd()'s range is [0.0f ... 1.0f],
1.0f * x == x

so this assertion is sure to be triggered any time the function is called regularly, and it is.

was the intention that nblinked is the maximum and therefore lte (<=) is required, or should the line read:

size_t r = (size_t)(rnd() * (float)(map_d[next].nblinked - 1));