summaryrefslogtreecommitdiffstats
path: root/mbbsd/assess.c
blob: cc5e84b1e68b9c706ab65d47e4ac6fa9d729a340 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "bbs.h"

inline static void inc(unsigned char *num)
{
    if (*num < SALE_MAXVALUE)
    (*num)++;
}

void inc_goodpost(int uid)
{
    passwd_query(uid, &xuser);
    inc(&xuser.goodpost);
    passwd_update(uid, &xuser);
}

void inc_badpost(int uid)
{
    passwd_query(uid, &xuser);
    inc(&xuser.badpost);
    passwd_update(uid, &xuser);
}

void inc_goodsale(int uid)
{
    passwd_query(uid, &xuser);
    inc(&xuser.goodsale);
    passwd_update(uid, &xuser);
}

void inc_badsale(int uid)
{
    passwd_query(uid, &xuser);
    inc(&xuser.badsale);
    passwd_update(uid, &xuser);
}

void set_assess(int uid, unsigned char num, int type)
{
    passwd_query(uid, &xuser);
    switch (type){
    case GOODPOST:
        xuser.goodpost = num;
        break;
    case BADPOST:
        xuser.badpost = num;
        break;
    case GOODSALE:
        xuser.goodsale = num;
        break;
    case BADSALE:
        xuser.badsale = num;
        break;
    }
    passwd_update(uid, &xuser);
}