Skip to content

Commit

Permalink
feat: adds the players team in the BV report
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio committed Nov 26, 2024
1 parent 61d2def commit e3c21c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion megamek/src/megamek/common/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public final class Player extends TurnOrdered {
public static final int TEAM_NONE = 0;
public static final int TEAM_UNASSIGNED = -1;
public static final String[] TEAM_NAMES = {"No Team", "Team 1", "Team 2", "Team 3", "Team 4", "Team 5"};

private transient IGame game;

private String name;
Expand Down Expand Up @@ -652,6 +651,11 @@ public String getColorForPlayer() {
return "<B><font color='" + getColour().getHexString(0x00F0F0F0) + "'>" + getName() + "</font></B>";
}

public String getColoredPlayerNameWithTeam() {
return "<B><font color='" + getColour().getHexString(0x00F0F0F0) + "'>" + getName() +
" (" + TEAM_NAMES[team] + ")</font></B>";
}

/**
* Clears any data from this Player that should not be transmitted to other players from the server,
* such as email addresses. Note that this changes this Player's data permanently and should typically
Expand Down
5 changes: 3 additions & 2 deletions megamek/src/megamek/server/totalwarfare/TWGameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ void bvReports(boolean checkBlind) {
bvcPlayer.ejectedCrewKilledCount = ServerReportsHelper.getEjectedCrewKilledCount(player, game);
bvcPlayer.ejectedCrewFledCount = ServerReportsHelper.getFledEjectedCrew(player, game);

playerReport.addAll(bvReport(player.getColorForPlayer(), player.getId(), bvcPlayer, checkBlind));
playerReport.addAll(bvReport(player.getColoredPlayerNameWithTeam(), player.getId(), bvcPlayer, checkBlind));

int playerTeam = player.getTeam();

Expand Down Expand Up @@ -1611,7 +1611,8 @@ void bvReports(boolean checkBlind) {
if (!(checkBlind && doBlind() && suppressBlindBV())) {
for (Map.Entry<Integer, BVCountHelper> e : teamsInfo.entrySet()) {
BVCountHelper bvc = e.getValue();
teamReport.addAll(bvReport(Player.TEAM_NAMES[e.getKey()], Player.PLAYER_NONE, bvc, false));
var coloredTeamName = "<B>"+ Player.TEAM_NAMES[e.getKey()] + "</B>";
teamReport.addAll(bvReport(coloredTeamName, Player.PLAYER_NONE, bvc, false));
}
}

Expand Down

0 comments on commit e3c21c0

Please sign in to comment.