From 56abc87c416464be55ab90ea63ed8be3a09f00fe Mon Sep 17 00:00:00 2001 From: piaip Date: Tue, 4 Dec 2007 08:03:42 +0000 Subject: - pmore: add random for goto git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3627 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/pmore.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 5b5f424a..4c35145e 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -3287,9 +3287,29 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end) else if (*p == 'G') { // GOTO - // Gt+-n + // Gt+-n,t+-n,t+-n (random select one) // jump +-n of type(l,p,f) + // random select, if multiple + unsigned char *pe = p; + unsigned int igs = 0; + + for (pe = p ; pe < end && *pe && + *pe > ' ' && *pe < 0x80 + ; pe ++) + if (*pe == ',') igs++; + + if (igs) + { + for (pe = p ; igs > 0 && pe < end && *pe && + *pe > ' ' && *pe < 0x80 + ; pe ++) + if (*pe == ',') igs--; + + if (pe != p) + p = pe-1; + } + mf_movieExecuteOffsetCmd(p+1, end); MOVIECMD_SKIP_ALL(p,end); return p; -- cgit v1.2.3