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

Merge saving game state #36

Merged
merged 10 commits into from
Apr 1, 2024

Conversation

dospuntos
Copy link
Contributor

This PR is an attempt to complete a previous PR (#26 ) by fixing the comments on coding style. The original code seems to work great otherwise, and the game state and window position is saved when exiting the game.

Please let me know if there still are discrepancies in the coding style.

Copy link
Member

@humdingerb humdingerb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only small coding style fixes.
I recommend using "haiku-format". It also includes "git-haiku-format" to only re-format the touched parts.

Game.cpp Outdated Show resolved Hide resolved
Game.cpp Outdated Show resolved Hide resolved
Game.cpp Outdated Show resolved Hide resolved
Game.cpp Outdated Show resolved Hide resolved
Game.cpp Outdated Show resolved Hide resolved
Game.cpp Outdated Show resolved Hide resolved
Game.cpp Outdated
bool loadOK = true;

for(int i =0;i<fSizeX*fSizeY;i++) {
loadOK = loadOK && saveMessage.FindUInt32("board",i,&fBoard[i]) == B_OK;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tiring adding all those spaces... :)
Below, also add a space before commas etc.

WindowBoard.cpp Outdated Show resolved Hide resolved
WindowBoard.cpp Outdated Show resolved Hide resolved
WindowBoard.cpp Outdated Show resolved Hide resolved
@humdingerb
Copy link
Member

Two things I found:

  1. It'd be nice if the highscore window always popped up centered in the MainWindow coordinates or something.
  2. If you've finished a game, no more moves, the state should be removed. Currently, if you quit and re-launch the game, you'll be greeted by the old no-more-moves state.

Game.cpp Outdated

BMessage saveMessage(H2048_SAVE_MESSAGE);
status_t result = saveMessage.Unflatten(&saveFile);
if(result!= B_OK) {
if (result != B_OK)
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed the closing curly bracket.

@humdingerb
Copy link
Member

Very good. Merge!

@humdingerb humdingerb merged commit 42b95e9 into HaikuArchives:master Apr 1, 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.

4 participants