From 14e8b66119a17ecb126368ee9efb02e4dead63ce Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sun, 17 Aug 2014 21:08:43 -0700 Subject: [PATCH] fix broken map generation --- stb_herringbone_wang_tile.h | 13 +++++++++---- tests/herringbone_map.c | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/stb_herringbone_wang_tile.h b/stb_herringbone_wang_tile.h index 1f81775..6ef0e60 100644 --- a/stb_herringbone_wang_tile.h +++ b/stb_herringbone_wang_tile.h @@ -1,4 +1,4 @@ -/* stbhw - v0.5 - http://nothings.org/gamedev/herringbone +/* stbhw - v0.6 - http://nothings.org/gamedev/herringbone Herringbone Wang Tile Generator - Sean Barrett 2014 - public domain This file is in the public domain. In case that declaration is ineffective, @@ -135,6 +135,11 @@ int main(int argc, char **argv) return 0; } +== VERSION HISTORY =================== + + 0.6 2014-08-17 - fix broken map-maker + 0.5 2014-07-07 - initial release + */ ////////////////////////////////////////////////////////////////////////////// @@ -484,9 +489,6 @@ static int stbhw__process_template(stbhw__process *p) return 0; } - for (j=0; j < p->h; ++j) - memset(p->data + j*p->stride, 255, 3*p->w); - if (c->is_corner) { ypos = 2; for (k=0; k < c->num_color[2]; ++k) { @@ -1184,6 +1186,9 @@ STBHW_EXTERN int stbhw_make_template(stbhw_config *c, unsigned char *data, int w p.process_v_rect = stbhw__edge_process_v_rect; } + for (i=0; i < p.h; ++i) + memset(p.data + i*p.stride, 255, 3*p.w); + if (!stbhw__process_template(&p)) return 0; diff --git a/tests/herringbone_map.c b/tests/herringbone_map.c index 11387d7..22cc013 100644 --- a/tests/herringbone_map.c +++ b/tests/herringbone_map.c @@ -29,7 +29,8 @@ int main(int argc, char **argv) pixels = stbi_load(filename, &w, &h, 0, 3); if (pixels == 0) { - fprintf(stderr, "Could open input file '%s'\n", filename); + fprintf(stderr, "Couldn't open input file '%s'\n", filename); + exit(1); } if (!stbhw_build_tileset_from_image(&ts, pixels, w*3, w, h)) {