DIG: Experimental memory corruption fix
|Reported by:||eriktorbjorn||Owned by:||SF/ender|
This patch is experimental in two senses: First of all, it's not very well tested, and secondly I'm sort of hoping someone will tell me it's wrong and that there's a much better way to do it.
The problem with the Dig memory corruption is, I think, that whenever we use the mask buffer, we assume that it has one strip for each strip in the room image (in the case of the Dig's nexus room, that's more than 220), yet we only allocate enough memory for the strips visible on screen (typically 40), and we assume that's also the mask buffer's pitch.
What this patch does is simply to always allocate enough space for 240 strips in the mask buffer, and change the pitch assumption, which means it will use six times as much memory as before. In most cases, that seems like an unnecessary waste of space to me, so I'd really like to find a better way.
Note that even if this patch is rejected, there are still some places in string.cpp and gfx.cpp where the number of strips is hard-wired as 40. That, at least, should be fixed.
Ticket imported from: #629043. Ticket imported from: patches/214.