Ruin0x11 / OpenNefia

(Archived) Moddable engine reimplementation of the Japanese roguelike Elona.
MIT License
116 stars 18 forks source link

Character references are unintentionally saved onto activity instances #348

Open Ruin0x11 opened 3 years ago

Ruin0x11 commented 3 years ago

If a map is saved with a character who is performing an activity, when it is loaded the reference to the character on the activity will not be loaded properly.

It's the same issue with mef origins not being saved properly. The solution I had there was to use the UID of the mef instead.

Ruin0x11 commented 3 years ago

I think the usage of Object.make_prototype() is what's at fault here. If the reference and ILocation containing it are saved together in one table (which should usually be the case), then binser should be able to reconnect the reference appropriately. It would still need some amount of checking to handle that not being the case, though.

Ruin0x11 commented 3 years ago

Maybe instead of requiring the user to correctly implement serialization, the serializer could detect common classes (like data_table) and save special metadata there.