Skip to content

Commit

Permalink
improve [Candidates] feature 3
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Mar 31, 2024
1 parent a40099b commit a589a06
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
30 changes: 16 additions & 14 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ bool __fastcall XgSaveSettings(void)
//////////////////////////////////////////////////////////////////////////////

// クロスワードをチェックする。
bool __fastcall XgCheckCrossWord(HWND hwnd, bool check_words = true)
bool __fastcall XgCheckCrossWord(HWND hwnd, bool check_words, bool loose)
{
// 四隅黒禁。
if ((xg_nRules & RULE_DONTCORNERBLACK) && xg_xword.CornerBlack()) {
Expand Down Expand Up @@ -1332,20 +1332,22 @@ bool __fastcall XgCheckCrossWord(HWND hwnd, bool check_words = true)
}
}

// 黒マス点対称。
if ((xg_nRules & RULE_POINTSYMMETRY) && !xg_xword.IsPointSymmetry()) {
XgCenterMessageBoxW(hwnd, XgLoadStringDx1(IDS_NOTPOINTSYMMETRY), nullptr, MB_ICONERROR);
return false;
}
if (!loose) {
// 黒マス点対称。
if ((xg_nRules & RULE_POINTSYMMETRY) && !xg_xword.IsPointSymmetry()) {
XgCenterMessageBoxW(hwnd, XgLoadStringDx1(IDS_NOTPOINTSYMMETRY), nullptr, MB_ICONERROR);
return false;
}

// 黒マス線対称。
if ((xg_nRules & RULE_LINESYMMETRYV) && !xg_xword.IsLineSymmetryV()) {
XgCenterMessageBoxW(hwnd, XgLoadStringDx1(IDS_NOTLINESYMMETRYV), nullptr, MB_ICONERROR);
return false;
}
if ((xg_nRules & RULE_LINESYMMETRYH) && !xg_xword.IsLineSymmetryH()) {
XgCenterMessageBoxW(hwnd, XgLoadStringDx1(IDS_NOTLINESYMMETRYH), nullptr, MB_ICONERROR);
return false;
// 黒マス線対称。
if ((xg_nRules & RULE_LINESYMMETRYV) && !xg_xword.IsLineSymmetryV()) {
XgCenterMessageBoxW(hwnd, XgLoadStringDx1(IDS_NOTLINESYMMETRYV), nullptr, MB_ICONERROR);
return false;
}
if ((xg_nRules & RULE_LINESYMMETRYH) && !xg_xword.IsLineSymmetryH()) {
XgCenterMessageBoxW(hwnd, XgLoadStringDx1(IDS_NOTLINESYMMETRYH), nullptr, MB_ICONERROR);
return false;
}
}

// 偶数行数で黒マス線対称(タテ)の場合は連黒禁は不可。
Expand Down
3 changes: 3 additions & 0 deletions GUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ bool XgOpenHintsByNotepad(HWND /*hwnd*/, bool bShowAnswer);
// ヒントを表示するかどうか。
extern BOOL xg_bShowClues;

// クロスワードをチェックする。
bool __fastcall XgCheckCrossWord(HWND hwnd, bool check_words = true, bool loose = false);

//////////////////////////////////////////////////////////////////////////////

// UIフォントの論理オブジェクトを取得する。
Expand Down
5 changes: 1 addition & 4 deletions XG_CandsWnd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ struct XG_CandsButtonData
WNDPROC m_fnOldWndProc;
};

// クロスワードをチェックする。
bool __fastcall XgCheckCrossWord(HWND hwnd, bool check_words);

// 候補ウィンドウ。
class XG_CandsWnd : public XG_Window
{
Expand Down Expand Up @@ -143,7 +140,7 @@ class XG_CandsWnd : public XG_Window
XG_CandsWnd::xg_vecCandidates.resize(xg_nMaxCandidates);

if (XG_CandsWnd::xg_vecCandidates.empty()) {
if (XgCheckCrossWord(hwnd, false)) {
if (XgCheckCrossWord(hwnd, false, true)) {
::MessageBeep(0xFFFFFFFF);
} else {
return false;
Expand Down

0 comments on commit a589a06

Please sign in to comment.