From d3d28f2e42238e2f2836b225c14494696c59ddc3 Mon Sep 17 00:00:00 2001 From: Cong Date: Fri, 13 Sep 2013 22:30:16 +1000 Subject: [PATCH] Fix memory errors from drawing large map Include techdemo mission followtheleader.cpn --- missions/techdemo/followtheleader.cpn | Bin 0 -> 1748 bytes src/cdogs/draw.c | 2 +- src/cdogs/draw_buffer.c | 4 ++++ src/cdogs/map.c | 1 + src/cdogs/map.h | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 missions/techdemo/followtheleader.cpn diff --git a/missions/techdemo/followtheleader.cpn b/missions/techdemo/followtheleader.cpn new file mode 100644 index 0000000000000000000000000000000000000000..589267b3848c08f8c3460b344727de53ca772bb3 GIT binary patch literal 1748 zcmeHIJ5R(g3=R)5oOnnKNNi?ffq}n(#KOwLm=fPLl6$Vw2V(2U&&JLbR8FamtHe!b zHEH_UpPhVe)$VgVGt~3kGx!@@OA7Z_Z7%x!C}F`b08ZQ2!$;L zTsoM?f*2sf+_s*Zv5M=Ncl&%G<^HNoYG<$9fDIUh&5*c7*9)wgsN5Mf2qkh!cn=z0 zG*umA)LlT$(E7KU!v_dEL=Lu|AV{he?BpxQ(j z@jnQDH{#pF+bN(u+18XZ#yjkNdY@{yLew$U^!*sy-_)G{!8@0vr-Q`b+9`CQlN>_N pa;~tX3a5+$mP$u&*Zrq@UQw9{eJbIH5?l2WSHa5d;vrEPxAl( literal 0 HcmV?d00001 diff --git a/src/cdogs/draw.c b/src/cdogs/draw.c index 504f212f4..0c31e5115 100644 --- a/src/cdogs/draw.c +++ b/src/cdogs/draw.c @@ -239,7 +239,7 @@ void DrawFloor(DrawBuffer *b, int xOffset) x < b->width; x++, tile++, pos.x += TILE_WIDTH) { - if (PicIsNotNone(tile->pic) && + if (tile->pic != NULL && PicIsNotNone(tile->pic) && !(tile->flags & (MAPTILE_IS_WALL | MAPTILE_OFFSET_PIC))) { BlitMasked( diff --git a/src/cdogs/draw_buffer.c b/src/cdogs/draw_buffer.c index 7ef036356..c395ceebd 100644 --- a/src/cdogs/draw_buffer.c +++ b/src/cdogs/draw_buffer.c @@ -102,6 +102,10 @@ void DrawBufferSetFromMap( { *bufTile = map[y][x]; } + else + { + *bufTile = tileNone; + } } bufTile += tilesXY.x - buffer->width; } diff --git a/src/cdogs/map.c b/src/cdogs/map.c index a15f07407..b4ce948b8 100644 --- a/src/cdogs/map.c +++ b/src/cdogs/map.c @@ -79,6 +79,7 @@ #define MAP_ACCESSBITS 0x0F00 +Tile tileNone = { NULL, { { 0, 0 }, { 0, 0 }, NULL }, 0, 0, NULL }; Tile gMap[YMAX][XMAX]; diff --git a/src/cdogs/map.h b/src/cdogs/map.h index 1dbb9c15b..0fba44705 100644 --- a/src/cdogs/map.h +++ b/src/cdogs/map.h @@ -119,6 +119,7 @@ typedef struct TTileItem *things; } Tile; +extern Tile tileNone; extern Tile gMap[YMAX][XMAX]; #define Map( x, y) gMap[y][x]