git repos / saland

commit f3711c9d

sago007 · 2018-12-21 13:32
f3711c9d1838ea151d383fbc99aa3ae5722bd37d patch · browse files
parent 64cf663bb42553c553abf5388bc8b03ea29b5fc5

Write the correct height field to file

Changed files

M src/sagotmx/tmx_struct.h before
diff --git a/src/sagotmx/tmx_struct.h b/src/sagotmx/tmx_struct.h index 39cbff3..bd9a02d 100644 --- a/src/sagotmx/tmx_struct.h +++ b/src/sagotmx/tmx_struct.h
@@ -442,7 +442,7 @@ inline void xml_add_tileset(std::iostream& io, const TileMap& m, size_t tile_set
}
io << ">\n";
if (ts.image.source.length() > 0) {
- io << "<image source=\"" << ts.image.source << "\" width=\"" << ts.image.width << "\" hight=\"" << ts.image.height << "\"/>\n";
+ io << "<image source=\"" << ts.image.source << "\" width=\"" << ts.image.width << "\" height=\"" << ts.image.height << "\"/>\n";
}
io << "</tileset>\n";
}
@@ -556,6 +556,10 @@ inline void getTextureLocationFromGid(const TileMap& tm, int gid, std::string* i
if (imageFile) {
*imageFile = ts->image.source;
}
+ if (ts->image.width == 0) {
+ std::cerr << "image: " << ts->image.source << " (" << ts->image.width << ", " << ts->image.height << ") is not good\n";
+ abort();
+ }
if (x) {
*x = ( gid *ts->tilewidth)%ts->image.width;
}