diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-02-26 12:00:08 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-02-26 12:00:08 +0800 |
commit | 6dd8c33c9da9019a7c8e1d85255d6f118ce0acef (patch) | |
tree | 2750ae1bd1856a712d9d45056b095089f07e39d1 | |
parent | 8a9bdc8996d0632a833bfe66f225f23b1e8ad40e (diff) | |
download | pttbbs-6dd8c33c9da9019a7c8e1d85255d6f118ce0acef.tar pttbbs-6dd8c33c9da9019a7c8e1d85255d6f118ce0acef.tar.gz pttbbs-6dd8c33c9da9019a7c8e1d85255d6f118ce0acef.tar.bz2 pttbbs-6dd8c33c9da9019a7c8e1d85255d6f118ce0acef.tar.lz pttbbs-6dd8c33c9da9019a7c8e1d85255d6f118ce0acef.tar.xz pttbbs-6dd8c33c9da9019a7c8e1d85255d6f118ce0acef.tar.zst pttbbs-6dd8c33c9da9019a7c8e1d85255d6f118ce0acef.zip |
- unify give_money in both userlist/g and menu/g.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3951 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/proto.h | 1 | ||||
-rw-r--r-- | mbbsd/cal.c | 14 | ||||
-rw-r--r-- | mbbsd/talk.c | 27 |
3 files changed, 15 insertions, 27 deletions
diff --git a/include/proto.h b/include/proto.h index 7475042d..57388817 100644 --- a/include/proto.h +++ b/include/proto.h @@ -183,6 +183,7 @@ int x_file(void); int give_money(void); int p_sysinfo(void); int do_give_money(char *id, int uid, int money); +int give_money_ui(const char *userid); int p_give(void); int p_cloak(void); int p_from(void); diff --git a/mbbsd/cal.c b/mbbsd/cal.c index 22d34d29..74dcaf4d 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -413,6 +413,13 @@ int do_give_money(char *id, int uid, int money) int p_give(void) { + give_money_ui(NULL); + return -1; +} + +int +give_money_ui(const char *userid) +{ int uid; char id[IDLEN + 1], money_buf[20]; char passbuf[PASSLEN]; @@ -422,7 +429,12 @@ p_give(void) // like user pw/id/... clear(); stand_title("給予金錢"); - usercomplete("這位幸運兒的id: ", id); + if (!userid || !*userid) + usercomplete("這位幸運兒的id: ", id); + else { + strlcpy(id, userid, sizeof(id)); + prints("這位幸運兒的id: %s\n", id); + } move(2, 0); clrtobot(); if (!id[0] || !strcasecmp(cuser.userid, id)) diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 6e6dea5e..122bf6ea 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -2933,32 +2933,7 @@ userlist(void) case 'g': if (HasUserPerm(PERM_LOGINOK) && strcmp(uentp->userid, cuser.userid) != 0) { - char genbuf[10]; - char userid[IDLEN + 1]; - int touid=uentp->uid; - strlcpy(userid, uentp->userid, sizeof(userid)); - move(b_lines - 2, 0); - prints("要給 %s 多少錢呢? ", userid); - if (getdata(b_lines - 1, 0, "[銀行轉帳]: ", - genbuf, 7, LCECHO)) { - clrtoeol(); - if ((ch = atoi(genbuf)) <= 0 || ch <= give_tax(ch)){ - redrawall = redraw = 1; - break; - } - if (getans("確定要給 %s %d " MONEYNAME " 幣嗎? [N/y]", - userid, ch) != 'y'){ - redrawall = redraw = 1; - break; - } - if (do_give_money(userid, touid, ch) < 0) - vmsgf("交易失敗,還剩下 %d 錢", SHM->money[usernum - 1]); - else - vmsgf("交易成功\,還剩下 %d 錢", SHM->money[usernum - 1]); - } else { - clrtoeol(); - vmsg(" 交易取消! "); - } + give_money_ui(uentp->userid); redrawall = redraw = 1; } break; |