diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-10-09 03:42:17 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-10-09 03:42:17 +0800 |
commit | 562481a4082d411a19b1468ba6b5bd5a1da7be6f (patch) | |
tree | 3cddf9d2d8f7ef26162ddcbe82ca8ec00b6c55d5 /util | |
parent | e45938e7be8491bf1115137c9d86e821b8f41526 (diff) | |
download | pttbbs-562481a4082d411a19b1468ba6b5bd5a1da7be6f.tar pttbbs-562481a4082d411a19b1468ba6b5bd5a1da7be6f.tar.gz pttbbs-562481a4082d411a19b1468ba6b5bd5a1da7be6f.tar.bz2 pttbbs-562481a4082d411a19b1468ba6b5bd5a1da7be6f.tar.lz pttbbs-562481a4082d411a19b1468ba6b5bd5a1da7be6f.tar.xz pttbbs-562481a4082d411a19b1468ba6b5bd5a1da7be6f.tar.zst pttbbs-562481a4082d411a19b1468ba6b5bd5a1da7be6f.zip |
order by play count>0 first
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2231 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r-- | util/shmctl.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/util/shmctl.c b/util/shmctl.c index e1864dab..fa950016 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -174,23 +174,39 @@ cmputmpfrom(const void *i, const void *j) static int cmputmpfive(const void *i, const void *j) { + userinfo_t *a=(*((userinfo_t **) i)),*b=(*((userinfo_t **) j)); + int played_a=(a->five_win+a->five_lose+a->five_lose)!=0; + int played_b=(b->five_win+b->five_lose+b->five_lose)!=0; int type; - if ((type = (*((userinfo_t **) j))->five_win - (*((userinfo_t **) i))->five_win)) + + if ((type = played_b - played_a)) + return type; + if (played_a == 0) + return 0; + if ((type = b->five_win - a->five_win)) return type; - if ((type = (*((userinfo_t **) i))->five_lose - (*((userinfo_t **) j))->five_lose)) + if ((type = a->five_lose - b->five_lose)) return type; - return (*((userinfo_t **) i))->five_tie - (*((userinfo_t **) j))->five_tie; + return a->five_tie - b->five_tie; } static int cmputmpchc(const void *i, const void *j) { + userinfo_t *a=(*((userinfo_t **) i)),*b=(*((userinfo_t **) j)); + int played_a=(a->chc_win+a->chc_lose+a->chc_lose)!=0; + int played_b=(b->chc_win+b->chc_lose+b->chc_lose)!=0; int type; - if ((type = (*((userinfo_t **) j))->chc_win - (*((userinfo_t **) i))->chc_win)) + + if ((type = played_b - played_a)) return type; - if ((type = (*((userinfo_t **) i))->chc_lose - (*((userinfo_t **) j))->chc_lose)) + if (played_a == 0) + return 0; + if ((type = b->chc_win - a->chc_win)) + return type; + if ((type = a->chc_lose - b->chc_lose)) return type; - return (*((userinfo_t **) i))->chc_tie - (*((userinfo_t **) j))->chc_tie; + return a->chc_tie - b->chc_tie; } static int |