View Single Post
Old January 31, 2020, 18:49   #8
eastwind
Apprentice
 
Join Date: Dec 2019
Location: Mexico, undisclosed location
Posts: 79
eastwind is on a distinguished road
Well, player->depth is already stored in the save file as a 16-bit, it's obj->origin_depth that's potentially too small and is the problem.

But taking your meaning,

what I could do is widen the in-memory obj->origin depth to 16 bits and continue to store it in the save as an 8-bit. The assert would then be on save, not load, the load would always work.

Having an assert on save isn't great, because you lose progress and potentially the character. But what it could do is just reduce the number silently. Since origin->depth is essentially a cosmetic value (it stores what level you found the item on but doesn't affect game play) anything you found past level 256 would be marked with the wrong level after you saved & restored.

so I could definitely solve it that way, if that's the consensus.

The thing is, this is just the first example of a problem that affects a yet-to-be-determined number of fields. You can see how many warnings there are in the OP, the next 2 size-mismatch warnings are for a different field, also in object, that one stores how many copies of the object you have. So again, things work because stacks are limited, but the code types are messed up.
eastwind is offline   Reply With Quote