The pdir variable here:
https://github.com/diasurgical/devilution/blob/a7788ccddf383bb0a1d124b876e841826de15b10/Source/drlg_l3.cpp#L783
... is used without initialization. Visual Studio detected this at runtime. Setting it to zero does not appear to break anything. I don't know if that's correct, though.
It breaks bin-exactness, i.e. makes it not like it was written originally. Should be marked as BUGFIX in Devilution and fixed in DevilutionX probably.
After some testing it appears that it's always 0 on the stack anyway, but it should definitely have been initialized. The value pdir (previous dir) is compared to 0/1/2/3, so probably should init with -1 to be safe and then on first pass it gets set to dir. Fixing this bug doesn't appear to change map generation.
Maybe this can be done via an ifdef? Is there some macro that distinguishes binary-exact builds?
We will probably just add a BUGFIX comment like we have been doing elsewhere. There are quite a few other bugs, mostly minor, and the comment describes how to fix them.
Thanks. This can be closed then, I suppose.
Yeah things like this should be fixed in devilutionx
Most helpful comment
It breaks bin-exactness, i.e. makes it not like it was written originally. Should be marked as
BUGFIXin Devilution and fixed in DevilutionX probably.