diff --git a/src/mills.cpp b/src/mills.cpp index 43550225..b1a03789 100644 --- a/src/mills.cpp +++ b/src/mills.cpp @@ -246,7 +246,7 @@ void adjacent_squares_init() noexcept /* 39 */ 0, }; - if (rule.hasObliqueLines) { + if (rule.hasDiagonalLines) { memcpy(MoveList::adjacentSquares, adjacentSquares12, sizeof(MoveList::adjacentSquares)); memcpy(MoveList::adjacentSquaresBB, adjacentSquaresBB12, sizeof(MoveList::adjacentSquaresBB)); } else { @@ -368,7 +368,7 @@ void mill_table_init() }; // TODO: change to ptr? - if (rule.hasObliqueLines) { + if (rule.hasDiagonalLines) { memcpy(Position::millTableBB, millTableBB12, sizeof(Position::millTableBB)); } else { memcpy(Position::millTableBB, millTableBB9, sizeof(Position::millTableBB)); diff --git a/src/position.cpp b/src/position.cpp index 1fcabc7e..6428971b 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -127,7 +127,7 @@ std::ostream &operator<<(std::ostream &os, const Position &pos) #define P(s) PieceToChar(pos.piece_on(Square(s))) - if (rule.hasObliqueLines) { + if (rule.hasDiagonalLines) { os << "\n"; os << P(31) << " --- " << P(24) << " --- " << P(25) << "\n"; os << "|\\ | /|\n"; @@ -1306,7 +1306,7 @@ bool Position::is_all_surrounded(Color c bool Position::is_star_square(Square s) { - if (rule.hasObliqueLines == true) { + if (rule.hasDiagonalLines == true) { return (s == 17 || s == 19 || s == 21 || diff --git a/src/rule.h b/src/rule.h index a7053fbc..c3b2075b 100644 --- a/src/rule.h +++ b/src/rule.h @@ -33,7 +33,7 @@ struct Rule int piecesAtLeastCount; // Default is 3 - bool hasObliqueLines; + bool hasDiagonalLines; bool hasBannedLocations; diff --git a/src/ucioption.cpp b/src/ucioption.cpp index c0fae913..a00c3a97 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -87,9 +87,9 @@ void on_piecesAtLeastCount(const Option &o) rule.piecesAtLeastCount = (int)o; } -void on_hasObliqueLines(const Option &o) +void on_hasDiagonalLines(const Option &o) { - rule.hasObliqueLines = (bool)o; + rule.hasDiagonalLines = (bool)o; } void on_hasBannedLocations(const Option &o) @@ -169,7 +169,7 @@ void init(OptionsMap &o) // Rules o["PiecesCount"] << Option(12, 6, 12, on_piecesCount); o["PiecesAtLeastCount"] << Option(3, 3, 5, on_piecesAtLeastCount); - o["HasObliqueLines"] << Option(true, on_hasObliqueLines); + o["HasDiagonalLines"] << Option(true, on_hasDiagonalLines); o["HasBannedLocations"] << Option(true, on_hasBannedLocations); o["IsDefenderMoveFirst"] << Option(true, on_isDefenderMoveFirst); o["MayRemoveMultiple"] << Option(false, on_mayRemoveMultiple); diff --git a/src/ui/flutter_app/lib/common/config.dart b/src/ui/flutter_app/lib/common/config.dart index e05c2f86..9cd27fb5 100644 --- a/src/ui/flutter_app/lib/common/config.dart +++ b/src/ui/flutter_app/lib/common/config.dart @@ -51,7 +51,7 @@ class Config { // Rules static int piecesCount = 12; static int piecesAtLeastCount = 3; - static bool hasObliqueLines = true; + static bool hasDiagonalLines = true; static bool hasBannedLocations = true; static bool isDefenderMoveFirst = true; static bool mayRemoveMultiple = false; @@ -100,8 +100,8 @@ class Config { rule.piecesCount = Config.piecesCount = profile['PiecesCount'] ?? 12; rule.piecesAtLeastCount = Config.piecesAtLeastCount = profile['PiecesAtLeastCount'] ?? 3; - rule.hasObliqueLines = - Config.hasObliqueLines = profile['HasObliqueLines'] ?? true; + rule.hasDiagonalLines = + Config.hasDiagonalLines = profile['HasDiagonalLines'] ?? true; rule.hasBannedLocations = Config.hasBannedLocations = profile['HasBannedLocations'] ?? true; rule.isDefenderMoveFirst = @@ -153,7 +153,7 @@ class Config { // Rules profile['PiecesCount'] = Config.piecesCount; profile['PiecesAtLeastCount'] = Config.piecesAtLeastCount; - profile['HasObliqueLines'] = Config.hasObliqueLines; + profile['HasDiagonalLines'] = Config.hasDiagonalLines; profile['HasBannedLocations'] = Config.hasBannedLocations; profile['IsDefenderMoveFirst'] = Config.isDefenderMoveFirst; profile['MayRemoveMultiple'] = Config.mayRemoveMultiple; diff --git a/src/ui/flutter_app/lib/engine/native_engine.dart b/src/ui/flutter_app/lib/engine/native_engine.dart index ba6b76ba..8858ade4 100644 --- a/src/ui/flutter_app/lib/engine/native_engine.dart +++ b/src/ui/flutter_app/lib/engine/native_engine.dart @@ -112,7 +112,7 @@ class NativeEngine extends AiEngine { await send( 'setoption name PiecesAtLeastCount value ${Config.piecesAtLeastCount}'); await send( - 'setoption name HasObliqueLines value ${Config.hasObliqueLines}'); + 'setoption name HasDiagonalLines value ${Config.hasDiagonalLines}'); await send( 'setoption name HasBannedLocations value ${Config.hasBannedLocations}'); await send( diff --git a/src/ui/flutter_app/lib/l10n/intl_en.arb b/src/ui/flutter_app/lib/l10n/intl_en.arb index 1734b095..39ce5bf9 100644 --- a/src/ui/flutter_app/lib/l10n/intl_en.arb +++ b/src/ui/flutter_app/lib/l10n/intl_en.arb @@ -372,9 +372,9 @@ "@piecesAtLeastCount": { "description": "Pieces At Least" }, - "hasObliqueLines": "Has Oblique Lines", - "@hasObliqueLines": { - "description": "Has Oblique Lines" + "hasDiagonalLines": "Has Diagonal Lines", + "@hasDiagonalLines": { + "description": "Has Diagonal Lines" }, "hasBannedLocations": "Has Banned Locations", "@hasBannedLocations": { diff --git a/src/ui/flutter_app/lib/l10n/intl_zh.arb b/src/ui/flutter_app/lib/l10n/intl_zh.arb index 97c70cdc..f1568ffb 100644 --- a/src/ui/flutter_app/lib/l10n/intl_zh.arb +++ b/src/ui/flutter_app/lib/l10n/intl_zh.arb @@ -93,7 +93,7 @@ "ninePieces": "九子", "twelvePieces": "十二子", "piecesAtLeastCount": "少于几个子则输棋", - "hasObliqueLines": "斜线", + "hasDiagonalLines": "斜线", "hasBannedLocations": "禁点", "hasBannedLocations_Detail": "在摆子阶段,被吃掉的棋子的位置将不能再落子,除非进入走子阶段。", "isDefenderMoveFirst": "后摆子的先走子", diff --git a/src/ui/flutter_app/lib/mill/position.dart b/src/ui/flutter_app/lib/mill/position.dart index 1037aa8c..4784ec74 100644 --- a/src/ui/flutter_app/lib/mill/position.dart +++ b/src/ui/flutter_app/lib/mill/position.dart @@ -849,7 +849,7 @@ class Position { } void createMillTable() { - const millTable_noObliqueLine = [ + const millTable_noDiagonalLine = [ /* 0 */ [ [0, 0], [0, 0], @@ -1056,7 +1056,7 @@ class Position { ] ]; - const millTable_hasObliqueLines = [ + const millTable_hasDiagonalLines = [ /* 0 */ [ [0, 0], [0, 0], @@ -1263,16 +1263,16 @@ class Position { ] ]; - if (rule.hasObliqueLines) { - millTable = millTable_hasObliqueLines; + if (rule.hasDiagonalLines) { + millTable = millTable_hasDiagonalLines; } else { - millTable = millTable_noObliqueLine; + millTable = millTable_noDiagonalLine; } } void createMoveTable() { // Note: Not follow order of MoveDirection array - const moveTable_obliqueLine = [ + const moveTable_diagonalLine = [ /* 0 */ [0, 0, 0, 0], /* 1 */ [0, 0, 0, 0], /* 2 */ [0, 0, 0, 0], @@ -1319,7 +1319,7 @@ class Position { /* 39 */ [0, 0, 0, 0], ]; - const moveTable_noObliqueLine = [ + const moveTable_noDiagonalLine = [ /* 0 */ [0, 0, 0, 0], /* 1 */ [0, 0, 0, 0], /* 2 */ [0, 0, 0, 0], @@ -1366,10 +1366,10 @@ class Position { /* 39 */ [0, 0, 0, 0], ]; - if (rule.hasObliqueLines) { - moveTable = moveTable_obliqueLine; + if (rule.hasDiagonalLines) { + moveTable = moveTable_diagonalLine; } else { - moveTable = moveTable_noObliqueLine; + moveTable = moveTable_noDiagonalLine; } } @@ -1495,7 +1495,7 @@ class Position { } bool isStarSquare(int s) { - if (rule.hasObliqueLines == true) { + if (rule.hasDiagonalLines == true) { return (s == 17 || s == 19 || s == 21 || s == 23); } diff --git a/src/ui/flutter_app/lib/mill/rule.dart b/src/ui/flutter_app/lib/mill/rule.dart index 7755f6b9..05419b79 100644 --- a/src/ui/flutter_app/lib/mill/rule.dart +++ b/src/ui/flutter_app/lib/mill/rule.dart @@ -21,7 +21,7 @@ class Rule { String description = ""; int piecesCount = 12; // 9 or 12 int piecesAtLeastCount = 3; // Default is 3 - bool hasObliqueLines = true; + bool hasDiagonalLines = true; bool hasBannedLocations = true; bool isDefenderMoveFirst = true; bool mayRemoveMultiple = false; diff --git a/src/ui/flutter_app/lib/painting/board_painter.dart b/src/ui/flutter_app/lib/painting/board_painter.dart index 36be761d..ba711f49 100644 --- a/src/ui/flutter_app/lib/painting/board_painter.dart +++ b/src/ui/flutter_app/lib/painting/board_painter.dart @@ -177,32 +177,32 @@ class BoardPainter extends PiecesBasePainter { paint, ); - if (!Config.hasObliqueLines) { + if (!Config.hasDiagonalLines) { return; } - // top left oblique line + // top left diagonal line canvas.drawLine( Offset(left + 0, top), Offset(left + squareWidth * 2, top + squareWidth * 2), paint, ); - // lower right oblique line + // lower right diagonal line canvas.drawLine( Offset(left + squareWidth * 4, top + squareWidth * 4), Offset(left + squareWidth * 6, top + squareWidth * 6), paint, ); - // top right oblique line + // top right diagonal line canvas.drawLine( Offset(left + squareWidth * 6, top), Offset(left + squareWidth * 4, top + squareWidth * 2), paint, ); - // lower left oblique line + // lower left diagonal line canvas.drawLine( Offset(left + squareWidth * 2, top + squareWidth * 4), Offset(left + squareWidth * 0, top + squareWidth * 6), diff --git a/src/ui/flutter_app/lib/widgets/rule_settings_page.dart b/src/ui/flutter_app/lib/widgets/rule_settings_page.dart index c03ddfcd..483c67ba 100644 --- a/src/ui/flutter_app/lib/widgets/rule_settings_page.dart +++ b/src/ui/flutter_app/lib/widgets/rule_settings_page.dart @@ -92,10 +92,10 @@ class _RuleSettingsPageState extends State { Config.save(); } - setHasObliqueLines(bool value) async { + setHasDiagonalLines(bool value) async { // setState(() { - rule.hasObliqueLines = Config.hasObliqueLines = value; + rule.hasDiagonalLines = Config.hasDiagonalLines = value; }); Config.save(); @@ -214,10 +214,10 @@ class _RuleSettingsPageState extends State { _buildDivider(), SwitchListTile( activeColor: UIColors.primaryColor, - value: Config.hasObliqueLines, + value: Config.hasDiagonalLines, title: - Text(S.of(context).hasObliqueLines, style: itemStyle), - onChanged: setHasObliqueLines, + Text(S.of(context).hasDiagonalLines, style: itemStyle), + onChanged: setHasDiagonalLines, ), _buildDivider(), SwitchListTile( diff --git a/src/ui/qt/boarditem.cpp b/src/ui/qt/boarditem.cpp index ae9365f2..17d6167e 100644 --- a/src/ui/qt/boarditem.cpp +++ b/src/ui/qt/boarditem.cpp @@ -78,7 +78,7 @@ QPainterPath BoardItem::shape() const void BoardItem::setDiagonal(bool arg) { - hasObliqueLine = arg; + hasDiagonalLine = arg; update(boundingRect()); } @@ -127,7 +127,7 @@ void BoardItem::paint(QPainter *painter, painter->drawLine(position[i], position[(FILE_NB - 1) * RANK_NB + i]); } - if (hasObliqueLine) { + if (hasDiagonalLine) { // Draw 4 diagonal lines for (int i = 1; i < RANK_NB; i += 2) { painter->drawLine(position[i], position[(FILE_NB - 1) * RANK_NB + i]); diff --git a/src/ui/qt/boarditem.h b/src/ui/qt/boarditem.h index 6b57f30b..1f160160 100644 --- a/src/ui/qt/boarditem.h +++ b/src/ui/qt/boarditem.h @@ -69,7 +69,7 @@ private: int size; // board size int sizeShadow {5}; QPointF position[EFFECTIVE_SQUARE_NB]; // 24 points - bool hasObliqueLine {false}; + bool hasDiagonalLine {false}; }; #endif // BOARDITEM_H diff --git a/src/ui/qt/game.cpp b/src/ui/qt/game.cpp index 502c4aaf..36f8c5d2 100644 --- a/src/ui/qt/game.cpp +++ b/src/ui/qt/game.cpp @@ -257,7 +257,7 @@ void Game::gameReset() currentPiece = nullptr; // Redraw pieces - scene.setDiagonal(rule.hasObliqueLines); + scene.setDiagonal(rule.hasDiagonalLines); // Draw all the pieces and put them in the starting position // 0: the first piece in the first hand; 1: the first piece in the second hand