summaryrefslogtreecommitdiff
path: root/hercules
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-03-01 20:57:51 -0300
committerJesusaves <cpntb1@ymail.com>2021-03-01 20:57:51 -0300
commit113b38189960be1acb388a6dd344230cee96c979 (patch)
treeff47d1fa671d66efcb18e4d77c78558d42e3b965 /hercules
parent14e72a039dd7d9921cb292967e5d58a3af080baf (diff)
downloadtools-113b38189960be1acb388a6dd344230cee96c979.tar.gz
tools-113b38189960be1acb388a6dd344230cee96c979.tar.bz2
tools-113b38189960be1acb388a6dd344230cee96c979.tar.xz
tools-113b38189960be1acb388a6dd344230cee96c979.zip
TMX Converter: Do not explode and exit with code 1 if a map is corrupted.
Diffstat (limited to 'hercules')
-rwxr-xr-xhercules/tmx_converter.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py
index 8a34a06..96a37d9 100755
--- a/hercules/tmx_converter.py
+++ b/hercules/tmx_converter.py
@@ -32,6 +32,7 @@ import sys
import os
import posixpath
import xml.sax
+import traceback
dump_all = False # wall of text
check_mobs = False # mob_db.txt
@@ -625,11 +626,16 @@ def main(argv):
main.this_map_npc_dir = posixpath.join(npc_dir, base)
os.path.isdir(main.this_map_npc_dir) or os.mkdir(main.this_map_npc_dir)
print('Converting %s' % (tmx))
- with open(posixpath.join(main.this_map_npc_dir, NPC_MOBS), 'w') as mobs:
+ try:
+ with open(posixpath.join(main.this_map_npc_dir, NPC_MOBS), 'w') as mobs:
with open(posixpath.join(main.this_map_npc_dir, NPC_CONFIG), 'w') as confs:
with open(posixpath.join(main.this_map_npc_dir, NPC_WARPS), 'w') as warps:
with open(posixpath.join(main.this_map_npc_dir, NPC_IMPORTS), 'w') as imports:
xml.sax.parse(tmx, ContentHandler(main.this_map_npc_dir, mobs, confs, warps, imports))
+ except:
+ traceback.print_exc()
+ print("ERROR: MAP \"%s\" WAS NOT CONVERTED. ERROR FOUND!" % tmx)
+ fatalError=True
if os.path.isfile(posixpath.join(main.this_map_npc_dir, NPC_IMPORTS)):
npc_master.append('@include "%s"\n' % posixpath.join(SERVER_NPCS, base, NPC_IMPORTS))
if heigherror: