/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/statefunctions/gamestates/gamestart.cc
Line | Count | Source |
1 | | #include <memory> |
2 | | |
3 | | #include "statefunctions/router.h" |
4 | | #include "types/gamestate.h" |
5 | | #include "types/hand.h" |
6 | | #include "types/settings.h" |
7 | | #include "types/statefunction.h" |
8 | | |
9 | | namespace mahjong { |
10 | | |
11 | | namespace { |
12 | 14 | std::unique_ptr<GameState> GameStart(std::unique_ptr<GameState> state) { |
13 | 14 | int i = 0; |
14 | 56 | for (Hand& hand : state->hands) { |
15 | 56 | hand.id = i++; |
16 | 56 | hand.points = kStartingPoints; |
17 | 56 | state->controllers[hand.id]->GameStart(hand.id); |
18 | 56 | } |
19 | 14 | state->g.seed(state->seed); |
20 | 14 | state->nextState = StateFunctionType::kRoundStart; |
21 | 14 | return state; |
22 | 14 | } |
23 | | } // namespace |
24 | | |
25 | | REGISTER_ROUTE(GameStart, StateFunctionType::kGameStart); |
26 | | } // namespace mahjong |