diff options
-rw-r--r-- | include/pttstruct.h | 10 | ||||
-rw-r--r-- | mbbsd/cache.c | 5 | ||||
-rw-r--r-- | mbbsd/menu.c | 39 |
3 files changed, 21 insertions, 33 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h index 6e879f92..6b396b04 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -569,14 +569,16 @@ typedef struct { char notes[MAX_MOVIE][256*11]; char gap_18[sizeof(int)]; char today_is[20]; - // FIXME remove never_used__n_notes & never_used__next_refresh - int never_used__n_notes[MAX_MOVIE_SECTION]; /* 一節中有幾個 看板 */ + // FIXME remove it + int __never_used__n_notes[MAX_MOVIE_SECTION]; /* 一節中有幾個 看板 */ char gap_19[sizeof(int)]; - int never_used__next_refresh[MAX_MOVIE_SECTION]; /* 下一次要refresh的 看板 */ + // FIXME remove it + int __never_used__next_refresh[MAX_MOVIE_SECTION]; /* 下一次要refresh的 看板 */ char gap_20[sizeof(int)]; msgque_t loginmsg; /* 進站水球 */ int max_film; - int max_history; + // FIXME remove it + int __never_used__max_history; time4_t Puptime; time4_t Ptouchtime; int Pbusystate; diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 45c21f06..b721c82b 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -885,11 +885,6 @@ reload_pttcache(void) fclose(fp); } SHM->max_film = id - 1; - SHM->max_history = SHM->max_film - 2; - if (SHM->max_history > MAX_HISTORY - 1) - SHM->max_history = MAX_HISTORY - 1; - if (SHM->max_history < 0) - SHM->max_history = 0; fp = fopen("etc/today_is", "r"); if (fp) { diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 00e670f4..62e80ea2 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -156,37 +156,28 @@ show_status(void) outs(ANSI_RESET); } +/* + * 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); // ... + */ void -movie(int i) +movie(int state) { - static short history[MAX_HISTORY]; - int j; - + int i; if ((currstat != CLASS) && (cuser.uflag & MOVIE_FLAG) && !SHM->Pbusystate && SHM->max_film > 0) { - if (currstat == PSALE) { - i = PSALE; - reload_money(); + if (state == PSALE) { + reload_money(); // XXX why reload_money here? + i = state; + } else if (state == 999) { /* Goodbye my friend */ + i = 0; } else { - do { - if (!i) - i = 1 + (int)(((float)SHM->max_film * - random()) / (RAND_MAX + 1.0)); - - for (j = SHM->max_history; j >= 0; j--) - if (i == history[j]) { - i = 0; - break; - } - } while (i == 0); + i = 1 + (int)(((float)SHM->max_film * random()) / (RAND_MAX + 1.0)); } - memmove(history, &history[1], SHM->max_history * sizeof(short)); - history[SHM->max_history] = j = i; - - if (i == 999) /* Goodbye my friend */ - i = 0; - move(1, 0); clrtoline(1 + FILMROW); /* 清掉上次的 */ out_lines(SHM->notes[i], 11); /* 只印11行就好 */ |