CatacombSDL icon indicating copy to clipboard operation
CatacombSDL copied to clipboard

Fix warp bug on level clearing

Open 64kramsystem opened this issue 2 years ago • 0 comments

Based on history (commit ba34c6a8d19817e171ff4e39d62d56e5cca08ec9), the warp array value was increased to 3 because of a Clang warning.

However, the reason why the warning was raised, was actually another bug.

If the value assigned to the second element, is not a valid number:

if ( (warp[1]<'0') || (warp[1]>'9') )
  warp[2]=' ';

then it should be cleared; however, its index is 1, not 2.

The fix should have been therefore to fix the index, not the array size:

if ( (warp[1]<'0') || (warp[1]>'9') )
  warp[1]=' '; # here

64kramsystem avatar Aug 15 '22 19:08 64kramsystem