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