Skip to content

Commit

Permalink
setup-pos: Do not show page if removeOpponentsPieceFromHand is on (WAR)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcitem committed Apr 21, 2024
1 parent b15df77 commit c642064
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,18 @@ class SetupPositionToolbarState extends State<SetupPositionToolbar> {
assert(false);
}
} else if (newPhase == Phase.moving) {
GameController().position.pieceInHandCount[PieceColor.white] =
GameController().position.pieceInHandCount[PieceColor.black] = 0;
if (DB().ruleSettings.millFormationActionInPlacingPhase ==
MillFormationActionInPlacingPhase
.removeOpponentsPieceFromHandThenYourTurn ||
DB().ruleSettings.millFormationActionInPlacingPhase ==
MillFormationActionInPlacingPhase
.removeOpponentsPieceFromHandThenOpponentsTurn) {
// TODO: Right?
GameController().position.pieceInHandCount[newPieceColor] = 0;
} else {
GameController().position.pieceInHandCount[PieceColor.white] =
GameController().position.pieceInHandCount[PieceColor.black] = 0;
}
} else {
assert(false);
}
Expand Down
21 changes: 14 additions & 7 deletions src/ui/flutter_app/lib/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,20 @@ class HomeState extends State<Home> with TickerProviderStateMixin {
currentSelectedValue: _drawerIndex,
onSelectionChanged: _changeIndex,
),
CustomDrawerItem<_DrawerIndex>(
itemValue: _DrawerIndex.setupPosition,
itemTitle: S.of(context).setupPosition,
itemIcon: const Icon(FluentIcons.drafts_24_regular),
currentSelectedValue: _drawerIndex,
onSelectionChanged: _changeIndex,
),
// TODO: Support removeOpponentsPieceFromHand
if (DB().ruleSettings.millFormationActionInPlacingPhase !=
MillFormationActionInPlacingPhase
.removeOpponentsPieceFromHandThenYourTurn &&
DB().ruleSettings.millFormationActionInPlacingPhase !=
MillFormationActionInPlacingPhase
.removeOpponentsPieceFromHandThenOpponentsTurn)
CustomDrawerItem<_DrawerIndex>(
itemValue: _DrawerIndex.setupPosition,
itemTitle: S.of(context).setupPosition,
itemIcon: const Icon(FluentIcons.drafts_24_regular),
currentSelectedValue: _drawerIndex,
onSelectionChanged: _changeIndex,
),
CustomDrawerItem<_DrawerIndex>(
itemValue: _DrawerIndex.generalSettings,
itemTitle: S.of(context).generalSettings,
Expand Down

0 comments on commit c642064

Please sign in to comment.