Primarily because the two tiles are on a mix of even/odd rows, the rectangle has to get "expanded" a bit beyond what might be immediately obvious - in each case there's a couple of different options which would work equally well. The problem's more that due to the even/odd row differences, there's also many situations where a simple "min(x1, x2), min(y1, y2)" doesn't quite do the trick. I'd been using this graphic to work out some of this on paper, btw: For instance, if we have (1,6) and (3,2), the NW corner is (1, 2). In all those cases, we can define the northwest corner of the "rectangle" by taking the minimum X and minimum Y values from each of the coordinates. For example, pretend that the lava tiles are the ones passed-in, and the whole areas of grass+lava defines the "rectangle" I'm talking about: For some situations this is quite simple.
When I set up a function to take a range of tiles instead, what I'll need to do is define a "rectangular" area which we know we need to redraw. The function will basically end up rendering a small little rectangle of the map - for instance, here's the "patched" image that the current redraw_tile ends up generating if I add a bag in Baizel's house: Perhaps you could point out something stupid I'm doing here? I feel like there's an absurdly simple solution to this that I'm just not getting.įixing the speed issue here will involve basically having redraw_tile (or a separate function, whatever) redraw not just a single tile, but a list of passed-in tiles (ie: the list of tiles that have changed as a result of the larger-brush draw action). I'd hoped that a week's break while I had houseguests would clear it up a bit, but apparently not. Okay so: I've been stuck on one annoying little issue which has been making me feel rather like an idiot for the past few days.