summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwushin <pasekei@gmail.com>2015-02-28 19:39:58 -0600
committerwushin <pasekei@gmail.com>2015-02-28 19:39:58 -0600
commita49ce96049a70e35336e93814282287039b9fa31 (patch)
treea4cf336915f73754f150cd38cb9d49c54f99dd9f
parent1e5f884636e4f96ab39dd38866544f9cd9668d74 (diff)
downloadtools-a49ce96049a70e35336e93814282287039b9fa31.tar.gz
tools-a49ce96049a70e35336e93814282287039b9fa31.tar.bz2
tools-a49ce96049a70e35336e93814282287039b9fa31.tar.xz
tools-a49ce96049a70e35336e93814282287039b9fa31.zip
Make Maps rebuild less
-rwxr-xr-xtmx_converter.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tmx_converter.py b/tmx_converter.py
index 6910176..121264e 100755
--- a/tmx_converter.py
+++ b/tmx_converter.py
@@ -133,6 +133,7 @@ class ContentHandler(xml.sax.ContentHandler):
self.imports = imports
self.object = None
self.mob_ids = set()
+ self.name_unique = 0;
def setDocumentLocator(self, loc):
self.locator = loc
@@ -265,10 +266,10 @@ class ContentHandler(xml.sax.ContentHandler):
])
)
elif isinstance(obj, Warp):
- obj_name = obj.name[:19]
+ obj_name = obj.name[:15]
if obj.name != obj_name:
print('Warning: warp name truncated: %r -> %r' % (obj.name, obj_name))
- obj_name += "#" + str(main.name_unique)
+ obj_name += "#%s%d" % (self.base,self.name_unique)
self.warps.write(
SEPARATOR.join([
'%s,%d,%d' % (self.base, obj.x, obj.y),
@@ -277,7 +278,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
+ self.name_unique += 1
if name == u'data':
if self.state is State.DATA:
@@ -319,7 +320,6 @@ 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 = {}