ID:97902
 
BYOND Version:471
Operating System:Windows 7 Home Basic 64-bit
Web Browser:Firefox 3.6.6
Applies to:Dream Seeker
Status: Deferred

This issue may be low priority or very difficult to fix, and has been put on the back burner for the time being.
Duplicates:id:97844
Descriptive Problem Summary:
Predefined directories, opposed to custom ones, are not being properly cropped in savefiles through using Remove. The directory entry is cut out, but the allocated file space remains constant.
You can witness the effect in this example.
  1. Click on 'RunTest' verb
  2. Compare file size of [ckey].sav, [ckey].txt, [ckey]over.sav, [ckey]over.txt, Test2.sav, Test2.txt, Test3.sav and Test3.txt with the respective output
  3. [ckey].sav and [ckey]over.sav should be of equal size, but are not


Numbered Steps to Reproduce Problem:
  1. Dynamically assign an atom an icon, overlay, or underlay
  2. Save the atom in a BYOND savefile
  3. Call Remove("icon","overlays","underlays") in the atom's Write procedure


Code Snippet (if applicable) to Reproduce Problem:
Test1
var/blah = 1

Test2
var/blah = 1
var/myIcon
Write(var/savefile/F)
..()
F.dir.Remove("myIcon")

Test3
var/blah = 1
var/myIcon

obj
ot
icon = 'ic.dmi'
icon_state = "f"

turf
default
icon = 'ic.dmi'

mob
icon = 'test.dmi'
Write(var/savefile/F)
..()
F.dir.Remove("icon","overlays","underlays")

proc
Test()
var/Test1/t = new()
t.blah = 5
var/savefile/F = new("Test1.sav")
F << t
var/Test2/p = new()
p.blah = 5
p.myIcon = 'ic.dmi'
var/savefile/Q = new("Test2.sav")
Q << p
var/Test3/r = new()
r.blah = 5
r.myIcon = 'ic.dmi'
var/savefile/S = new("Test3.sav")
S << r

TestRead()
var/savefile/F = new("Test2.sav")
var/txtfile1 = file("Test2.txt")
fdel(txtfile1)
F.ExportText("/",txtfile1)
src << "[html_encode(file2text(txtfile1))]"
src << "<br><br>"
var/savefile/G = new("Test3.sav")
var/txtfile2 = file("Test3.txt")
fdel(txtfile2)
G.ExportText("/",txtfile2)
src << "[html_encode(file2text(txtfile2))]"

MobOverlaySaveTest()
overlays += /obj/ot
var/savefile/F = new("[ckey]over.sav")
F["[ckey(name)]"] << src

MobOverlaySaveRead()
var/savefile/F = new("[ckey]over.sav")
var/txtfile1 = file("[ckey]over.txt")
fdel(txtfile1)
F.ExportText("/",txtfile1)
src << "[html_encode(file2text(txtfile1))]"

MobSaveTest()
var/savefile/F = new("[ckey].sav")
F["[ckey(name)]"] << src

MobSaveRead()
var/savefile/F = new("[ckey].sav")
var/txtfile1 = file("[ckey].txt")
fdel(txtfile1)
F.ExportText("/",txtfile1)
src << "[html_encode(file2text(txtfile1))]"

verb
RunTest()
Test()
TestRead()
MobSaveTest()
MobSaveRead()
MobOverlaySaveTest()
MobOverlaySaveRead()


Expected Results:
The resulting save fie should get cropped to accommodate for the new (less) content.

Actual Results:
The resulting save file stays constant in size.

The problem occurs:
Every time
In other user accounts - Midgetbuster
On other computers - Midgetbuster


Workarounds:
One would have to save, then export the save to a text file, delete the save, and create a new save from the text file.
On a related note, is it intended that despite an object used as overlay should take a 'snapshot', according to the reference, the save file is increased by the complete icon file and not just the icon_state in use?