/[LeafOK_CVS]/pvpgn-1.7.4/src/bnetd/ladder.h
ViewVC logotype

Annotation of /pvpgn-1.7.4/src/bnetd/ladder.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Tue Jun 6 03:41:37 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: pvpgn_1-7-4-0_MIL, arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-chdr
no message

1 sysadm 1.1 /*
2     * Copyright (C) 1999 Rob Crittenden (rcrit@greyoak.com)
3     * Copyright (C) 1999,2000 Ross Combs (rocombs@cs.nmsu.edu)
4     *
5     * This program is free software; you can redistribute it and/or
6     * modify it under the terms of the GNU General Public License
7     * as published by the Free Software Foundation; either version 2
8     * of the License, or (at your option) any later version.
9     *
10     * This program is distributed in the hope that it will be useful,
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     * GNU General Public License for more details.
14     *
15     * You should have received a copy of the GNU General Public License
16     * along with this program; if not, write to the Free Software
17     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18     */
19     #ifndef INCLUDED_LADDER_TYPES
20     #define INCLUDED_LADDER_TYPES
21    
22     #ifdef LADDER_INTERNAL_ACCESS
23    
24     #ifdef JUST_NEED_TYPES
25     # include "account.h"
26     # include "ladder_binary.h"
27     # include "common/tag.h"
28     #else
29     # define JUST_NEED_TYPES
30     # include "account.h"
31     # include "ladder_binary.h"
32     # include "common/tag.h"
33     # undef JUST_NEED_TYPES
34     #endif
35    
36     #endif
37    
38     #define W3_XPCALC_MAXLEVEL 50
39    
40    
41     typedef enum
42     {
43     ladder_sort_highestrated,
44     ladder_sort_mostwins,
45     ladder_sort_mostgames
46     } t_ladder_sort;
47    
48     typedef enum
49     {
50     ladder_time_active,
51     ladder_time_current
52     } t_ladder_time;
53    
54     typedef enum
55     {
56     ladder_id_none=0,
57     ladder_id_normal=1,
58     ladder_id_ironman=3,
59     ladder_id_solo=5,
60     ladder_id_team=6,
61     ladder_id_ffa=7
62     } t_ladder_id;
63    
64     extern char * ladder_id_str[];
65    
66     typedef enum
67     {
68     ladder_option_none=0,
69     ladder_option_disconnectisloss=1
70     } t_ladder_option;
71    
72     typedef struct ladder_internal
73     #ifdef LADDER_INTERNAL_ACCESS
74     {
75     int uid;
76     int xp;
77     int level;
78     unsigned int teamcount; // needed for AT ladder
79     t_account *account;
80     struct ladder_internal *prev; // user with less XP
81     struct ladder_internal *next; // user with more XP
82     }
83     #endif
84     t_ladder_internal;
85    
86     typedef struct ladder
87     #ifdef LADDER_INTERNAL_ACCESS
88     {
89     t_ladder_internal *first;
90     t_ladder_internal *last;
91     int dirty; // 0==no changes, 1==something changed
92     t_binary_ladder_types type;
93     t_clienttag clienttag;
94     t_ladder_id ladder_id;
95     }
96     #endif
97     t_ladder;
98    
99     #ifdef LADDER_INTERNAL_ACCESS
100    
101     typedef struct
102     {
103     int startxp, neededxp, lossfactor, mingames;
104     } t_xplevel_entry;
105    
106     typedef struct
107     {
108     int higher_winxp, higher_lossxp, lower_winxp, lower_lossxp;
109     } t_xpcalc_entry;
110     #endif
111    
112     #endif
113    
114     /*****/
115     #ifndef JUST_NEED_TYPES
116     #ifndef INCLUDED_LADDER_PROTOS
117     #define INCLUDED_LADDER_PROTOS
118    
119     #define JUST_NEED_TYPES
120     #include "account.h"
121     #include "game.h"
122     #include "ladder_calc.h"
123     #include "ladder_binary.h"
124     #include "common/tag.h"
125     #undef JUST_NEED_TYPES
126    
127     extern int ladder_init_account(t_account * account, t_clienttag clienttag, t_ladder_id id);
128     extern int ladder_check_map(char const * mapname, t_game_maptype maptype, t_clienttag clienttag);
129    
130     extern t_account * ladder_get_account_by_rank(unsigned int rank, t_ladder_sort lsort, t_ladder_time ltime, t_clienttag clienttag, t_ladder_id id);
131     extern unsigned int ladder_get_rank_by_account(t_account * account, t_ladder_sort lsort, t_ladder_time ltime, t_clienttag clienttag, t_ladder_id id);
132    
133     extern int ladder_update(t_clienttag clienttag, t_ladder_id id, unsigned int count, t_account * * players, t_game_result * results, t_ladder_info * info, t_ladder_option opns);
134    
135     extern int ladderlist_make_all_active(void);
136    
137     extern int ladder_createxptable(const char *xplevelfile, const char *xpcalcfile);
138     extern void ladder_destroyxptable(void);
139    
140     extern int ladder_war3_xpdiff(unsigned int winnerlevel, unsigned int looserlevel, int *, int *);
141     extern int ladder_war3_updatelevel(unsigned int oldlevel, int xp);
142     extern int ladder_war3_get_min_xp(unsigned int level);
143     extern int war3_get_maxleveldiff(void);
144    
145    
146     extern int war3_ladder_add(t_ladder *ladder, int uid, int xp, int level, t_account *account, unsigned int teamcount,t_clienttag clienttag);
147     // this function adds a user to the ladder and keeps the ladder sorted
148     // returns 0 if everything is fine and -1 when error occured
149    
150     extern int war3_ladder_update(t_ladder *ladder, int uid, int xp, int level, t_account *account, unsigned int teamcount);
151     // this functions increases the xp of user with UID uid and corrects ranking
152     // returns 0 if everything is fine
153     // if user is not yet in ladder, he gets added automatically
154    
155     extern int ladder_get_rank(t_ladder *ladder, int uid, unsigned int teamcount, t_clienttag clienttag);
156     // this function returns the rank of a user with a given uid
157     // returns 0 if no such user is found
158    
159     extern int ladder_update_all_accounts(void);
160     // write the correct ranking information to all user accounts
161     // and cut down ladder size to given limit
162    
163     extern int ladders_write_to_file(void);
164     // outputs the ladders into files - for the guys that wanna make ladder pages
165    
166     extern void ladders_init(void);
167     // initialize the ladders
168    
169     extern void ladders_destroy(void);
170     // remove all ladder data from memory
171    
172     extern void ladders_load_accounts_to_ladderlists(void);
173     // enters all accounts from accountlist into the ladders
174    
175     extern void ladder_reload_conf(void);
176     // reloads relevant parameters from bnetd.conf (xml/std mode for ladder)
177    
178     extern t_account * ladder_get_account(t_ladder *ladder,int rank, unsigned int * teamcount, t_clienttag clienttag);
179     // returns the account that is on specified rank in specified ladder. also return teamcount for AT ladder
180     // returns NULL if this rank is still vacant
181    
182     extern t_ladder * solo_ladder(t_clienttag clienttag);
183     extern t_ladder * team_ladder(t_clienttag clienttag);
184     extern t_ladder * ffa_ladder(t_clienttag clienttag);
185     extern t_ladder * at_ladder(t_clienttag clienttag);
186     extern t_ladder * ladder_ar(t_clienttag clienttag, t_ladder_id ladder_id);
187     extern t_ladder * ladder_aw(t_clienttag clienttag, t_ladder_id ladder_id);
188     extern t_ladder * ladder_ag(t_clienttag clienttag, t_ladder_id ladder_id);
189     extern t_ladder * ladder_cr(t_clienttag clienttag, t_ladder_id ladder_id);
190     extern t_ladder * ladder_cw(t_clienttag clienttag, t_ladder_id ladder_id);
191     extern t_ladder * ladder_cg(t_clienttag clienttag, t_ladder_id ladder_id);
192    
193     // for external clienttag specific reference of the ladders
194    
195     extern int ladder_get_from_ladder(t_binary_ladder_types type, int rank, int * results);
196     extern int ladder_put_into_ladder(t_binary_ladder_types type, int * values);
197    
198     #endif
199     #endif
200    
201     extern char * create_filename(const char * path, const char * filename, const char * ending);
202     // Add by DJP for output.c

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