Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add/remove buildings correctly #60

Open
Slattz opened this issue Apr 28, 2019 · 1 comment
Open

How to add/remove buildings correctly #60

Slattz opened this issue Apr 28, 2019 · 1 comment

Comments

@Slattz
Copy link
Contributor

Slattz commented Apr 28, 2019

Hey, so there's currently an issue with adding and removing PWPs that can end up breaking peoples saves due to invalid building amounts. The game assume there's 58 town PWP Slots where there's actually 56 Town PWP Slots and 2 Event PWP Slots (i.e. ones on the town plaza).
The Event PWP Slots should not be used and should be kept free. Or it should be implemented correctly so that only Event PWPs can go in those slots and it uses the Event PWPs amount byte.

As seen here in my WIP save structure, the Town PWPs and Event PWPs each have their own byte for the amount of them currently in the save.

Also, it'd probably be a good idea to recalculate how many buildings the user has (i.e. how many of the buildings aren't 0xFC) upon saving, or instead of reading the value, just calculate how many they have when loading the save rather than reading from the save. It'll fix saves that might have been previously broken and prevent this very common issue.

@marcrobledo
Copy link
Owner

marcrobledo commented May 1, 2019

Indeed, the editor always try to add buildings from slot 56 backwards (leaving 57 and 58 for events). I coded the editor some years ago and I could not remember this, but after checking the code lately, the limit was already there, so I did something well after all :-D

The building counter was also there, but broken somehow. Your contribution is appreciated, this is going to fix those building problems that some user get randomly, I hope this is once and for all.

I implemented an automatic fix when opening the glitched savegame in 916f432 along with other fixes aswell.

And I'm gonna toy with building removing now that the counter works correctly.

@marcrobledo marcrobledo changed the title PWPs not read/written correctly How to add/remove buildings correctly May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants