summaryrefslogtreecommitdiffstats
path: root/mbbsd/chc.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-09 12:42:53 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-09 12:42:53 +0800
commit40fafbfba1a53581e9318c71d6366a24470173be (patch)
tree065380a6e4881de9c51609773d048f165b8fc988 /mbbsd/chc.c
parentfc5bd5742759eea401ffa112d696a3fe028675d1 (diff)
downloadpttbbs-40fafbfba1a53581e9318c71d6366a24470173be.tar
pttbbs-40fafbfba1a53581e9318c71d6366a24470173be.tar.gz
pttbbs-40fafbfba1a53581e9318c71d6366a24470173be.tar.bz2
pttbbs-40fafbfba1a53581e9318c71d6366a24470173be.tar.lz
pttbbs-40fafbfba1a53581e9318c71d6366a24470173be.tar.xz
pttbbs-40fafbfba1a53581e9318c71d6366a24470173be.tar.zst
pttbbs-40fafbfba1a53581e9318c71d6366a24470173be.zip
fix chc bug, but still buggy
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2184 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/chc.c')
-rw-r--r--mbbsd/chc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mbbsd/chc.c b/mbbsd/chc.c
index 5ab93a00..759c9749 100644
--- a/mbbsd/chc.c
+++ b/mbbsd/chc.c
@@ -5,8 +5,6 @@
#define CHC_TIMEOUT 300
#define CHC_LOG "chc_log" /* log file name */
-extern userinfo_t *uip;
-
typedef int (*play_func_t) (int, chcusr_t *, chcusr_t *, board_t, board_t);
typedef struct drc_t {
@@ -197,14 +195,16 @@ chc_drawline(board_t board, chcusr_t *user1, chcusr_t *user2, int line)
j = board[RTL(line)][i];
if ((line & 1) == 1 && j) {
if (chc_selected &&
- chc_select.r == RTL(line) && chc_select.c == i)
+ chc_select.r == RTL(line) && chc_select.c == i) {
prints("%s%s\033[m",
CHE_O(j) == 0 ? BLACK_REVERSE : RED_REVERSE,
chess_str[CHE_O(j)][CHE_P(j)]);
- else
+ }
+ else {
prints("%s%s\033[m",
CHE_O(j) == 0 ? BLACK_COLOR : RED_COLOR,
chess_str[CHE_O(j)][CHE_P(j)]);
+ }
} else
prints("%c%c", chess_brd[line - 3][i * 4],
chess_brd[line - 3][i * 4 + 1]);
@@ -840,11 +840,17 @@ chc_watch_request(int signo)
return;
for(tmp = act_list; tmp->next != NULL; tmp = tmp->next);
tmp->next = (chc_act_list *)malloc(sizeof(chc_act_list));
+ tmp->next->sock = establish_talk_connection(&SHM->uinfo[currutmp->destuip]);
+ if (tmp->next->sock < 0) {
+ free(tmp->next);
+ tmp->next = NULL;
+ return;
+ }
+
tmp = tmp->next;
- tmp->sock = reply_connection_request(uip);
- if (tmp->sock < 0)
- return;
tmp->next = NULL;
+
+ /* what if the spectator get off-line intentionally !? (SIGPIPE) */
write(tmp->sock, chc_bp, sizeof(board_t));
write(tmp->sock, &chc_my, sizeof(chc_my));
write(tmp->sock, &chc_turn, sizeof(chc_turn));