Skip to content

Commit 7c4acbb

Browse files
committed
Merge branch '1.7.1' into develop
2 parents 1f70874 + 99263c8 commit 7c4acbb

15 files changed

+294
-63
lines changed

Little Go.xcodeproj/project.pbxproj

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@
666666
CDD48FB01413E95500188B6A /* CommandBase.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD48FAF1413E95500188B6A /* CommandBase.m */; };
667667
CDD48FC01414038000188B6A /* CommandProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD48FBF1414038000188B6A /* CommandProcessor.m */; };
668668
CDD4901B14141BCF00188B6A /* CommandProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD48FBF1414038000188B6A /* CommandProcessor.m */; };
669+
CDD67B6C28DDEC4F00F5196A /* NSObjectAddtions.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD67B6A28DDEC4F00F5196A /* NSObjectAddtions.m */; };
670+
CDD67B6D28DDEC4F00F5196A /* NSObjectAddtions.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD67B6A28DDEC4F00F5196A /* NSObjectAddtions.m */; };
669671
CDD7D7E5175257850068CBBA /* ResetPlayersAndProfilesCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD7D7E4175257850068CBBA /* ResetPlayersAndProfilesCommand.m */; };
670672
CDD86B4A2827E91500AA0A6B /* StaticTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD86B482827E91400AA0A6B /* StaticTableView.m */; };
671673
CDD86B4B2827E91500AA0A6B /* StaticTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD86B482827E91400AA0A6B /* StaticTableView.m */; };
@@ -1546,6 +1548,8 @@
15461548
CDD48FAF1413E95500188B6A /* CommandBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommandBase.m; sourceTree = "<group>"; };
15471549
CDD48FBE1414038000188B6A /* CommandProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandProcessor.h; sourceTree = "<group>"; };
15481550
CDD48FBF1414038000188B6A /* CommandProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommandProcessor.m; sourceTree = "<group>"; };
1551+
CDD67B6A28DDEC4F00F5196A /* NSObjectAddtions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSObjectAddtions.m; sourceTree = "<group>"; };
1552+
CDD67B6B28DDEC4F00F5196A /* NSObjectAddtions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSObjectAddtions.h; sourceTree = "<group>"; };
15491553
CDD7D7E3175257850068CBBA /* ResetPlayersAndProfilesCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResetPlayersAndProfilesCommand.h; sourceTree = "<group>"; };
15501554
CDD7D7E4175257850068CBBA /* ResetPlayersAndProfilesCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResetPlayersAndProfilesCommand.m; sourceTree = "<group>"; };
15511555
CDD7D7E61753F3FD0068CBBA /* NOTES.Build.3rdparty */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NOTES.Build.3rdparty; sourceTree = "<group>"; };
@@ -3194,6 +3198,8 @@
31943198
CD2230B225E661E600187C57 /* LogFormatter.m */,
31953199
CD1E6EA92860F0BC00785E23 /* MarkupUtilities.h */,
31963200
CD1E6EA82860F0BC00785E23 /* MarkupUtilities.mm */,
3201+
CDD67B6B28DDEC4F00F5196A /* NSObjectAddtions.h */,
3202+
CDD67B6A28DDEC4F00F5196A /* NSObjectAddtions.m */,
31973203
CDFA4AD013F71859001A2A94 /* NSStringAdditions.h */,
31983204
CDFA4AD113F71859001A2A94 /* NSStringAdditions.m */,
31993205
CDFA32A615A0A3E400439B4E /* PathUtilities.h */,
@@ -3971,6 +3977,7 @@
39713977
CD1E6EAF2865F9BD00785E23 /* PanGestureHandler.m in Sources */,
39723978
CDEE19F919433EAC00DF2389 /* BoardViewLayerDelegateBase.m in Sources */,
39733979
CD1F503F25B7A5C20098037A /* ViewLoadResultMessageController.m in Sources */,
3980+
CDD67B6C28DDEC4F00F5196A /* NSObjectAddtions.m in Sources */,
39743981
CDE302891360BDA4005235F2 /* Player.m in Sources */,
39753982
CDE3028A1360BDA4005235F2 /* PlayerModel.m in Sources */,
39763983
CDE3028B1360BDA4005235F2 /* PlayerStatistics.m in Sources */,
@@ -4255,6 +4262,7 @@
42554262
CDFABF5C141D343B0065C93B /* CommandBase.m in Sources */,
42564263
CDEE19FC19433EAC00DF2389 /* GridLayerDelegate.m in Sources */,
42574264
CD05A9E81422B01600214BBE /* ComputerPlayMoveCommand.m in Sources */,
4265+
CDD67B6D28DDEC4F00F5196A /* NSObjectAddtions.m in Sources */,
42584266
CDEE1A0419438AE000DF2389 /* StonesLayerDelegate.m in Sources */,
42594267
CD7C6A161AB49631009EC5AD /* BoardPositionCollectionViewController.m in Sources */,
42604268
CD05AB97142516A400214BBE /* GoUtilities.m in Sources */,
@@ -4465,13 +4473,13 @@
44654473
CODE_SIGN_ENTITLEMENTS = resource/plist/Entitlements.plist;
44664474
CODE_SIGN_IDENTITY = "iPhone Developer";
44674475
CODE_SIGN_STYLE = Automatic;
4468-
CURRENT_PROJECT_VERSION = 24;
4476+
CURRENT_PROJECT_VERSION = 26;
44694477
DEVELOPMENT_TEAM = "";
44704478
EXCLUDED_SOURCE_FILE_NAMES = "GoogleService-Info.plist";
44714479
GCC_PRECOMPILE_PREFIX_HEADER = YES;
44724480
GCC_PREFIX_HEADER = src/main/Prefix.pch;
44734481
INFOPLIST_FILE = resource/plist/Info.plist;
4474-
MARKETING_VERSION = 1.7.0;
4482+
MARKETING_VERSION = 1.7.1;
44754483
PRODUCT_BUNDLE_IDENTIFIER = ch.herzbube.littlego;
44764484
PRODUCT_NAME = "Little Go";
44774485
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -4487,12 +4495,12 @@
44874495
CODE_SIGN_ENTITLEMENTS = resource/plist/Entitlements.plist;
44884496
CODE_SIGN_IDENTITY = "iPhone Developer";
44894497
CODE_SIGN_STYLE = Automatic;
4490-
CURRENT_PROJECT_VERSION = 24;
4498+
CURRENT_PROJECT_VERSION = 26;
44914499
DEVELOPMENT_TEAM = "";
44924500
GCC_PRECOMPILE_PREFIX_HEADER = YES;
44934501
GCC_PREFIX_HEADER = src/main/Prefix.pch;
44944502
INFOPLIST_FILE = resource/plist/Info.plist;
4495-
MARKETING_VERSION = 1.7.0;
4503+
MARKETING_VERSION = 1.7.1;
44964504
PRODUCT_BUNDLE_IDENTIFIER = ch.herzbube.littlego;
44974505
PRODUCT_NAME = "Little Go";
44984506
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -4695,12 +4703,12 @@
46954703
CODE_SIGN_ENTITLEMENTS = resource/plist/Entitlements.plist;
46964704
CODE_SIGN_IDENTITY = "iPhone Developer";
46974705
CODE_SIGN_STYLE = Automatic;
4698-
CURRENT_PROJECT_VERSION = 24;
4706+
CURRENT_PROJECT_VERSION = 26;
46994707
DEVELOPMENT_TEAM = "";
47004708
GCC_PRECOMPILE_PREFIX_HEADER = YES;
47014709
GCC_PREFIX_HEADER = src/main/Prefix.pch;
47024710
INFOPLIST_FILE = resource/plist/Info.plist;
4703-
MARKETING_VERSION = 1.7.0;
4711+
MARKETING_VERSION = 1.7.1;
47044712
PRODUCT_BUNDLE_IDENTIFIER = ch.herzbube.littlego;
47054713
PRODUCT_NAME = "Little Go";
47064714
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -5019,12 +5027,12 @@
50195027
CODE_SIGN_ENTITLEMENTS = resource/plist/Entitlements.plist;
50205028
CODE_SIGN_IDENTITY = "iPhone Developer";
50215029
CODE_SIGN_STYLE = Automatic;
5022-
CURRENT_PROJECT_VERSION = 24;
5030+
CURRENT_PROJECT_VERSION = 26;
50235031
DEVELOPMENT_TEAM = "";
50245032
GCC_PRECOMPILE_PREFIX_HEADER = YES;
50255033
GCC_PREFIX_HEADER = src/main/Prefix.pch;
50265034
INFOPLIST_FILE = resource/plist/Info.plist;
5027-
MARKETING_VERSION = 1.7.0;
5035+
MARKETING_VERSION = 1.7.1;
50285036
PRODUCT_BUNDLE_IDENTIFIER = ch.herzbube.littlego;
50295037
PRODUCT_NAME = "Little Go";
50305038
PROVISIONING_PROFILE_SPECIFIER = "";

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Little Go is released under the [Apache License](http://www.apache.org/licenses/
99

1010
## Changes in this release
1111

12-
This is the Little Go feature release 1.7.0. A selection of the most important changes are:
12+
This is the Little Go bugfix release 1.7.1. It contains two fixes for bugs that caused the app to crash (#397 and #398).
13+
14+
The previous release was the Little Go feature release 1.7.0. A selection of the most important changes are:
1315

1416
- The app now supports reading and writing of all SGF node annotation and move annotation properties (#339). The app also displays these properties' values and lets you edit them. This means that you can now add a valuation to a move (e.g. good/bad move) and/or to the entire board position (e.g. good position for black/white), designate a board position to be a "hotspot" (e.g. it contains a game-deciding move), annotate a board position with an estimated score, and finally you can add textual notes to a board position. Annotation data is displayed by, and can be edited via, an all-new annotation view.
1517
- The app now supports reading and writing of all SGF markup properties (#349). Except for the DD property (dim parts of the board), the app also displays these properties' values and lets you edit them. This means that you can now mark intersections on the board with 5 different symbols (circle, square, triangle, "X" mark, "selected" symbol), place single-character letter markers or single-digit number markers, place a free-form label text, and finally you can draw arrows or plain lines on the board. The app has an all-new markup editing mode for this (accessible via menu icon) that includes drag & drop support to move around existing markup.

doc/ChangeLog

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
--------------------------------------------------------------------------------
2+
Version 1.7.1 (September 23 2022)
3+
--------------------------------------------------------------------------------
4+
========
5+
Features
6+
========
7+
- None
8+
9+
========
10+
Bugfixes
11+
========
12+
- Fixed app crash when board position cells are reused after a new game is
13+
started or loaded from the archive (#397).
14+
- The app no longer crashes when the user performs a board setup operation (e.g.
15+
places a setup stone) and the game has ended without any move because a player
16+
immediately resigned without playing a move (#398).
17+
18+
===========
19+
Regressions
20+
===========
21+
- None
22+
23+
=================
24+
Technical changes
25+
=================
26+
- None
27+
28+
=================
29+
GitHub issue list
30+
=================
31+
A list of all issues closed for this release is available on GitHub:
32+
https://github.com/herzbube/littlego/milestone/22?closed=1
33+
34+
135
--------------------------------------------------------------------------------
236
Version 1.7.0 (September 16 2022)
337
--------------------------------------------------------------------------------

src/command/boardposition/ChangeAndDiscardCommand.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
/// current board position, possibly the position that precedes it, and all
2525
/// positions that follow afterwards. As a side effect, the current board
2626
/// position changes to the one preceding the ones that were just discarded.
27+
/// The second responsibility of ChangeAndDiscardCommand is to revert the game
28+
/// state to "in progress" if the game is currently ended.
2729
///
2830
/// If the user preference DiscardMyLastMove is turned on (the default) and the
2931
/// current board position was created by a computer player's move, then all
@@ -34,10 +36,14 @@
3436
/// player moves.
3537
///
3638
/// If there is only one board position (i.e. no moves have been made yet and
37-
/// no other nodes have been created yet), ChangeAndDiscardCommand does nothing.
39+
/// no other nodes have been created yet), ChangeAndDiscardCommand reverts the
40+
/// game state to "in progress" if the game is currently ended (e.g. if a player
41+
/// resigned immediately without playing a move). If the game is not currently
42+
/// ended, ChangeAndDiscardCommand does nothing.
3843
///
39-
/// After it has made the discard, ChangeAndDiscardCommand performs a backup
40-
/// of the current game.
44+
/// After it has made the discard and/or reverted the game state to
45+
/// "in progress", ChangeAndDiscardCommand performs a backup of the current
46+
/// game.
4147
///
4248
/// @note The first board position represents the start of the game and cannot
4349
/// be discarded. Therefore, if ChangeAndDiscardCommand is executed when the

src/command/boardposition/ChangeAndDiscardCommand.m

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,56 @@ @implementation ChangeAndDiscardCommand
4040
- (bool) doIt
4141
{
4242
bool shouldDiscardBoardPositions = [self shouldDiscardBoardPositions];
43-
if (! shouldDiscardBoardPositions)
43+
bool shouldRevertGameStateToInProgress = [self shouldRevertGameStateToInProgress];
44+
if (! shouldDiscardBoardPositions && ! shouldRevertGameStateToInProgress)
4445
return true;
4546

4647
@try
4748
{
4849
[[ApplicationStateManager sharedManager] beginSavePoint];
4950
[[LongRunningActionCounter sharedCounter] increment];
5051

52+
bool success;
53+
5154
// Before we discard, first change to a board position that will be valid
5255
// even after the discard.
53-
bool success = [self changeBoardPosition];
54-
if (! success)
56+
if (shouldDiscardBoardPositions)
5557
{
56-
DDLogError(@"%@: Aborting because changeBoardPosition failed", [self shortDescription]);
57-
return false;
58+
success = [self changeBoardPositionIfNecessary];
59+
if (! success)
60+
{
61+
DDLogError(@"%@: Aborting because changeBoardPositionIfNecessary failed", [self shortDescription]);
62+
return false;
63+
}
5864
}
59-
success = [self revertGameStateIfNecessary];
60-
if (! success)
65+
66+
if (shouldRevertGameStateToInProgress)
6167
{
62-
DDLogError(@"%@: Aborting because revertGameStateIfNecessary failed", [self shortDescription]);
63-
return false;
68+
success = [self revertGameStateIfNecessary];
69+
if (! success)
70+
{
71+
DDLogError(@"%@: Aborting because revertGameStateIfNecessary failed", [self shortDescription]);
72+
return false;
73+
}
6474
}
65-
success = [self discardNodes];
66-
if (! success)
75+
76+
if (shouldDiscardBoardPositions)
6777
{
68-
DDLogError(@"%@: Aborting because discardNodes failed", [self shortDescription]);
69-
return false;
78+
success = [self discardNodesIfNecessary];
79+
if (! success)
80+
{
81+
DDLogError(@"%@: Aborting because discardNodesIfNecessary failed", [self shortDescription]);
82+
return false;
83+
}
7084
}
85+
7186
success = [self backupGame];
7287
if (! success)
7388
{
7489
DDLogError(@"%@: Aborting because backupGame failed", [self shortDescription]);
7590
return false;
7691
}
92+
7793
return success;
7894
}
7995
@finally
@@ -98,10 +114,20 @@ - (bool) shouldDiscardBoardPositions
98114
return true;
99115
}
100116

117+
// -----------------------------------------------------------------------------
118+
/// @brief Private helper for doIt(). Returns true if the game state needs to
119+
/// be reverted to "in progress", false otherwise.
120+
// -----------------------------------------------------------------------------
121+
- (bool) shouldRevertGameStateToInProgress
122+
{
123+
GoGame* game = [GoGame sharedGame];
124+
return (game.state == GoGameStateGameHasEnded);
125+
}
126+
101127
// -----------------------------------------------------------------------------
102128
/// @brief Private helper for doIt(). Returns true on success, false on failure.
103129
// -----------------------------------------------------------------------------
104-
- (bool) changeBoardPosition
130+
- (bool) changeBoardPositionIfNecessary
105131
{
106132
GoBoardPosition* boardPosition = [GoGame sharedGame].boardPosition;
107133
if (boardPosition.currentBoardPosition == 0)
@@ -175,14 +201,20 @@ - (bool) revertGameStateIfNecessary
175201
// -----------------------------------------------------------------------------
176202
/// @brief Private helper for doIt(). Returns true on success, false on failure.
177203
// -----------------------------------------------------------------------------
178-
- (bool) discardNodes
204+
- (bool) discardNodesIfNecessary
179205
{
180206
GoGame* game = [GoGame sharedGame];
181207
GoBoardPosition* boardPosition = game.boardPosition;
182-
int indexOfFirstNodeToDiscard = boardPosition.currentBoardPosition + 1;
183-
DDLogInfo(@"%@: Index position of first node to discard = %d", [self shortDescription], indexOfFirstNodeToDiscard);
184208
GoNodeModel* nodeModel = game.nodeModel;
209+
210+
int indexOfFirstNodeToDiscard = boardPosition.currentBoardPosition + 1;
211+
int numberOfNodes = nodeModel.numberOfNodes;
212+
if (indexOfFirstNodeToDiscard >= numberOfNodes)
213+
return true;
214+
215+
DDLogInfo(@"%@: Index position of first node to discard = %d, number of nodes = %d", [self shortDescription], indexOfFirstNodeToDiscard, numberOfNodes);
185216
[nodeModel discardNodesFromIndex:indexOfFirstNodeToDiscard];
217+
186218
return true;
187219
}
188220

src/command/boardsetup/DiscardAllSetupStonesCommand.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ - (void) didDismissAlertWithButton:(enum AlertButtonType)alertButtonType
114114
[[ApplicationStateManager sharedManager] beginSavePoint];
115115
[[LongRunningActionCounter sharedCounter] increment];
116116

117-
if (game.boardPosition.numberOfBoardPositions > 0)
117+
if (game.boardPosition.numberOfBoardPositions > 0 || game.state == GoGameStateGameHasEnded)
118118
{
119119
// Whoever invoked DiscardAllSetupStonesCommand must have previously
120120
// made sure that it's OK to discard future moves. We can therefore safely

src/command/boardsetup/HandleBoardSetupInteractionCommand.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ - (void) handleBoardSetupInteraction
173173
[[ApplicationStateManager sharedManager] beginSavePoint];
174174
[[LongRunningActionCounter sharedCounter] increment];
175175

176-
if (game.boardPosition.numberOfBoardPositions > 0)
176+
if (game.boardPosition.numberOfBoardPositions > 0 || game.state == GoGameStateGameHasEnded)
177177
{
178178
// Whoever invoked HandleBoardSetupInteractionCommand must have previously
179179
// made sure that it's OK to discard future moves. We can therefore safely

src/command/boardsetup/SetupFirstMoveColorCommand.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ - (bool) doIt
9191
[[ApplicationStateManager sharedManager] beginSavePoint];
9292
[[LongRunningActionCounter sharedCounter] increment];
9393

94-
if (game.boardPosition.numberOfBoardPositions > 0)
94+
if (game.boardPosition.numberOfBoardPositions > 0 || game.state == GoGameStateGameHasEnded)
9595
{
9696
// Whoever invoked SetupFirstMoveColorCommand must have previously
9797
// made sure that it's OK to discard future moves. We can therefore safely

0 commit comments

Comments
 (0)