summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwushin <pasekei@gmail.com>2015-02-14 21:15:15 -0600
committerwushin <pasekei@gmail.com>2015-02-14 21:15:15 -0600
commit1e5f884636e4f96ab39dd38866544f9cd9668d74 (patch)
tree307cc0ea2c9a437e1de937a978cc85eeb4e24340
parent25b7f28166bcafcfae21bff3abd1ae87c51b60ca (diff)
downloadtools-1e5f884636e4f96ab39dd38866544f9cd9668d74.tar.gz
tools-1e5f884636e4f96ab39dd38866544f9cd9668d74.tar.bz2
tools-1e5f884636e4f96ab39dd38866544f9cd9668d74.tar.xz
tools-1e5f884636e4f96ab39dd38866544f9cd9668d74.zip
Make all warps unique
-rwxr-xr-xtmx_converter.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tmx_converter.py b/tmx_converter.py
index 9f9da39..6910176 100755
--- a/tmx_converter.py
+++ b/tmx_converter.py
@@ -265,9 +265,10 @@ class ContentHandler(xml.sax.ContentHandler):
])
)
elif isinstance(obj, Warp):
- obj_name = obj.name[:23]
+ obj_name = obj.name[:19]
if obj.name != obj_name:
print('Warning: warp name truncated: %r -> %r' % (obj.name, obj_name))
+ obj_name += "#" + str(main.name_unique)
self.warps.write(
SEPARATOR.join([
'%s,%d,%d' % (self.base, obj.x, obj.y),
@@ -276,6 +277,7 @@ class ContentHandler(xml.sax.ContentHandler):
'%d,%d,%s,%d,%d\n' % (obj.w, obj.h, obj.dest_map, obj.dest_tile_x, obj.dest_tile_y),
])
)
+ main.name_unique += 1
if name == u'data':
if self.state is State.DATA:
@@ -317,6 +319,7 @@ def main(argv):
tmx_dir = posixpath.join(client_data, CLIENT_MAPS)
wlk_dir = posixpath.join(server_data, SERVER_WLK)
npc_dir = posixpath.join(server_data, SERVER_NPCS)
+ main.name_unique = 0;
if check_mobs:
global mob_names
mob_names = {}