Skip to content

Commit

Permalink
MentsuAnalysis構造体にメンバ関数追加
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailJP committed Nov 2, 2020
1 parent ef6ded0 commit 2d341b9
Show file tree
Hide file tree
Showing 16 changed files with 225 additions and 225 deletions.
218 changes: 109 additions & 109 deletions mjcore/yaku/catalog/context.cpp

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions mjcore/yaku/catalog/dora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
_T("銅鑼和"), get_yaku_han("dorahoh"),
[](const MentsuAnalysis* const analysis) -> bool {
return ((analysis->shanten[shantenAll] == -1) && // 何かの手で和了になっている
((analysis->GameStat->DoraFlag.Omote[analysis->TsumoHai->tile] > 0) || // ツモ牌が表ドラになっている(裏ドラは対象外)
(analysis->TsumoHai->red != Normal))); // 赤ドラか青ドラになっている
((analysis->GameStat->DoraFlag.Omote[analysis->TsumoHai().tile] > 0) || // ツモ牌が表ドラになっている(裏ドラは対象外)
(analysis->TsumoHai().red != Normal))); // 赤ドラか青ドラになっている
}
));
/* 北四枚抜き */
Expand All @@ -20,7 +20,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
_T("北四枚抜き"), get_yaku_han("four_northes"),
[](const MentsuAnalysis* const analysis) -> bool {
return ((analysis->shanten[shantenAll] == -1) && // 何かの手で和了になっている
(analysis->PlayerStat->NorthFlag == 4)); // 北4枚
(analysis->PlayerStat()->NorthFlag == 4)); // 北4枚
}
));
/* 八仙過海 */
Expand All @@ -30,10 +30,10 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
_T("春夏秋冬"), _T("四華開嶺"), _T("本花季節牌"), _T("本花草木牌"),
[](const MentsuAnalysis* const analysis) -> bool {
return ((analysis->shanten[shantenAll] == -1) && // 何かの手で和了になっている
(analysis->PlayerStat->FlowerFlag.Spring) && (analysis->PlayerStat->FlowerFlag.Summer) &&
(analysis->PlayerStat->FlowerFlag.Autumn) && (analysis->PlayerStat->FlowerFlag.Winter) &&
(analysis->PlayerStat->FlowerFlag.Plum) && (analysis->PlayerStat->FlowerFlag.Orchid) &&
(analysis->PlayerStat->FlowerFlag.Chrys) && (analysis->PlayerStat->FlowerFlag.Bamboo));
(analysis->PlayerStat()->FlowerFlag.Spring) && (analysis->PlayerStat()->FlowerFlag.Summer) &&
(analysis->PlayerStat()->FlowerFlag.Autumn) && (analysis->PlayerStat()->FlowerFlag.Winter) &&
(analysis->PlayerStat()->FlowerFlag.Plum) && (analysis->PlayerStat()->FlowerFlag.Orchid) &&
(analysis->PlayerStat()->FlowerFlag.Chrys) && (analysis->PlayerStat()->FlowerFlag.Bamboo));
}
));
/* 春夏秋冬 */
Expand All @@ -43,8 +43,8 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
_T("本花季節牌"),
[](const MentsuAnalysis* const analysis) -> bool {
return ((analysis->shanten[shantenAll] == -1) && // 何かの手で和了になっている
(analysis->PlayerStat->FlowerFlag.Spring) && (analysis->PlayerStat->FlowerFlag.Summer) &&
(analysis->PlayerStat->FlowerFlag.Autumn) && (analysis->PlayerStat->FlowerFlag.Winter));
(analysis->PlayerStat()->FlowerFlag.Spring) && (analysis->PlayerStat()->FlowerFlag.Summer) &&
(analysis->PlayerStat()->FlowerFlag.Autumn) && (analysis->PlayerStat()->FlowerFlag.Winter));
}
));
/* 四華開嶺 */
Expand All @@ -54,8 +54,8 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
_T("本花草木牌"),
[](const MentsuAnalysis* const analysis) -> bool {
return ((analysis->shanten[shantenAll] == -1) && // 何かの手で和了になっている
(analysis->PlayerStat->FlowerFlag.Plum) && (analysis->PlayerStat->FlowerFlag.Orchid) &&
(analysis->PlayerStat->FlowerFlag.Chrys) && (analysis->PlayerStat->FlowerFlag.Bamboo));
(analysis->PlayerStat()->FlowerFlag.Plum) && (analysis->PlayerStat()->FlowerFlag.Orchid) &&
(analysis->PlayerStat()->FlowerFlag.Chrys) && (analysis->PlayerStat()->FlowerFlag.Bamboo));
}
));
/* 本花 */
Expand All @@ -65,10 +65,10 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
[](const MentsuAnalysis* const analysis) -> bool {
if (analysis->shanten[shantenAll] != -1) return false; // 和了ってないなら戻る
switch (analysis->GameStat->playerwind(analysis->player)) {
case sEast: return analysis->PlayerStat->FlowerFlag.Spring;
case sSouth: return analysis->PlayerStat->FlowerFlag.Summer;
case sWest: return analysis->PlayerStat->FlowerFlag.Autumn;
case sNorth: return analysis->PlayerStat->FlowerFlag.Winter;
case sEast: return analysis->PlayerStat()->FlowerFlag.Spring;
case sSouth: return analysis->PlayerStat()->FlowerFlag.Summer;
case sWest: return analysis->PlayerStat()->FlowerFlag.Autumn;
case sNorth: return analysis->PlayerStat()->FlowerFlag.Winter;
default:
RaiseTolerant(EXCEPTION_MJCORE_INVALID_DATA, _T("自風が東南西北のどれでもありません"));
return false;
Expand All @@ -80,10 +80,10 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
[](const MentsuAnalysis* const analysis) -> bool {
if (analysis->shanten[shantenAll] != -1) return false; // 和了ってないなら戻る
switch (analysis->GameStat->playerwind(analysis->player)) {
case sEast: return analysis->PlayerStat->FlowerFlag.Plum;
case sSouth: return analysis->PlayerStat->FlowerFlag.Orchid;
case sWest: return analysis->PlayerStat->FlowerFlag.Chrys;
case sNorth: return analysis->PlayerStat->FlowerFlag.Bamboo;
case sEast: return analysis->PlayerStat()->FlowerFlag.Plum;
case sSouth: return analysis->PlayerStat()->FlowerFlag.Orchid;
case sWest: return analysis->PlayerStat()->FlowerFlag.Chrys;
case sNorth: return analysis->PlayerStat()->FlowerFlag.Bamboo;
default:
RaiseTolerant(EXCEPTION_MJCORE_INVALID_DATA, _T("自風が東南西北のどれでもありません"));
return false;
Expand All @@ -96,14 +96,14 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_dora() {
const auto countRed = [](const MentsuAnalysis* const analysis) -> unsigned {
unsigned red = 0;
for (int i = 0; i < NumOfTilesInHand; i++) {
if (analysis->PlayerStat->Hand[i].tile == NoTile) continue;
else if (analysis->PlayerStat->Hand[i].tile >= TileNonflowerMax) continue;
else if (analysis->PlayerStat->Hand[i].red == AkaDora) ++red;
if (analysis->PlayerStat()->Hand[i].tile == NoTile) continue;
else if (analysis->PlayerStat()->Hand[i].tile >= TileNonflowerMax) continue;
else if (analysis->PlayerStat()->Hand[i].red == AkaDora) ++red;
}
for (int i = 1; i < analysis->PlayerStat->MeldPointer; i++) {
const auto k = &analysis->PlayerStat->Meld[i];
for (int i = 1; i < analysis->PlayerStat()->MeldPointer; i++) {
const auto k = &analysis->PlayerStat()->Meld[i];
for (int j = 0; j < (k->mstat >= meldQuadConcealed ? 4 : 3); j++) {
if (analysis->PlayerStat->Meld[i].red[j] == AkaDora) ++red;
if (analysis->PlayerStat()->Meld[i].red[j] == AkaDora) ++red;
}
}
return red;
Expand Down
2 changes: 1 addition & 1 deletion mjcore/yaku/catalog/irreg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_irregular()
yaku::yakuCalculator::YakuCatalog::Instantiate()->catalog.push_back(Yaku(
_T("北の大地"), yaku::yakuCalculator::Yaku::HANFUNC(
[](const MentsuAnalysis* const analysis) -> yaku::yakuCalculator::Yaku::YAKU_HAN {
switch (analysis->TsumoHai->tile) { /* 何で和了ったかで分岐 */
switch (analysis->TsumoHai().tile) { /* 何で和了ったかで分岐 */
case NorthWind: /* 北で和了るとダブル役満 */
return yaku::yakuCalculator::Yaku::YAKU_HAN(yaku::yakuCalculator::Yaku::YAKU_HAN::HAN::yv_double_yakuman);
case WhiteDragon: /* 白で和了るとトリプル役満 */
Expand Down
20 changes: 10 additions & 10 deletions mjcore/yaku/catalog/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
_T("金鶏独立"), get_yaku_han("kinkei_dokuritsu"),
_T("全倒鋪"), _T("全求人"),
[chkHadakaTanki](const MentsuAnalysis* const analysis) -> bool {
return chkHadakaTanki(analysis) && (analysis->TsumoHai->tile == BambooOne);
return chkHadakaTanki(analysis) && (analysis->TsumoHai().tile == BambooOne);
}
));
// 独釣寒江雪…白待ち
Expand All @@ -124,7 +124,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
_T("独釣寒江雪"), get_yaku_han("kankou_no_yuki"),
_T("全倒鋪"), _T("全求人"),
[chkHadakaTanki](const MentsuAnalysis* const analysis) -> bool {
return chkHadakaTanki(analysis) && (analysis->TsumoHai->tile == WhiteDragon);
return chkHadakaTanki(analysis) && (analysis->TsumoHai().tile == WhiteDragon);
}
));
#endif /* GUOBIAO */
Expand Down Expand Up @@ -749,7 +749,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
(tiles[i + 4] >= 1) && (tiles[i + 5] >= 1) && (tiles[i + 6] >= 1) &&
(tiles[i + 7] >= 1) && (tiles[i + 8] >= 1) && (tiles[i + 9] >= 3))
yakuFlag = true;
return yakuFlag && (!(*analysis->MenzenFlag));
return yakuFlag && (!analysis->MenzenFlag());
}
));

Expand Down Expand Up @@ -818,11 +818,11 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
static_cast<TileCode>(i + 4)
};
if (chktiles(analysis, kezi, 3, shunzi, 1, true) &&
(analysis->TsumoHai->tile == static_cast<TileCode>(i + 3)) &&
(analysis->TsumoHai().tile == static_cast<TileCode>(i + 3)) &&
(Tile(analysis->MianziDat[0].tile).isHonor()))
flag = true;
if (chktiles(analysis, kezi, 3, shunzi + 1, 1, true) &&
(analysis->TsumoHai->tile == static_cast<TileCode>(i + 6)) &&
(analysis->TsumoHai().tile == static_cast<TileCode>(i + 6)) &&
(Tile(analysis->MianziDat[0].tile).isHonor()))
flag = true;
}
Expand All @@ -835,7 +835,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
_T("愚濫怒苦露酢"), yaku::yakuCalculator::Yaku::HANFUNC(
[](const MentsuAnalysis* const analysis) {
return yaku::yakuCalculator::Yaku::YAKU_HAN(
(analysis->TsumoHai->tile == CircleFive) ?
(analysis->TsumoHai().tile == CircleFive) ?
yaku::yakuCalculator::Yaku::YAKU_HAN::HAN::yv_double_yakuman :
yaku::yakuCalculator::Yaku::YAKU_HAN::HAN::yv_yakuman);
}),
Expand All @@ -849,7 +849,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
};
return chktiles_nodup(analysis, kezi, 2, shunzi, 2, true) &&
(analysis->MianziDat[0].tile == CircleFive) &&
(*analysis->MenzenFlag);
(analysis->MenzenFlag());
}
));
/* 喜鵲閙梅 */
Expand Down Expand Up @@ -1149,7 +1149,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
[targetTile](const MentsuAnalysis* const analysis) -> bool {
return ((analysis->KangziCount[targetTile] >= 1) &&
(analysis->Machi == yaku::yakuCalculator::machiRyanmen) &&
(analysis->TotalKezi == 1) && (*analysis->MenzenFlag));
(analysis->TotalKezi == 1) && (analysis->MenzenFlag()));
}
));
}
Expand All @@ -1162,7 +1162,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
return ((analysis->KangziCount[EastWind] >= 1) &&
(analysis->KangziCount[NorthWind] >= 1) &&
(analysis->Machi == yaku::yakuCalculator::machiRyanmen) &&
(analysis->TotalKezi == 2) && (*analysis->MenzenFlag));
(analysis->TotalKezi == 2) && (analysis->MenzenFlag()));
}
));
/* 名大役満 */
Expand All @@ -1178,7 +1178,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_misc() {
yakuFlag = true;
return ((yakuFlag) &&
(analysis->Machi == yaku::yakuCalculator::machiRyanmen) &&
(analysis->TotalKezi == 2) && (*analysis->MenzenFlag));
(analysis->TotalKezi == 2) && (analysis->MenzenFlag()));
}
));

