Skip to content

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Apr 20, 2024
1 parent b67623b commit 87a8543
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
22 changes: 12 additions & 10 deletions Scenes/OpenMap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ func continue_load(map):
oScriptHelpers.start()

# update_editor_data
if Slabset.dat.empty() == true: Slabset.load_default_slabset()
if Columnset.cubes.empty() == true: Columnset.load_default_columnset()
if Slabset.dat.empty() == true:
Slabset.load_default_slabset()
if Columnset.cubes.empty() == true:
Columnset.load_default_columnset()

oOverheadGraphics.update_full_overhead_map()

Expand All @@ -222,14 +224,6 @@ func continue_load(map):

oMenu.add_recent(map)

# When opening a map, be sure that column 0 is empty. Otherwise apply a fix.
if oDataClm.permanent[0] != 0 or oDataClm.cubes[0] != [0,0,0,0, 0,0,0,0]:
# Make column 0 empty while preserving the column that was there.
oDataClm.sort_columns_by_utilized()
oDataClm.delete_column(0)
oEditor.mapHasBeenEdited = true
oMessage.quick("Fixed column index 0, re-save your map.")

oDataClm.store_default_data()


Expand Down Expand Up @@ -259,6 +253,14 @@ func continue_load_openmap(map):
else:
oMessage.quick('Opened map')

# When opening a map, be sure that column 0 is empty. Otherwise apply a fix.
if oDataClm.permanent[0] != 0 or oDataClm.cubes[0] != [0,0,0,0, 0,0,0,0]:
# Make column 0 empty while preserving the column that was there.
oDataClm.sort_columns_by_utilized()
oDataClm.delete_column(0)
oEditor.mapHasBeenEdited = true
oMessage.quick("Fixed column index 0, re-save your map.")


func _on_ConfirmDecompression_confirmed():
print('Attempting to decompress...')
Expand Down
12 changes: 8 additions & 4 deletions Scenes/OverheadGraphics.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ onready var oTextureCache = Nodelist.list["oTextureCache"]
onready var oDataLevelStyle = Nodelist.list["oDataLevelStyle"]
onready var oUndoStates = Nodelist.list["oUndoStates"]
onready var oQuickMapPreviewDisplay = Nodelist.list["oQuickMapPreviewDisplay"]
onready var oMessage = Nodelist.list["oMessage"]


signal graphics_thread_completed

Expand Down Expand Up @@ -92,10 +94,12 @@ func multi_threaded():
print("graphics multi_threaded end")

func thread_done(resulting_pixel_data):
pixel_data = resulting_pixel_data
overheadImgData.create_from_data(M.xSize * 3, M.ySize * 3, false, Image.FORMAT_RGB8, pixel_data)

overheadTexData.create_from_image(overheadImgData, 0)
if resulting_pixel_data != null:
pixel_data = resulting_pixel_data
overheadImgData.create_from_data(M.xSize * 3, M.ySize * 3, false, Image.FORMAT_RGB8, pixel_data)
overheadTexData.create_from_image(overheadImgData, 0)
else:
oMessage.quick("thread crashed")

thread_currently_processing = false
emit_signal("graphics_thread_completed")
Expand Down

0 comments on commit 87a8543

Please sign in to comment.