yrpp-spawner icon indicating copy to clipboard operation
yrpp-spawner copied to clipboard

Add "CustomMissionID" for saved games

Open chaserli opened this issue 1 year ago • 7 comments

Implemented the updated requirements of issue #18

chaserli avatar Feb 19 '24 11:02 chaserli

Sorry, but I'm a bit confused. Are there any unclear passages in issue #18?

SadPencil avatar Feb 19 '24 11:02 SadPencil

Sorry, but I'm a bit confused. Are there any unclear passages in issue #18?

I just noticed the additional message on the issue page, sorry. So far I introduced 4 consecutive int32, indicating the CampaignID, total House count present, total Techno count present, total Anim count present, just for testing.

I'm not sure if the ScenarioNumber is eventually unused when the spawner is present, and since we can actually append more extra info on the file, why not recording more.

So far if you can manage the previous 4 bytes (int32) of the member Spawner MetaInfo, then you can set [Settings]CampaignID in spawn.ini to modify it.

chaserli avatar Feb 19 '24 12:02 chaserli

@chaserli When loading a saved game and saving the game again, the CampaignID is set to -1 instead of previous value in the .sav file if it is not specified in spawn.ini. Could you make the spawner read this value from .sav file first? (although the client is able to specify this value again, I think it is better to handle this in the spawner; for example users might load another mission inside the game, where the client is unable to interrupt)

Also, could be better if this value is an uint64. I use hash algorithm to generate such an ID so using an 8-byte unsigned integer is better than a signed number.


Besides, all the 4 values you introduced for testing work as intended. For the sake of ABI compatibility, could you just save the campaign ID (uint64) in an separate OLE key "Campaign ID"?

SadPencil avatar Feb 21 '24 03:02 SadPencil

yeah I'm aware of such issue. There's another problem: when finishing the current mission and proceeding to the next one, such ID should change according to your requirement, but I have no idea how to make that happen yet. I'll try to investigate when I have time later

chaserli avatar Feb 21 '24 10:02 chaserli

@chaserli You are right. pINI->ReadInteger does not support reading uint64 so I guess I have to use int32

SadPencil avatar Mar 05 '24 11:03 SadPencil

@chaserli You are right. pINI->ReadInteger does not support reading uint64 so I guess I have to use int32

Alright, I reverted that to int. Now Campaign ID appears in sav file only when its value is not 0

chaserli avatar Mar 07 '24 03:03 chaserli

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

github-actions[bot] avatar Mar 09 '24 13:03 github-actions[bot]