I want to add new game states. (I think that's what they're called; I mean SHOFIXTI_VISITS, MAIDENS_ON_SHIP and the like.) I tried just going into globdata.h and adding them into the list in the same format as the existing ones, but when I ran it and went to load a savegame(I get to the screen where you choose a game to load; it does this when I choose one and hit enter), it brings up an error message:
Quote
Microsoft Visual C++ Debug Library Debug error!
Program: C:\build/sc2/uqmdebug.exe
This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
(Press Retry to debug the application)
Abort Retry Ignore
(If I hit Abort or Ignore, it just exits; if I hit Retry it does the "[program] has encountered a problem and needs to close... Please tell Microsoft about this problem. Send/Don't send" thing and closes.)
appears in the debug window. I looked at load.c and I don't understand what it's doing there--it kind of looks like it's checking that the number of bits allotted to those two is three more than divisible by four, but I don't see the significance. (Is that what it's actually doing? If so, why? If not, what?)
It's a sanity check. When saving, one extra byte of padding is written to align the data that follows on a multiple of 4 bytes. When loading, that extra byte needs to be read (or at least skipped), which is what the line after the assertion you mentioned does. The assertion just makes sure that that byte of padding is appropriate. The assertion being triggered indicates an inconsistency in the program.
By adding extra "states" you increased the size of GameState, and in this case it changed the amount of padding that is required to make that size a multiple of 4 bytes.
As your savegames will be incompatible with the straight UQM savegames anyhow, you might as well forget about padding altogether; the 4 byte alignment is just there to ensure compatibility with existing savegames and serves no other practical purpose anymore.
Logged
“When Juffo-Wup is complete when at last there is no Void, no Non when the Creators return then we can finally rest.”
Well, the assertion is still there, and the size of your GameState has changed. You can just rip out the assertion to make it work with your own save games. You can also rip out the saving and loading of padding altogether.
Logged
“When Juffo-Wup is complete when at last there is no Void, no Non when the Creators return then we can finally rest.”