aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-21 17:06:51 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-21 17:06:51 +0200
commit88911a92eda456905fab1f7eeb3b279b3d06600e (patch)
tree218c38b9303b1b5ce27cc0ae605a762ca8d4081c /FICS
parentbe4f2217783b5bfa2c1d39cb3a7116b9fa850534 (diff)
Reformatted com_sposition()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/obsproc.c104
1 files changed, 60 insertions, 44 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c
index ba47f0b..62e13f0 100644
--- a/FICS/obsproc.c
+++ b/FICS/obsproc.c
@@ -1129,53 +1129,69 @@ PUBLIC int com_smoves(int p, param_list param)
return COM_OK;
}
-PUBLIC int com_sposition(int p, param_list param)
+PUBLIC int
+com_sposition(int p, param_list param)
{
- int wp, wconnected, bp, bconnected, confused = 0;
- int g;
+ int g;
+ int wp, wconnected, bp, bconnected, confused = 0;
- if (!FindPlayer(p, param[0].val.word, &wp, &wconnected))
- return (COM_OK);
- if (!FindPlayer(p, param[1].val.word, &bp, &bconnected)) {
- if (!wconnected)
- player_remove(wp);
- return (COM_OK);
- }
+ if (!FindPlayer(p, param[0].val.word, &wp, &wconnected))
+ return (COM_OK);
+ if (!FindPlayer(p, param[1].val.word, &bp, &bconnected)) {
+ if (!wconnected)
+ player_remove(wp);
+ return (COM_OK);
+ }
- g = game_new();
- if (game_read(g, wp, bp) < 0) { /* if no game white-black, */
- if (game_read(g, bp, wp) < 0) { /* look for black-white */
- confused = 1;
- pprintf(p, "There is no stored game %s vs. %s\n", parray[wp].name, parray[bp].name);
- } else {
- int tmp;
- tmp = wp;
- wp = bp;
- bp = tmp;
- tmp = wconnected;
- wconnected = bconnected;
- bconnected = tmp;
- }
- }
- if (!confused) {
- if ((wp != p) && (bp != p) && (garray[g].private) && (parray[p].adminLevel < ADMIN_ADMIN)) {
- pprintf(p, "Sorry, that is a private game.\n");
- } else {
- garray[g].white = wp;
- garray[g].black = bp;
- garray[g].startTime = tenth_secs();
- garray[g].lastMoveTime = garray[g].startTime;
- garray[g].lastDecTime = garray[g].startTime;
- pprintf(p, "Position of stored game %s vs. %s\n", parray[wp].name, parray[bp].name);
- send_board_to(g, p);
- }
- }
- game_remove(g);
- if (!wconnected)
- player_remove(wp);
- if (!bconnected)
- player_remove(bp);
- return COM_OK;
+ g = game_new();
+
+ if (game_read(g, wp, bp) < 0) { // if no game white-black,
+ if (game_read(g, bp, wp) < 0) { // look for black-white
+ confused = 1;
+
+ pprintf(p, "There is no stored game %s vs. %s\n",
+ parray[wp].name,
+ parray[bp].name);
+ } else {
+ int tmp;
+
+ tmp = wp;
+ wp = bp;
+ bp = tmp;
+ tmp = wconnected;
+ wconnected = bconnected;
+ bconnected = tmp;
+ }
+ }
+
+ if (!confused) {
+ if ((wp != p) &&
+ (bp != p) &&
+ (garray[g].private) &&
+ (parray[p].adminLevel < ADMIN_ADMIN)) {
+ pprintf(p, "Sorry, that is a private game.\n");
+ } else {
+ garray[g].white = wp;
+ garray[g].black = bp;
+ garray[g].startTime = tenth_secs();
+ garray[g].lastMoveTime = garray[g].startTime;
+ garray[g].lastDecTime = garray[g].startTime;
+
+ pprintf(p, "Position of stored game %s vs. %s\n",
+ parray[wp].name,
+ parray[bp].name);
+
+ send_board_to(g, p);
+ }
+ }
+
+ game_remove(g);
+
+ if (!wconnected)
+ player_remove(wp);
+ if (!bconnected)
+ player_remove(bp);
+ return COM_OK;
}
PUBLIC int