OpenLoco / ObjectEditor

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

Enforce Vanilla flag in the header #58

Open LeftofZen opened 3 months ago

LeftofZen commented 3 months ago

In the S5Header (as I've called it) there is an enum for the object 'source' (see SourceGame.cs), which can be Vanilla or Custom (or DataFile, but that's separate). Almost all custom objects I've come across mistakenly set this flag to Vanilla when it should of course be Custom. This tool will not tolerate that, so I should enforce upon object loading that this flag is automatically set to Custom for all non-Vanilla objects. All vanilla objects are listed in OriginalObjectFiles.cs.

LeftofZen commented 3 months ago

Thinking about this a bit more, this is a slippery slope. Every 'automatic' change I were to introduce into the editor, if then saved to the object, would end up creating multiple versions of each object. This could spiral out of control with the current dat file format which has no support for author or version.

As such, I think any automatic changes should be UI only, and the user gets a validation warning for it. When the new object format is finalised, which should include version or last edit date (either work), and author, this will allow proper versioning and auto-updating of 'fixed' or corrected objects.

LeftofZen commented 1 month ago

Thinking about this even more, this is possible to do nicely in the DAT format. What will need to happen is a mapping of original-checksum to new-checksum. This can be further improved by assigning unique names to objects, and using non-dat (ie new format) objects. Then, any number of dat files can be mapped to a single uniquely-named object which is the 'standard' version of that object.