Исправление распаковки из json id цели при загрузке из файла.

This commit is contained in:
MaD_CaT
2025-04-25 10:58:42 +03:00
parent 8e256b07ca
commit c00d9b8429

View File

@@ -302,12 +302,14 @@ func load_treats(table):
var json_data = json_conv.get_data() var json_data = json_conv.get_data()
for item in json_data: for item in json_data:
if item.has('id'): if item.has('id'):
var id = item['id'] var id = int(item['id'])
id_array.erase(int(id)) id_array.erase(int(id))
var threat : = Threat.new(id, table.get_rows_count()) var threat : = Threat.new(id, table.get_rows_count())
treats['%d' % id] = threat treats['%d' % id] = threat
for key in item: for key in item:
threat.row[key] = [item[key], true] if key == 'id': threat.row[key] = [int(item[key]), true]
elif key == 'tick': threat.row[key] = [int(item[key]), true]
else: threat.row[key] = [item[key], true]
var row = threat.update_rows() var row = threat.update_rows()
table.add_row(TABLE_ROW_TYPES) table.add_row(TABLE_ROW_TYPES)
table.set_row_text(table.get_rows_count()-1, row) table.set_row_text(table.get_rows_count()-1, row)