Bug 353845 - Game number in status line wrong when loading a game from disk
Summary: Game number in status line wrong when loading a game from disk
Status: RESOLVED FIXED
Alias: None
Product: kmahjongg
Classification: Applications
Component: general (show other bugs)
Version: 0.8
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-13 05:55 UTC by Andreas Koenig
Modified: 2016-03-24 21:45 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Koenig 2015-10-13 05:55:35 UTC
Saving and Loading games works well in general except for the small detail, the game number displayed in the status line. It is not affected by loading a game, so reflecte the last game before loading the game.

Reproducible: Always

Steps to Reproduce:
1. Click Game->New to start a new game
2. Take note of the game number in the status line (for me: 1211087700)
3. Click Game->Save to save the game to a file (file name "1.kmgame")
4. Click Game->New to start a different game
5. Take note of the game number in the status line (for me: 1574007757)
6. Load the previously saved game from file
7. Take note of the game number in the status line (for me: 1574007757)


Actual Results:  
The game number stays the same when an old game is loaded from disk.

Expected Results:  
The status line should reflect what the engine knows about the displayed game. Either the original game number of the saved game or no game number at all. Displaying the wrong game number feels pretty wrong.
Comment 1 Dustin Steinack 2015-10-28 23:57:06 UTC
I proposed an patch fixing this issue on https://git.reviewboard.kde.org/r/125855/

Which is by the way my first contribution to a KDE project, so please be patient =)
Comment 2 Albert Astals Cid 2015-11-01 23:26:50 UTC
Git commit a2834e03c2e76f8582e17262d2d14cdc0e721b48 by Albert Astals Cid, on behalf of Dustin Steinack.
Committed on 01/11/2015 at 23:25.
Pushed by aacid into branch 'Applications/15.08'.

Save and load game number properly
REVIEW: 125855

M  +5    -0    boardwidget.cpp
M  +1    -0    boardwidget.h
M  +12   -0    kmahjongg.cpp

http://commits.kde.org/kmahjongg/a2834e03c2e76f8582e17262d2d14cdc0e721b48
Comment 3 Ian Wadham 2015-12-29 12:21:40 UTC
The commit that fixed this is on the master branch.  It applies to the files kmahjongg.cpp, boardwidget.h and boardwidget.cpp.

But boardwidget.h and boardwidget.cpp are discontinued in the frameworks (KF5) branch.

The fix will need to be re-applied to the appropriate files in the frameworks branch after it is merged to master.
Comment 4 Frederik Schwarzer 2016-01-04 21:39:40 UTC
This works for me in current master branch with Clubs and Chips, the latter containing 144 tiles overall and 142 when I saved the game.

Can you please check if yu can still reproduce in current master?
Comment 5 Andreas Koenig 2016-01-05 04:13:02 UTC
Branch "frameworks" is broken, "master" is good. Sorry for the omission.
Comment 6 Frederik Schwarzer 2016-01-05 05:42:49 UTC
The frameworks branch has been merged into master so the frameworks branch is not meant to be used anymore. However, this issue should have been fixed in frameworks branch from dd0be780f6 onwards, then saving is broken starting from 4c259f30d3 and then fixed again in c5c687c739 after the merge to master. :)

So closing this as it works in master. Feel free to reopen if you disagree.