diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-05-02 11:39:36 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-05-02 11:39:36 +0800 |
commit | 45e2fad473ccdeb47eeb271b25a67b909a957e29 (patch) | |
tree | d5c57231da714904f6a5e8bf464a6f3dad080150 | |
parent | f27721b033d921e063c039db94a133fc9ddefaa7 (diff) | |
download | pttbbs-45e2fad473ccdeb47eeb271b25a67b909a957e29.tar pttbbs-45e2fad473ccdeb47eeb271b25a67b909a957e29.tar.gz pttbbs-45e2fad473ccdeb47eeb271b25a67b909a957e29.tar.bz2 pttbbs-45e2fad473ccdeb47eeb271b25a67b909a957e29.tar.lz pttbbs-45e2fad473ccdeb47eeb271b25a67b909a957e29.tar.xz pttbbs-45e2fad473ccdeb47eeb271b25a67b909a957e29.tar.zst pttbbs-45e2fad473ccdeb47eeb271b25a67b909a957e29.zip |
fixed movie in some state
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3508 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/pttstruct.h | 2 | ||||
-rw-r--r-- | mbbsd/admin.c | 2 | ||||
-rw-r--r-- | mbbsd/cache.c | 4 | ||||
-rw-r--r-- | mbbsd/menu.c | 38 | ||||
-rw-r--r-- | mbbsd/xyz.c | 2 |
5 files changed, 29 insertions, 19 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h index 6b396b04..db5eb794 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -576,7 +576,7 @@ typedef struct { int __never_used__next_refresh[MAX_MOVIE_SECTION]; /* 下一次要refresh的 看板 */ char gap_20[sizeof(int)]; msgque_t loginmsg; /* 進站水球 */ - int max_film; + int last_film; // FIXME remove it int __never_used__max_history; time4_t Puptime; diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 67ae9d4b..41b776f7 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -786,7 +786,7 @@ x_file(void) fpath = "etc/Logout"; break; case 'k': - mouts(b_lines - 3, 0, "1.摩羯 2.水瓶 3.雙魚 4.白羊 5.金牛 6.雙子"); + mouts(b_lines - 3, 0, "1.摩羯 2.水瓶 3.雙魚 4.牡羊 5.金牛 6.雙子"); mouts(b_lines - 2, 0, "7.巨蟹 8.獅子 9.處女 10.天秤 11.天蠍 12.射手"); getdata(b_lines - 1, 0, "請選擇 [1-12]", ans, sizeof(ans), LCECHO); num = atoi(ans); diff --git a/mbbsd/cache.c b/mbbsd/cache.c index b721c82b..6c961592 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -852,7 +852,7 @@ reload_pttcache(void) int id; SHM->Pbusystate = 1; - SHM->max_film = 0; + SHM->last_film = 0; bzero(SHM->notes, sizeof(SHM->notes)); setapath(pbuf, "Note"); setadir(buf, pbuf); @@ -884,7 +884,7 @@ reload_pttcache(void) } fclose(fp); } - SHM->max_film = id - 1; + SHM->last_film = id - 1; fp = fopen("etc/today_is", "r"); if (fp) { diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 62e80ea2..7e30af4b 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -160,23 +160,32 @@ show_status(void) * current callee of movie: * board.c: movie(0); // called when IN_CLASSROOT() * // with currstat = CLASS -> don't show movies - * xyz.c: movie(999); // logout - * menu.c: movie(currstat); // ... + * xyz.c: movie(999999); // logout + * menu.c: movie(cmdmode); // ... */ void -movie(int state) +movie(int cmdmode) { + // movie 前幾筆是 Note 板精華區「<系統> 動態看板」(SYS) 目錄下的文章 + // movie_map 是用來依 cmdmode 挑出特定的動態看板,index 跟 mode_map 一樣。 + const int movie_map[] = { + 2, 10, 11, -1, 3, -1, 12, + 7, 9, 8, 4, 5, 6, + }; + +#define N_SYSMOVIE (sizeof(movie_map) / sizeof(movie_map[0])) int i; if ((currstat != CLASS) && (cuser.uflag & MOVIE_FLAG) && - !SHM->Pbusystate && SHM->max_film > 0) { - if (state == PSALE) { - reload_money(); // XXX why reload_money here? - i = state; - } else if (state == 999) { /* Goodbye my friend */ + !SHM->Pbusystate && SHM->last_film > 0) { + if (cmdmode < sizeof(movie_map) / sizeof(movie_map[0]) && + 0 < movie_map[cmdmode] && movie_map[cmdmode] <= SHM->last_film) { + i = movie_map[cmdmode]; + } else if (cmdmode == 999999) { /* Goodbye my friend */ i = 0; } else { - i = 1 + (int)(((float)SHM->max_film * random()) / (RAND_MAX + 1.0)); + i = N_SYSMOVIE + (int)(((float)SHM->last_film - N_SYSMOVIE + 1) * (rand() / (RAND_MAX + 1.0))); } +#undef N_SYSMOVIE move(1, 0); clrtoline(1 + FILMROW); /* 清掉上次的 */ @@ -188,12 +197,12 @@ movie(int state) } static int -show_menu(const commands_t * p) +show_menu(int moviemode, const commands_t * p) { register int n = 0; register char *s; - movie(currstat); + movie(moviemode); move(menu_row, 0); while ((s = p[n].desc)) { @@ -220,12 +229,13 @@ static const int mode_map[] = { static void domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) { - int lastcmdptr; + int lastcmdptr, moviemode; int n, pos, total, i; int err; static char cursor_position[sizeof(mode_map) / sizeof(mode_map[0])] = { 0 }; + moviemode = cmdmode; cmdmode = mode_map[cmdmode]; if (cursor_position[cmdmode]) @@ -235,7 +245,7 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) showtitle(cmdtitle, BBSName); - total = show_menu(cmdtable); + total = show_menu(moviemode, cmdtable); show_status(); lastcmdptr = pos = 0; @@ -345,7 +355,7 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) if (refscreen) { showtitle(cmdtitle, BBSName); - show_menu(cmdtable); + show_menu(moviemode, cmdtable); show_status(); refscreen = NA; diff --git a/mbbsd/xyz.c b/mbbsd/xyz.c index f5dae9df..0b6b1141 100644 --- a/mbbsd/xyz.c +++ b/mbbsd/xyz.c @@ -345,7 +345,7 @@ Goodbye(void) if (*genbuf != 'y') return 0; - movie(999); + movie(999999); if (cuser.userlevel) { getdata(b_lines - 1, 0, "(G)隨風而逝 (M)托夢站長 (N)酸甜苦辣流言板?[G] ", |