summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tile2.cc
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-18 21:38:35 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-18 21:38:35 +0000
commiteff146e56bd5e47d0f20af245a00262e86c9f59f (patch)
tree6f54429dde7fcf240b841acb69fb1a385f41c4d4 /crawl-ref/source/tile2.cc
parentc445c5a6f661d292563c4e7a45e712c4550499ad (diff)
downloadcrawl-ref-eff146e56bd5e47d0f20af245a00262e86c9f59f.tar.gz
crawl-ref-eff146e56bd5e47d0f20af245a00262e86c9f59f.zip
[1941577] Fix for crashes when resizing screen.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4346 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tile2.cc')
-rw-r--r--crawl-ref/source/tile2.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index 800998a040..a2522d2f6f 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -137,7 +137,7 @@ int get_floor_special_tile_idx()
static int last_cursor = -1;
//Internal cache Image buffer
-static img_type tcache_image;
+static img_type tcache_image = 0;
//Start of a pointer string
static int tcache_head;
@@ -322,19 +322,18 @@ void TileResizeScreen(int x0, int y0)
{
tile_xmax = x0;
tile_ymax = y0;
-#if 0
max_tcache = 4*tile_xmax*tile_ymax;
free(screen_tcache_idx);
screen_tcache_idx = (int *)malloc(sizeof(int)* tile_xmax * tile_ymax);
- free(tcache[k]);
- tcache[k] = (tile_cache *)malloc(sizeof(tile_cache)*max_tcache);
+ free(tcache);
+ tcache = (tile_cache *)malloc(sizeof(tile_cache)*max_tcache);
for (int x = 0; x < tile_xmax * tile_ymax; x++)
screen_tcache_idx[x] = -1;
- _clear_tcache();
-#endif
+ _init_tcache();
+
crawl_view.viewsz.x = tile_xmax;
crawl_view.viewsz.y = tile_ymax;
crawl_view.vbuf.size(crawl_view.viewsz);
@@ -363,6 +362,7 @@ void _clear_tcache()
void _init_tcache()
{
_clear_tcache();
+ ImgDestroy(tcache_image);
tcache_image = ImgCreateSimple(tcache_wx_normal,
max_tcache*tcache_wy_normal);
}