Преглед на файлове

fix broken map generation

Sean Barrett преди 11 години
родител
ревизия
14e8b66119
променени са 2 файла, в които са добавени 11 реда и са изтрити 5 реда
  1. 9 4
      stb_herringbone_wang_tile.h
  2. 2 1
      tests/herringbone_map.c

+ 9 - 4
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;
 

+ 2 - 1
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)) {