You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
foo.loadMap(Assets.getText("assets/foo.txt"), "assets/my_image.png", x, y, FlxTilemap.OFF);
with a foo.txt that looks like:
0,0,0,0,0
1,0,0,0,0
0,0,0,0,0
0,0,0,0,0
1,1,1,1,1
~this is a newline character~
having a newline character at the end of the file (to make it a valid text file), which is allowed by the CSV format causes this call to silently fail.
On OSX under the neko and native target I'm getting back:
trace(foo.widthInTiles); // this prints 0
Looking into how FlxTilemap is implemented if the last line is a newline, it fails the whole call (silently).
To fix this, you need to call loadMap as such:
foo.loadMap(StringTools.rtrim(Assets.getText("assets/foo.txt")), "assets/my_image.png", x, y, FlxTilemap.OFF);
It seems like it would make more sense to have that call to StringTools.rtrim in loadMap, or at the very least throw an exception saying that whitespace isn't allowed at the end of the CSVs.
The text was updated successfully, but these errors were encountered:
This works fine on the dev branch, CSV parsing in general is a bit more robust there as there have been some fixes. I might release a 3.3.9 patch soon though, might as well include a fix for this.
I'm calling loadmap as such:
with a foo.txt that looks like:
having a newline character at the end of the file (to make it a valid text file), which is allowed by the CSV format causes this call to silently fail.
On OSX under the neko and native target I'm getting back:
Looking into how FlxTilemap is implemented if the last line is a newline, it fails the whole call (silently).
To fix this, you need to call loadMap as such:
It seems like it would make more sense to have that call to StringTools.rtrim in loadMap, or at the very least throw an exception saying that whitespace isn't allowed at the end of the CSVs.
The text was updated successfully, but these errors were encountered: