Skip to content

Commit

Permalink
Add current player to game state.
Browse files Browse the repository at this point in the history
Also update test reporting github action.
  • Loading branch information
KCFindstr committed Feb 14, 2023
1 parent 956e687 commit abfe4f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Generate Test Report
uses: phoenix-actions/test-reporting@v3
uses: phoenix-actions/test-reporting@v8
id: test-report
if: success() || failure()
with:
Expand Down
3 changes: 3 additions & 0 deletions Communication/Sync/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,23 @@ public class GameState : IRabiPlayerMessage {
[RabiBroadcast] public readonly GameInfo info;
[RabiBroadcast] public readonly WallState wall;
[RabiBroadcast] public readonly PlayerState[] players;
[RabiBroadcast] public readonly int currentPlayer;

public GameState(Game game, int playerId) {
this.playerId = playerId;
config = game.config;
info = game.info;
wall = new WallState(game.wall);
players = game.players.Select(p => new PlayerState(p, playerId)).ToArray();
currentPlayer = game.info.currentPlayer;
}

public GameStateMsg ToProto(int playerId) {
var ret = new GameStateMsg {
Config = config.ToProto(),
Info = info.ToProto(),
Wall = wall.ToProto(),
CurrentPlayer = currentPlayer,
};
ret.Players.AddRange(players.Select(x => x.ToProto(playerId)));
return ret;
Expand Down
2 changes: 1 addition & 1 deletion Protos

0 comments on commit abfe4f3

Please sign in to comment.