diff options
-rw-r--r-- | include/chess.h | 1 | ||||
-rw-r--r-- | mbbsd/chc.c | 2 | ||||
-rw-r--r-- | mbbsd/chess.c | 5 | ||||
-rw-r--r-- | mbbsd/gomo.c | 2 |
4 files changed, 10 insertions, 0 deletions
diff --git a/include/chess.h b/include/chess.h index 904db6cf..d9284110 100644 --- a/include/chess.h +++ b/include/chess.h @@ -121,6 +121,7 @@ typedef struct ChessInfo { typedef struct ChessActions { /* initial */ void (*init_user) (const userinfo_t* uinfo, ChessUser* user); + void (*init_user_rec)(const userec_t* uinfo, ChessUser* user); void (*init_board) (void* board); /* playing */ diff --git a/mbbsd/chc.c b/mbbsd/chc.c index 37831aa1..ec42a460 100644 --- a/mbbsd/chc.c +++ b/mbbsd/chc.c @@ -38,6 +38,7 @@ typedef struct { /* chess framework action functions */ static void chc_init_user(const userinfo_t *uinfo, ChessUser *user); +static void chc_init_user_userec(const userec_t *urec, ChessUser *user); static void chc_init_board(board_t board); static void chc_drawline(const ChessInfo* info, int line); static void chc_movecur(int r, int c); @@ -99,6 +100,7 @@ static char * const hint_str[] = { static const ChessActions chc_actions = { &chc_init_user, + &chc_init_user_userec, (void (*) (void*)) &chc_init_board, &chc_drawline, &chc_movecur, diff --git a/mbbsd/chess.c b/mbbsd/chess.c index b35d386f..d5263bf9 100644 --- a/mbbsd/chess.c +++ b/mbbsd/chess.c @@ -1141,6 +1141,7 @@ ChessInitUser(ChessInfo* info) { char userid[2][IDLEN + 1]; const userinfo_t* uinfo; + userec_t urec; switch (info->mode) { case CHESS_MODE_PERSONAL: @@ -1166,10 +1167,14 @@ ChessInitUser(ChessInfo* info) uinfo = search_ulist_userid(userid[0]); if (uinfo) info->actions->init_user(uinfo, &info->user1); + else if (getuser(userid, &urec)) + info->actions->init_user_rec(&urec, &info->user1); uinfo = search_ulist_userid(userid[1]); if (uinfo) info->actions->init_user(uinfo, &info->user2); + else if (getuser(userid, &urec)) + info->actions->init_user_rec(&urec, &info->user2); } #ifdef CHESSCOUNTRY diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c index 872648e5..d1487b4e 100644 --- a/mbbsd/gomo.c +++ b/mbbsd/gomo.c @@ -27,6 +27,7 @@ typedef char (*board_p)[BRDSIZ]; #endif static void gomo_init_user(const userinfo_t* uinfo, ChessUser* user); +static void gomo_init_user_userec(const userec_t* urec, ChessUser* user); static void gomo_init_board(board_t board); static void gomo_drawline(const ChessInfo* info, int line); static void gomo_movecur(int r, int c); @@ -41,6 +42,7 @@ static void gomo_genlog(ChessInfo* info, FILE* fp, ChessGameResult result); ChessActions gomo_actions = { &gomo_init_user, + &gomo_init_user_userec, (void (*)(void*)) &gomo_init_board, &gomo_drawline, &gomo_movecur, |