/[LeafOK_CVS]/lbbs/src/bbs.c
ViewVC logotype

Diff of /lbbs/src/bbs.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.32 by sysadm, Thu Oct 23 14:49:24 2025 UTC Revision 1.33 by sysadm, Thu Oct 23 15:45:41 2025 UTC
# Line 62  static const int astro_dates[] = { Line 62  static const int astro_dates[] = {
62  static const char *astro_names[] = {  static const char *astro_names[] = {
63          "摩羯", "水瓶", "双鱼", "白羊", "金牛", "双子", "巨蟹", "狮子", "处女", "天秤", "天蝎", "射手", "摩羯"};          "摩羯", "水瓶", "双鱼", "白羊", "金牛", "双子", "巨蟹", "狮子", "处女", "天秤", "天蝎", "射手", "摩羯"};
64    
65  static const int user_level_points[] = {  static const int BBS_user_level_points[] = {
66          INT_MIN, // 0          INT_MIN, // 0
67          50,              // 1          50,              // 1
68          200,     // 2          200,     // 2
# Line 82  static const int user_level_points[] = { Line 82  static const int user_level_points[] = {
82          INT_MAX, // 16          INT_MAX, // 16
83  };  };
84    
85  static const char *user_level_names[] = {  static const char *BBS_user_level_names[] = {
86          "新手上路", // 0          "新手上路", // 0
87          "初来乍练", // 1          "初来乍练", // 1
88          "白手起家", // 2          "白手起家", // 2
# Line 101  static const char *user_level_names[] = Line 101  static const char *user_level_names[] =
101          "★★★★★",        // 15          "★★★★★",        // 15
102  };  };
103    
104  static const int user_level_cnt = sizeof(user_level_names) / sizeof(const char *);  static const int BBS_user_level_cnt = sizeof(BBS_user_level_names) / sizeof(const char *);
105    
106  const char *get_astro_name(time_t birthday)  const char *get_astro_name(time_t birthday)
107  {  {
# Line 117  const char *get_astro_name(time_t birthd Line 117  const char *get_astro_name(time_t birthd
117          return astro_names[tm_birth.tm_mon + 1];          return astro_names[tm_birth.tm_mon + 1];
118  }  }
119    
120  const char *get_user_level_name(int point)  int get_user_level(int point)
121  {  {
122          int left;          int left;
123          int right;          int right;
124          int mid;          int mid;
125    
126          left = 0;          left = 0;
127          right = user_level_cnt - 1;          right = BBS_user_level_cnt - 1;
128    
129          while (left < right)          while (left < right)
130          {          {
131                  mid = (left + right) / 2;                  mid = (left + right) / 2;
132                  if (point < user_level_points[mid + 1])                  if (point < BBS_user_level_points[mid + 1])
133                  {                  {
134                          right = mid;                          right = mid;
135                  }                  }
136                  else if (point > user_level_points[mid + 1])                  else if (point > BBS_user_level_points[mid + 1])
137                  {                  {
138                          left = mid + 1;                          left = mid + 1;
139                  }                  }
# Line 144  const char *get_user_level_name(int poin Line 144  const char *get_user_level_name(int poin
144                  }                  }
145          }          }
146    
147          return user_level_names[left];          return left;
148    }
149    
150    const char *get_user_level_name(int level)
151    {
152            return BBS_user_level_names[level];
153  }  }
154    
155  char *setuserfile(char *buf, size_t len, const char *filename)  char *setuserfile(char *buf, size_t len, const char *filename)


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1