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/replacement.cc
Line
Count
Source
1
#include <array>
2
#include <cstdint>
3
#include <memory>
4
#include <vector>
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/piecetype.h"
12
#include "types/statefunction.h"
13
#include "types/walls.h"
14
15
namespace mahjong {
16
namespace {
17
0
std::unique_ptr<GameState> Replacement(std::unique_ptr<GameState> state) {
18
0
  const Piece draw = Walls::TakeReplacementTile(*state);
19
0
  Hand& hand = state->hands[state->currentPlayer];
20
0
  hand.live[hand.live_count++] = draw;
21
0
  state->pendingPiece = draw;
22
23
0
  AlertPlayers(*state,
24
0
               Event{
25
0
                   .type = Event::kDora,  // type
26
0
                   .player = -1,          // player
27
0
                   .piece = static_cast<int16_t>(
28
0
                       Walls::GetDoras(*state).back().toUint8_t()),  // piece
29
0
                   .decision = false,                                // decision
30
0
               });
31
32
0
  state->nextState = StateFunctionType::kPlayerHand;
33
0
  return state;
34
0
}
35
}  // namespace
36
37
REGISTER_ROUTE(Replacement, StateFunctionType::kReplacement);
38
}  // namespace mahjong