Hardens painting saving against inconsistent state (#65024)

Should help when paintings lists gets zeroed unintentionally during the round for some reason.
Now it only deletes the painting file right before it writes the new file to prevent loss of data if anything runtimes or breaks.
This commit is contained in:
AnturK
2022-02-22 09:27:25 +00:00
committed by GitHub
parent 0e437d8f08
commit 81437eda3e
2 changed files with 23 additions and 4 deletions
+1
View File
@@ -47,6 +47,7 @@
fdel(png)
//Remove entry from paintings list
SSpersistent_paintings.paintings -= chosen_painting
SSpersistent_paintings.deleted_paintings_md5s |= chosen_painting.md5
SSpersistent_paintings.save_to_file() // Save now so we don't have broken variations if this round crashes
//Delete any painting instances in the current round
for(var/obj/structure/sign/painting/painting as anything in SSpersistent_paintings.painting_frames)