diff --git a/tmx.sex b/tmx.sex index cf36885..52ea7e6 100644 --- a/tmx.sex +++ b/tmx.sex @@ -71,6 +71,25 @@ (tile-height int))) (pub fn load-tmx ((file (* const char))) (* tmx-map) + ;; raytmx does not support Tiled infinite maps: their data makes + ;; its CSV parser read past a fixed-size stack buffer. Reject them with a + ;; useful message instead of crashing inside the parser. + (var raw (* char) (LoadFileText file)) + (if (== raw NULL) + (do + (TraceLog LOG-ERROR "failed to read TMX \"%s\"" file) + (return NULL))) + (var is-infinite (* char) (strstr raw "infinite=\"1\"")) + (var has-chunks (* char) (strstr raw "