Skip to content

Commit

Permalink
Fix memory errors from drawing large map
Browse files Browse the repository at this point in the history
Include techdemo mission followtheleader.cpn
  • Loading branch information
cxong committed Sep 13, 2013
1 parent 3bde5ad commit d3d28f2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
Binary file added missions/techdemo/followtheleader.cpn
Binary file not shown.
2 changes: 1 addition & 1 deletion src/cdogs/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions src/cdogs/draw_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ void DrawBufferSetFromMap(
{
*bufTile = map[y][x];
}
else
{
*bufTile = tileNone;
}
}
bufTile += tilesXY.x - buffer->width;
}
Expand Down
1 change: 1 addition & 0 deletions src/cdogs/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#define MAP_ACCESSBITS 0x0F00


Tile tileNone = { NULL, { { 0, 0 }, { 0, 0 }, NULL }, 0, 0, NULL };
Tile gMap[YMAX][XMAX];


Expand Down
1 change: 1 addition & 0 deletions src/cdogs/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ typedef struct
TTileItem *things;
} Tile;

extern Tile tileNone;
extern Tile gMap[YMAX][XMAX];
#define Map( x, y) gMap[y][x]

Expand Down

0 comments on commit d3d28f2

Please sign in to comment.