Tuesday, June 13, 2017

FMod - Level size checks

I noticed a couple days ago that Abiathar crashes if the row/column adjusters are used to reduce a dimension of a level to zero. It doesn't really make sense to have a zero-area level, and the level Properties window doesn't let you make one anyway, so today I added checks to those tools to make them not expand or contract the level beyond the limits. While doing that, I removed incorrect checks intended to prevent too-large levels but that actually consulted the opposite dimension they needed to.

While debugging that problem, I found yet another. Mousing over a location greater than 255 made Abiathar completely freeze. It was trying to format the coordinates in hexadecimal, padded to a certain length, but because 256 is 100 in hex, the string was already more than long enough. The check was only for equality as opposed to exceeding-or-equality, so into an infinite loop it went. That's fixed now.

Finally, I added that size restriction data to the API. For normal level sets it's just from 1 to 255, but other formats (yet to be supported) have different limits.

No comments:

Post a Comment