summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-11-04 20:22:00 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-11-04 20:23:42 -0800
commit01cb2cceae3a179d3b18107a41580f8171712854 (patch)
treec900de53925188804726ce1c15a3035fc5e34eb5
parent892ea43622c7fe1868aa3507d7ff1b2dd3ccedd5 (diff)
downloadtools-01cb2cceae3a179d3b18107a41580f8171712854.tar.gz
tools-01cb2cceae3a179d3b18107a41580f8171712854.tar.bz2
tools-01cb2cceae3a179d3b18107a41580f8171712854.tar.xz
tools-01cb2cceae3a179d3b18107a41580f8171712854.zip
Truncate warp names
-rwxr-xr-xtmx_converter.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tmx_converter.py b/tmx_converter.py
index d25430a..37a0234 100755
--- a/tmx_converter.py
+++ b/tmx_converter.py
@@ -276,11 +276,14 @@ class ContentHandler(xml.sax.ContentHandler):
obj.dest_tile_x = obj.dest_x / 32;
obj.dest_tile_y = obj.dest_y / 32;
+ obj_name = obj.name[:23]
+ if obj.name != obj_name:
+ print('Warning: warp name truncated: %r -> %r' % (obj.name, obj_name))
self.warps.write(
SEPARATOR.join([
'%s.gat,%d,%d' % (self.base, obj.x, obj.y),
'warp',
- obj.name,
+ obj_name,
'%d,%d,%s.gat,%d,%d\n' % (obj.w, obj.h, obj.dest_map, obj.dest_tile_x, obj.dest_tile_y),
])
)