mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Merge pull request #24289 from xxalpha/mapmerge17
[map merger] Added try catch block to handle duplicate keys.
This commit is contained in:
@@ -74,7 +74,10 @@ def merge_map(newfile, backupfile, tgm):
|
|||||||
if new_tile == old_tile: #this tile is the exact same as before, so the old key is used
|
if new_tile == old_tile: #this tile is the exact same as before, so the old key is used
|
||||||
merged_grid[x,y] = old_key
|
merged_grid[x,y] = old_key
|
||||||
known_keys[new_key] = old_key
|
known_keys[new_key] = old_key
|
||||||
|
try:
|
||||||
unused_keys.remove(old_key)
|
unused_keys.remove(old_key)
|
||||||
|
except ValueError as ve_exception:
|
||||||
|
print("NOTICE: Correcting duplicate dictionary entry. ({})".format(new_key))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#the tile is different here, but if it exists in the old dictionary, its old key can be used
|
#the tile is different here, but if it exists in the old dictionary, its old key can be used
|
||||||
@@ -84,7 +87,7 @@ def merge_map(newfile, backupfile, tgm):
|
|||||||
known_keys[new_key] = newold_key
|
known_keys[new_key] = newold_key
|
||||||
try:
|
try:
|
||||||
unused_keys.remove(newold_key)
|
unused_keys.remove(newold_key)
|
||||||
except ValueError:
|
except ValueError as ve_exception:
|
||||||
print("NOTICE: Correcting duplicate dictionary entry. ({})".format(new_key))
|
print("NOTICE: Correcting duplicate dictionary entry. ({})".format(new_key))
|
||||||
|
|
||||||
#the tile is brand new and it needs a new key, but if the old key isn't being used any longer it can be used instead
|
#the tile is brand new and it needs a new key, but if the old key isn't being used any longer it can be used instead
|
||||||
|
|||||||
Reference in New Issue
Block a user