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

Saving game state #26

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

ondralukes
Copy link
Contributor

Fixed #5

@CodeforEvolution
Copy link

Thanks for your contribution! However, the method of saving progress may not be future proof for adding or removing extra saved settings. What I’d recommend is using a BMessage and the “Flatten” function to save it into a BFile. (There’s documentation at https://www.haiku-os.org/docs/api/. You’ll want to look in the Application Kit section for BMessage and the Storage Kit section for BFile)

@ondralukes
Copy link
Contributor Author

OK, I'll remake it

@ondralukes
Copy link
Contributor Author

Like this?

@CodeforEvolution
Copy link

This looks better, however there are a few more things to note:

@ondralukes
Copy link
Contributor Author

It's done but I've used AddUInt32 (not AddInt32 like you said), because fBoard and fPreviousBoard are uint32_t arrays

@CodeforEvolution
Copy link

That’s a whoops on me. Either way, this looks all good to me! Let me get @mmuman to take a look at this to actually get your changes approved.

@ondralukes
Copy link
Contributor Author

Great! Thanks for help!

@humdingerb
Copy link
Member

Maybe "Haiku2048_state" would be a nicer name than just "Save". Otherwise it seems to work fine after having a quick play.

@humdingerb
Copy link
Member

And the coding style doesn't fit to the rest, which at first glance looks like Haiku's coding style. Compare curly brackets and spaces etc.

dospuntos added a commit to dospuntos/Haiku2048 that referenced this pull request Mar 26, 2024
dospuntos added a commit to dospuntos/Haiku2048 that referenced this pull request Mar 26, 2024
dospuntos added a commit to dospuntos/Haiku2048 that referenced this pull request Mar 26, 2024
dospuntos added a commit to dospuntos/Haiku2048 that referenced this pull request Mar 26, 2024
@dospuntos dospuntos mentioned this pull request Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Save state when quitting
3 participants