aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/board.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-24 00:02:06 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-24 00:02:06 +0100
commitcf65c78a5913dc047e997e52f1bfedd2da045e74 (patch)
tree2d0b8a367c5fd9fc51e0475a1af60503eae01b3b /FICS/board.c
parentc4ee6979020e95f4c9dc95af38e64c78fe3ca097 (diff)
Reformatted update_holding()
Diffstat (limited to 'FICS/board.c')
-rw-r--r--FICS/board.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/FICS/board.c b/FICS/board.c
index 66cf527..8e23ac8 100644
--- a/FICS/board.c
+++ b/FICS/board.c
@@ -175,33 +175,44 @@ PRIVATE char *append_holding_display(char *buf, game_state_t *gs, int white)
return buf;
}
-PUBLIC void update_holding(int g, int pieceCaptured)
+PUBLIC void
+update_holding(int g, int pieceCaptured)
{
- int p = piecetype(pieceCaptured);
- int c = colorval(pieceCaptured);
- game_state_t *gs = &garray[g].game_state;
- int pp, pl;
- char tmp1[80], tmp2[80];
-
- if (c == WHITE) {
- c = 0;
- pp = garray[g].white;
- } else {
- c = 1;
- pp = garray[g].black;
- }
- gs->holding[c][p-1]++;
- tmp1[0] = '\0';
- append_holding_machine(tmp1, g, c, p);
- sprintf(tmp2, "Game %d %s received: %s -> [%s]\n", g+1,
- parray[pp].name, wpstring[p], holding_str(gs->holding[c]));
- for (pl = 0; pl < p_num; pl++) {
- if (parray[pl].status == PLAYER_EMPTY)
- continue;
- if (player_is_observe(pl, g) || (parray[pl].game == g)) {
- pprintf_prompt(pl, IsMachineStyle(parray[pl].style) ? tmp1 : tmp2);
+ char tmp1[80];
+ char tmp2[80];
+ game_state_t *gs = &garray[g].game_state;
+ int c = colorval(pieceCaptured);
+ int p = piecetype(pieceCaptured);
+ int pp, pl;
+
+ if (c == WHITE) {
+ c = 0;
+ pp = garray[g].white;
+ } else {
+ c = 1;
+ pp = garray[g].black;
+ }
+
+ gs->holding[c][p - 1]++;
+
+ tmp1[0] = '\0';
+ append_holding_machine(tmp1, g, c, p);
+
+ sprintf(tmp2, "Game %d %s received: %s -> [%s]\n",
+ (g + 1),
+ parray[pp].name,
+ wpstring[p],
+ holding_str(gs->holding[c]));
+
+ for (pl = 0; pl < p_num; pl++) {
+ if (parray[pl].status == PLAYER_EMPTY)
+ continue;
+
+ if (player_is_observe(pl, g) || parray[pl].game == g) {
+ pprintf_prompt(pl, (IsMachineStyle(parray[pl].style) ?
+ tmp1 : tmp2));
+ }
}
- }
}
PUBLIC char *