OpenLoco / ObjectEditor

A modern implementation of 'LocoTool' for dat file parsing
7 stars 2 forks source link

Saving a DAT file does not save the changes #118

Closed FenderBender2 closed 2 hours ago

FenderBender2 commented 3 hours ago

I'm using v3.4.1 of the editor to try and change the design year of a wagon. I have saved the updated file, which now has a new modifed date, but the change doesn't seem to 'stick'. When I restart the editor and look at Object->Stats the design year has not changed, and neither has the checksum.

How to I get my changes to be permanently saved?

LeftofZen commented 2 hours ago

Hmm I've had multiple people mention this but I've never seen the issue myself. What happens if you try to make the same change and save it again? Does it fail repeatedly? Is it only with vehicles?

LeftofZen commented 2 hours ago

Oh I just tried this and it really isn't saving the design year, interesting, I'll investigate but it looks like a bug. Thanks for reporting!

LeftofZen commented 2 hours ago

Oh I think I know. When I made the change to get all the list properties working, I had to make an entire viewmodel wrapping the vehicle object, and pass in all the values. This works and editing the UI updates the lists because they're passed in by reference. The basic properties like speed, year etc are NOT passed in by reference though - they're copied - meaning any changes in the UI need to be copied back to save the object. Fixing this properly requires a rewrite of the whole object saving code, but for now I'll hardcode it so it works

FenderBender2 commented 2 hours ago

Thanks @LeftofZen for the swift response. 👍