aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-28 16:00:59 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-28 16:00:59 +0200
commitb380936e6bdc3f69082f8f43ddf6c90440ebfc47 (patch)
treecc8c091cf9d299a90e38239db70d12de996d78ef /FICS
parentd3c386c90fda388721949610d79c9db4903236d1 (diff)
Reformatted do_observe()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/obsproc.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c
index e1f93b5..687d644 100644
--- a/FICS/obsproc.c
+++ b/FICS/obsproc.c
@@ -177,30 +177,40 @@ PUBLIC int com_games(int p, param_list param)
return COM_OK;
}
-PRIVATE int do_observe(int p, int obgame)
+PRIVATE int
+do_observe(int p, int obgame)
{
- if ((garray[obgame].private) && (parray[p].adminLevel < ADMIN_ADMIN)) {
- pprintf(p, "Sorry, game %d is a private game.\n", obgame + 1);
- return COM_OK;
- }
- if ((garray[obgame].white == p) || (garray[obgame].black == p)) {
- if (garray[obgame].status != GAME_EXAMINE) {
- pprintf(p, "You cannot observe a game that you are playing.\n");
- return COM_OK;
- }
- }
- if (player_is_observe(p, obgame)) {
- pprintf(p, "Removing game %d from observation list.\n", obgame + 1);
- player_remove_observe(p, obgame);
- } else {
- if (!player_add_observe(p, obgame)) {
- pprintf(p, "You are now observing game %d.\n", obgame + 1);
- send_board_to(obgame, p);
- } else {
- pprintf(p, "You are already observing the maximum number of games.\n");
- }
- }
- return COM_OK;
+ if (garray[obgame].private &&
+ parray[p].adminLevel < ADMIN_ADMIN) {
+ pprintf(p, "Sorry, game %d is a private game.\n", (obgame + 1));
+ return COM_OK;
+ }
+
+ if (garray[obgame].white == p ||
+ garray[obgame].black == p) {
+ if (garray[obgame].status != GAME_EXAMINE) {
+ pprintf(p, "You cannot observe a game that you are "
+ "playing.\n");
+ return COM_OK;
+ }
+ }
+
+ if (player_is_observe(p, obgame)) {
+ pprintf(p, "Removing game %d from observation list.\n",
+ (obgame + 1));
+ player_remove_observe(p, obgame);
+ } else {
+ if (!player_add_observe(p, obgame)) {
+ pprintf(p, "You are now observing game %d.\n",
+ (obgame + 1));
+ send_board_to(obgame, p);
+ } else {
+ pprintf(p, "You are already observing the maximum "
+ "number of games.\n");
+ }
+ }
+
+ return COM_OK;
}
PUBLIC void