Expand Down
2 changes: 1 addition & 1 deletion mjcore/yaku/catalog/pinhu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_pinhu()
_T("平和"),
[](const MentsuAnalysis* const analysis) {
return (analysis->isPinfu &&
(analysis->TsumoHai->tile == CircleOne));
(analysis->TsumoHai().tile == CircleOne));
}
));
#endif /* GUOBIAO */
Expand Down
6 changes: 3 additions & 3 deletions mjcore/yaku/catalog/post.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void yaku::yakuCalculator::CalculatorThread::checkPostponedYaku
if (((analysis->Machi == yaku::yakuCalculator::machiKanchan) ||
(analysis->Machi == yaku::yakuCalculator::machiPenchan) ||
(analysis->Machi == yaku::yakuCalculator::machiTanki)) &&
(! analysis->PlayerStat->RichiFlag.RichiFlag) &&
(! analysis->PlayerStat()->RichiFlag.RichiFlag) &&
(totalHan <= 0) && (totalSemiMangan == 0)) {
LPCTSTR name = _T("カラス");
yakuHan[name] = yaku::yakuCalculator::Yaku::yval_1han(analysis);
Expand All @@ -65,7 +65,7 @@ void yaku::yakuCalculator::CalculatorThread::checkPostponedYaku
if (((analysis->Machi == yaku::yakuCalculator::machiKanchan) ||
(analysis->Machi == yaku::yakuCalculator::machiPenchan) ||
(analysis->Machi == yaku::yakuCalculator::machiTanki)) &&
(analysis->PlayerStat->RichiFlag.RichiFlag) &&
(analysis->PlayerStat()->RichiFlag.RichiFlag) &&
(totalHan == 1) && (totalSemiMangan == 0)) {
LPCTSTR name = _T("カラス立直");
yakuHan[name] = yaku::yakuCalculator::Yaku::yval_1han(analysis);
Expand All @@ -82,7 +82,7 @@ void yaku::yakuCalculator::CalculatorThread::checkPostponedYaku
if ((totalHan >= 2) && /* 2飜以上あるか? */
(totalSemiMangan == 0) && /* 役満未満か? */
(analysis->GameStat->DoraFlag.Omote[NorthWind] == 0) && /* 北はドラではないか? */
((!*analysis->MenzenFlag) || (!analysis->PlayerStat->RichiFlag.RichiFlag) ||
((!analysis->MenzenFlag()) || (!analysis->PlayerStat()->RichiFlag.RichiFlag) ||
(RuleData::chkRuleApplied("uradora")) ||
(analysis->GameStat->DoraFlag.Ura[NorthWind] == 0)) && /* 北は裏ドラではないか? */
(analysis->MianziDat[0].tile == NorthWind)) { /* 雀頭が北か? */
Expand Down
4 changes: 2 additions & 2 deletions mjcore/yaku/catalog/quad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_quad() {
_T("暗中模索"), get_yaku_han("anchumosaku"),
[](const MentsuAnalysis* const analysis) -> bool {
return ((analysis->AnKangziCount[RedDragon] >= 1) &&
(analysis->TsumoHai->tile / TileSuitStep == TileSuitBamboos / TileSuitStep) &&
(*analysis->TsumoAgariFlag));
(analysis->TsumoHai().tile / TileSuitStep == TileSuitBamboos / TileSuitStep) &&
(analysis->TsumoAgariFlag()));
}
));
/* 戦車 */
Expand Down
18 changes: 9 additions & 9 deletions mjcore/yaku/catalog/sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_sequence() {
_T("鳴き二盃口"), yaku::yakuCalculator::Yaku::HANFUNC(
[](const MentsuAnalysis* const analysis) {
return yaku::yakuCalculator::Yaku::YAKU_HAN(
(*analysis->MenzenFlag) ?
(analysis->MenzenFlag()) ?
yaku::yakuCalculator::Yaku::YAKU_HAN::HAN::yv_null :
yaku::yakuCalculator::Yaku::YAKU_HAN::HAN::yv_2han,
yaku::yakuCalculator::Yaku::YAKU_HAN::HAN::yv_null);
Expand Down Expand Up @@ -330,7 +330,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_sequence() {
ikki_tsuukan(analysis, &yakuFlag, &yakuCol);
return (yakuFlag && // 一気通貫が成立していて
(analysis->Machi == yaku::yakuCalculator::machiKanchan) && // 嵌張待ちで
(analysis->PlayerStat->Hand[TsumohaiIndex].tile == (yakuCol + 5)) // 和了牌が5
(analysis->PlayerStat()->Hand[TsumohaiIndex].tile == (yakuCol + 5)) // 和了牌が5
);
}
));
Expand Down Expand Up @@ -434,7 +434,7 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_sequence() {
return (yakuFlag && // 一気通貫が成立していて
(analysis->KeziCount[NorthWind] >= 1) && // 北の刻子があり
((analysis->MianziDat[0].tile / TileSuitStep) == (yakuCol / TileSuitStep)) && // 一色になっていて
(analysis->PlayerStat->Hand[TsumohaiIndex].tile == (yakuCol + 5)) // 和了牌が5
(analysis->TsumoHai().tile == (yakuCol + 5)) // 和了牌が5
);
}
));
Expand Down Expand Up @@ -525,9 +525,9 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_sequence() {
ikki_tsuukan(analysis, &yakuFlag, &yakuCol);
return (yakuFlag && // 一気通貫が成立していて
(analysis->Machi == yaku::yakuCalculator::machiKanchan) && // 嵌張待ちで
((analysis->TsumoHai->tile == yakuCol + 2) || // 2か
(analysis->TsumoHai->tile == yakuCol + 4) || // 4か
(analysis->TsumoHai->tile == yakuCol + 6)) // 6で和了
((analysis->TsumoHai().tile == yakuCol + 2) || // 2か
(analysis->TsumoHai().tile == yakuCol + 4) || // 4か
(analysis->TsumoHai().tile == yakuCol + 6)) // 6で和了
);
}
));
Expand Down Expand Up @@ -987,10 +987,10 @@ void yaku::yakuCalculator::YakuCatalog::catalogInit::yakulst_sequence() {
_T("三色通貫"),
[sanshoku_tsuukan](const MentsuAnalysis* const analysis) -> bool {
return (sanshoku_tsuukan(analysis) && // 三色通貫で
(*analysis->MenzenFlag) && // 門前で
(analysis->MenzenFlag()) && // 門前で
(analysis->Machi == yaku::yakuCalculator::machiTanki) && // 単騎待ちで
(analysis->TsumoHai->tile != WhiteDragon) && // 白待ちでなく
(analysis->TsumoHai->tile != GreenDragon) ); // 發待ちでない
(analysis->TsumoHai().tile != WhiteDragon) && // 白待ちでなく
(analysis->TsumoHai().tile != GreenDragon) ); // 發待ちでない
}
));
/* 三色通貫全帯幺九 */
Expand Down
Loading

0 comments on commit 2d341b9

Please sign in to comment.