Coverage Report

Created: 2026-11-14 03:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/statefunctions/gamestates/concealedkan.cc
Line
Count
Source
1
#include <array>
2
#include <cstdint>
3
#include <iostream>
4
#include <memory>
5
6
#include "statefunctions/router.h"
7
#include "statefunctions/stateutilities.h"
8
#include "types/event.h"
9
#include "types/gamestate.h"
10
#include "types/hand.h"
11
#include "types/meld.h"
12
#include "types/piecetype.h"
13
#include "types/sets.h"
14
#include "types/statefunction.h"
15
16
namespace mahjong {
17
18
namespace {
19
0
std::unique_ptr<GameState> ConcealedKan(std::unique_ptr<GameState> state) {
20
0
  AlertPlayers(*state, Event{
21
0
                           .type = Event::kConcealedKan,    // type
22
0
                           .player = state->currentPlayer,  // player
23
0
                           .piece = static_cast<int16_t>(
24
0
                               state->pendingPiece.toUint8_t()),  // piece
25
0
                           .decision = false,                     // decision
26
0
                       });
27
0
  Hand& hand = state->hands[state->currentPlayer];
28
0
  if (RemovePieces(hand, state->pendingPiece,
29
0
                   /*count=*/4) != 4) {
30
0
    std::cerr << "Not Enough pieces to remove in ConcealedKan" << '\n';
31
0
    state->nextState = StateFunctionType::kError;
32
0
    return state;
33
0
  }
34
0
  hand.melds[hand.meld_count++] = Meld{
35
0
      .type = SetType::kConcealedKan,
36
0
      .start = state->pendingPiece,
37
0
  };
38
0
  state->concealedKan = true;
39
0
  state->nextState = StateFunctionType::kKanDiscard;
40
0
  return state;
41
0
}
42
}  // namespace
43
44
REGISTER_ROUTE(ConcealedKan, StateFunctionType::kConcealedKan);
45
}  // namespace mahjong