Debian Codegraph @

src/d2cs/game.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2000,2001 Onlyer ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
19 #include "setup.h"cxx . . $ `<file>/src/d2cs/setup.h`/
20 #include "game.h"cxx . . $ `<file>/src/d2cs/game.h`/
21
22 #include <ctime>
23
24 #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/
25 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
26 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
27 #include "prefs.h"cxx . . $ `<file>/src/d2cs/prefs.h`/
28 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
29
30 namespace pvpgncxx . . $ pvpgn/
31 {
32
33 namespace d2cscxx . . $ pvpgn/d2cs/
34 {
35
36 static t_listcxx . . $ pvpgn/t_list# * gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
37 static t_elemcxx . . $ pvpgn/t_elem# const * gamelist_curr_elemcxx . . $ pvpgn/d2cs/gamelist_curr_elem. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
38 static unsigned int total_gamecxx . . $ pvpgn/d2cs/total_game. = 0;
39 static unsigned int game_idcxx . . $ pvpgn/d2cs/game_id. = 0;
40 static t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo# * game_find_charactercxx . . $ pvpgn/d2cs/game_find_character(e2b81557b3726a07).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, char const * charname);
41
42 extern t_listcxx . . $ pvpgn/t_list# * d2cs_gamelistcxx . . $ pvpgn/d2cs/d2cs_gamelist(7a6cb11de248e2c9).(void)
43 {
44 return gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head.;
45 }
46
47 extern t_elemcxx . . $ pvpgn/t_elem# const * gamelist_get_curr_elemcxx . . $ pvpgn/d2cs/gamelist_get_curr_elem(522bdc31dc152862).(void)
48 {
49 return gamelist_curr_elemcxx . . $ pvpgn/d2cs/gamelist_curr_elem.;
50 }
51
52 extern void gamelist_set_curr_elemcxx . . $ pvpgn/d2cs/gamelist_set_curr_elem(d3a4f890f2ebf374).(t_elemcxx . . $ pvpgn/t_elem# const * elem)
53 {
54 gamelist_curr_elemcxx . . $ pvpgn/d2cs/gamelist_curr_elem. = elem;
55 return;
56 }
57
58 extern int d2cs_gamelist_createcxx . . $ pvpgn/d2cs/d2cs_gamelist_create(b126dc7c1de90089).(void)
59 {
60 gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head. = list_createcxx . . $ pvpgn/list_create(7a6cb11de248e2c9).();
61 return 0;
62 }
63
64 extern int d2cs_gamelist_destroycxx . . $ pvpgn/d2cs/d2cs_gamelist_destroy(b126dc7c1de90089).(void)
65 {
66 t_gamecxx . . $ pvpgn/d2cs/t_game# * game;
67
68 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(gamelist_head, game, t_game)
69 {
70 game_destroycxx . . $ pvpgn/d2cs/game_destroy(35433708d3d50b5a).(game, &curr_elem_);
71 }
72 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!();
73
74 if (list_destroycxx . . $ pvpgn/list_destroy(20db0232078327de).(gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head.) < 0) {
75 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error destroy connection list");
76 return -1;
77 }
78 gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
79 return 0;
80 }
81
82 extern t_gamecxx . . $ pvpgn/d2cs/t_game# * d2cs_gamelist_find_gamecxx . . $ pvpgn/d2cs/d2cs_gamelist_find_game(6da516f6176bdca0).(char const * gamename)
83 {
84 t_gamecxx . . $ pvpgn/d2cs/t_game# * game;
85
86 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(gamename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
87 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(gamelist_head, game, t_game)
88 {
89 if (!strcasecmp(game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name., gamename)) return game;
90 }
91 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!()
92 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
93 }
94
95 extern t_gamecxx . . $ pvpgn/d2cs/t_game# * gamelist_find_game_by_idcxx . . $ pvpgn/d2cs/gamelist_find_game_by_id(f476a3e7e1ba51cb).(unsigned int id)
96 {
97 t_gamecxx . . $ pvpgn/d2cs/t_game# * game;
98
99 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(gamelist_head, game, t_game)
100 {
101 if (game->idcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#id. == id) return game;
102 }
103 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!()
104 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
105 }
106
107 extern t_gamecxx . . $ pvpgn/d2cs/t_game# * gamelist_find_game_by_d2gs_and_idcxx . . $ pvpgn/d2cs/gamelist_find_game_by_d2gs_and_id(8574b6076fa391a1).(unsigned int d2gs_id, unsigned int d2gs_gameid)
108 {
109 t_gamecxx . . $ pvpgn/d2cs/t_game# * game;
110
111 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(gamelist_head, game, t_game)
112 {
113 if (!game->createdcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#created.) continue;
114 if (game->d2gs_gameidcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs_gameid. != d2gs_gameid) continue;
115 if (d2gs_get_idcxx . . $ pvpgn/d2cs/d2gs_get_id(986de4a3f93bb0c3).(game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs.) != d2gs_id) continue;
116 return game;
117 }
118 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!()
119 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
120 }
121
122 extern t_gamecxx . . $ pvpgn/d2cs/t_game# * gamelist_find_charactercxx . . $ pvpgn/d2cs/gamelist_find_character(6da516f6176bdca0).(char const * charname)
123 {
124 t_gamecxx . . $ pvpgn/d2cs/t_game# * game;
125
126 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
127 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(gamelist_head, game, t_game)
128 {
129 if (game_find_charactercxx . . $ pvpgn/d2cs/game_find_character(e2b81557b3726a07).(game, charname)) return game;
130 }
131 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!();
132 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
133 }
134
135 extern void d2cs_gamelist_check_voidgamecxx . . $ pvpgn/d2cs/d2cs_gamelist_check_voidgame(49f6e7a06ebc5aa8).(void)
136 {
137 t_gamecxx . . $ pvpgn/d2cs/t_game# * game;
138 stdcxx . . $ std/::time_tcxx . . $ std/time_t# now;
139 int timeout;
140
141 timeout = prefs_get_max_game_idletimecxx . . $ pvpgn/d2cs/prefs_get_max_game_idletime(db52760e79bf9054).();
142 if (!timeout) return;
143 now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
144 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(gamelist_head, game, t_game)
145 {
146 if (!game->currcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#currchar.) {
147 if ((now - game->lastaccess_timecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#lastaccess_time.) > timeout) {
148 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "game {} is empty too long std::time,destroying it", game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.);
149 game_destroycxx . . $ pvpgn/d2cs/game_destroy(35433708d3d50b5a).(game, &curr_elem_);
150 }
151 }
152 }
153 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!()
154 }
155
156 extern t_gamecxx . . $ pvpgn/d2cs/t_game# * d2cs_game_createcxx . . $ pvpgn/d2cs/d2cs_game_create(402e99608713bada).(char const * gamename, char const * gamepass, char const * gamedesc,
157 unsigned int gameflag)
158 {
159 t_gamecxx . . $ pvpgn/d2cs/t_game# * game;
160 stdcxx . . $ std/::time_tcxx . . $ std/time_t# now;
161
162 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(gamename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
163 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(gamepass, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
164 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(gamedesc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
165 if (d2cs_gamelist_find_gamecxx . . $ pvpgn/d2cs/d2cs_gamelist_find_game(6da516f6176bdca0).(gamename)) {
166 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game {} already exist", gamename);
167 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
168 }
169 game = (t_gamecxx . . $ pvpgn/d2cs/t_game#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_game));
170 game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(gamename);
171 game->passcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#pass. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(gamepass);
172 game->desccxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#desc. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(gamedesc);
173 game->charlistcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlist. = list_createcxx . . $ pvpgn/list_create(7a6cb11de248e2c9).();
174 now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
175 game_idcxx . . $ pvpgn/d2cs/game_id.++;
176 if (game_idcxx . . $ pvpgn/d2cs/game_id. == 0) game_idcxx . . $ pvpgn/d2cs/game_id. = 1;
177 game->idcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#id. = game_idcxx . . $ pvpgn/d2cs/game_id.;
178 game->createdcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#created. = 0;
179 game->create_timecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#create_time. = now;
180 game->lastaccess_timecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#lastaccess_time. = now;
181 game->gameflagcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#gameflag. = gameflag;
182 game->charlevelcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlevel. = 0;
183 game->leveldiffcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#leveldiff. = 0;
184 game->d2gs_gameidcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs_gameid. = 0;
185 game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
186 game->maxcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#maxchar. = MAX_CHAR_PER_GAMEcxx . . $ `src/d2cs/setup.h:72:9`!;
187 game->currcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#currchar. = 0;
188 list_prepend_datacxx . . $ pvpgn/list_prepend_data(4e1348bd294d996f).(gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head., game);
189 total_gamecxx . . $ pvpgn/d2cs/total_game.++;
190 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "game {} pass={} desc={}gameflag=0x{:08X} created ({} total)", gamename, gamepass,
191 gamedesc, gameflag, total_gamecxx . . $ pvpgn/d2cs/total_game.);
192 return game;
193 }
194
195 extern int game_destroycxx . . $ pvpgn/d2cs/game_destroy(35433708d3d50b5a).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, t_elemcxx . . $ pvpgn/t_elem# ** elem)
196 {
197 t_elemcxx . . $ pvpgn/t_elem# * curr;
198 t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo# * charinfo;
199
200 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
201 if (gamelist_curr_elemcxx . . $ pvpgn/d2cs/gamelist_curr_elem. && (game == elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(gamelist_curr_elemcxx . . $ pvpgn/d2cs/gamelist_curr_elem.))) {
202 gamelist_curr_elemcxx . . $ pvpgn/d2cs/gamelist_curr_elem. = elem_get_next_constcxx . . $ pvpgn/elem_get_next_const(80a79b023e17a464).(gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head., gamelist_curr_elemcxx . . $ pvpgn/d2cs/gamelist_curr_elem.);
203 }
204 if (list_remove_datacxx . . $ pvpgn/list_remove_data(9d29d8ce7cabbadf).(gamelist_headcxx . . $ pvpgn/d2cs/gamelist_head., game, elem) < 0) {
205 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error remove game {} on game list", game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.);
206 return -1;
207 }
208 total_gamecxx . . $ pvpgn/d2cs/total_game.--;
209 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "game {} removed from game list ({} left)", game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name., total_gamecxx . . $ pvpgn/d2cs/total_game.);
210 LIST_TRAVERSEcxx . . $ `src/common/list.h:94:9`!(game->charlist, curr)
211 {
212 if ((charinfo = (t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo#*)elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(curr))) {
213 if (charinfo->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#charname.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)charinfo->charname);
214 xfreecxx . . $ `src/common/xalloc.h:51:9`!(charinfo);
215 }
216 list_remove_elemcxx . . $ pvpgn/list_remove_elem(17f7246ce0d3563b).(game->charlistcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlist., &curr);
217 }
218 list_destroycxx . . $ pvpgn/list_destroy(20db0232078327de).(game->charlistcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlist.);
219
220 if (game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs.) {
221 d2gs_add_gamenumcxx . . $ pvpgn/d2cs/d2gs_add_gamenum(2f5585d4df0bd933).(game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs., -1);
222 gqlist_check_creategamecxx . . $ pvpgn/d2cs/gqlist_check_creategame(7864480464b09eea).(d2gs_get_maxgamecxx . . $ pvpgn/d2cs/d2gs_get_maxgame(986de4a3f93bb0c3).(game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs.) - d2gs_get_gamenumcxx . . $ pvpgn/d2cs/d2gs_get_gamenum(986de4a3f93bb0c3).(game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs.));
223 }
224 if (game->desccxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#desc.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->desc);
225 if (game->passcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#pass.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->pass);
226 if (game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->name);
227 xfreecxx . . $ `src/common/xalloc.h:51:9`!(game);
228 return 0;
229 }
230
231 static t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo# * game_find_charactercxx . . $ pvpgn/d2cs/game_find_character(e2b81557b3726a07).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, char const * charname)
232 {
233 t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo# * charinfo;
234
235 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
236 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
237 if (!game->charlistcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlist.) {
238 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL character list in game {}", game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.);
239 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
240 }
241 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(game->charlist, charinfo, t_game_charinfo)
242 {
243 if (!charinfo->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#charname.) continue;
244 if (!strcmp_charnamecxx . . $ `src/d2cs/setup.h:23:9`!(charinfo->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#charname., charname)) return charinfo;
245 }
246 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!()
247 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
248 }
249
250 extern int game_add_charactercxx . . $ pvpgn/d2cs/game_add_character(c3db1e962ac9bee0).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, char const * charname, unsigned char chclass,
251 unsigned char level)
252 {
253 t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo# * charinfo;
254
255 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
256 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1);
257 charinfo = game_find_charactercxx . . $ pvpgn/d2cs/game_find_character(e2b81557b3726a07).(game, charname);
258 if (charinfo) {
259 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "updating character {} (game {}) status", charname, game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.);
260 charinfo->chclasscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#chclass. = chclass;
261 charinfo->levelcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#level. = level;
262 return 0;
263 }
264 charinfo = (t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_game_charinfo));
265 charinfo->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#charname. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(charname);
266 charinfo->chclasscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#chclass. = chclass;
267 charinfo->levelcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#level. = level;
268 list_append_datacxx . . $ pvpgn/list_append_data(4e1348bd294d996f).(game->charlistcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlist., charinfo);
269 game->currcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#currchar.++;
270 game->lastaccess_timecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#lastaccess_time. = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
271 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "added character {} to game {} ({} total)", charname, game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name., game->currcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#currchar.);
272 return 0;
273 }
274
275 extern int game_del_charactercxx . . $ pvpgn/d2cs/game_del_character(e30eb5f745b12d84).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, char const * charname)
276 {
277 t_game_charinfocxx . . $ pvpgn/d2cs/t_game_charinfo# * charinfo;
278 t_elemcxx . . $ pvpgn/t_elem# * elem;
279
280 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
281 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1);
282 if (!(charinfo = game_find_charactercxx . . $ pvpgn/d2cs/game_find_character(e2b81557b3726a07).(game, charname))) {
283 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "character {} not found in game {}", charname, game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.);
284 return -1;
285 }
286 if (list_remove_datacxx . . $ pvpgn/list_remove_data(9d29d8ce7cabbadf).(game->charlistcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlist., charinfo, &elem)) {
287 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error remove character {} from game {}", charname, game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.);
288 return -1;
289 }
290 if (charinfo->charnamecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_0#charname.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)charinfo->charname);
291 xfreecxx . . $ `src/common/xalloc.h:51:9`!(charinfo);
292 game->currcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#currchar.--;
293 game->lastaccess_timecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#lastaccess_time. = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
294 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "removed character {} from game {} ({} left)", charname, game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name., game->currcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#currchar.);
295 return 0;
296 }
297
298 extern int game_set_d2gs_gameidcxx . . $ pvpgn/d2cs/game_set_d2gs_gameid(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int d2gs_gameid)
299 {
300 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
301 game->d2gs_gameidcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs_gameid. = d2gs_gameid;
302 return 0;
303 }
304
305 extern unsigned int game_get_d2gs_gameidcxx . . $ pvpgn/d2cs/game_get_d2gs_gameid(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
306 {
307 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
308 return game->d2gs_gameidcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs_gameid.;
309 }
310
311 extern unsigned int d2cs_game_get_idcxx . . $ pvpgn/d2cs/d2cs_game_get_id(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
312 {
313 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
314 return game->idcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#id.;
315 }
316
317 extern unsigned int game_get_gameflag_laddercxx . . $ pvpgn/d2cs/game_get_gameflag_ladder(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
318 {
319 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
320 return gameflag_get_laddercxx . . $ `src/d2cs/game.h:67:9`!(game->gameflag);
321 }
322
323
324 extern int game_set_d2gscxx . . $ pvpgn/d2cs/game_set_d2gs(287452e9d86f7c48).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, t_d2gscxx . . $ pvpgn/d2cs/t_d2gs# * gs)
325 {
326 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
327 game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs. = gs;
328 return 0;
329 }
330
331 extern t_d2gscxx . . $ pvpgn/d2cs/t_d2gs# * game_get_d2gscxx . . $ pvpgn/d2cs/game_get_d2gs(d8ef2cc2a93b457).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
332 {
333 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
334 return game->d2gscxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#d2gs.;
335 }
336
337 extern int game_set_leveldiffcxx . . $ pvpgn/d2cs/game_set_leveldiff(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int leveldiff)
338 {
339 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
340 game->leveldiffcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#leveldiff. = leveldiff;
341 return 0;
342 }
343
344 extern int game_set_charlevelcxx . . $ pvpgn/d2cs/game_set_charlevel(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int charlevel)
345 {
346 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
347 game->charlevelcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlevel. = charlevel;
348 return 0;
349 }
350
351 extern unsigned int game_get_charlevelcxx . . $ pvpgn/d2cs/game_get_charlevel(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
352 {
353 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
354 return game->charlevelcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlevel.;
355 }
356
357 extern unsigned int game_get_leveldiffcxx . . $ pvpgn/d2cs/game_get_leveldiff(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
358 {
359 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
360 return game->leveldiffcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#leveldiff.;
361 }
362
363 extern unsigned int game_get_maxlevelcxx . . $ pvpgn/d2cs/game_get_maxlevel(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
364 {
365 int maxlevel;
366
367 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
368 maxlevel = game->charlevelcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlevel. + game->leveldiffcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#leveldiff.;
369 if (maxlevel > prefs_get_game_maxlevelcxx . . $ pvpgn/d2cs/prefs_get_game_maxlevel(db52760e79bf9054).())
370 maxlevel = prefs_get_game_maxlevelcxx . . $ pvpgn/d2cs/prefs_get_game_maxlevel(db52760e79bf9054).();
371 return maxlevel;
372 }
373
374 extern unsigned int game_get_minlevelcxx . . $ pvpgn/d2cs/game_get_minlevel(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
375 {
376 int minlevel;
377
378 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
379 minlevel = game->charlevelcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlevel. - game->leveldiffcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#leveldiff.;
380 if (minlevel < 0) minlevel = 0;
381 return minlevel;
382 }
383
384 extern unsigned int game_get_gameflag_expansioncxx . . $ pvpgn/d2cs/game_get_gameflag_expansion(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
385 {
386 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
387 return gameflag_get_expansioncxx . . $ `src/d2cs/game.h:66:9`!(game->gameflag);
388 }
389
390 extern unsigned int game_get_gameflag_hardcorecxx . . $ pvpgn/d2cs/game_get_gameflag_hardcore(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
391 {
392 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
393 return gameflag_get_hardcorecxx . . $ `src/d2cs/game.h:68:9`!(game->gameflag);
394 }
395
396 extern unsigned int game_get_gameflag_difficultycxx . . $ pvpgn/d2cs/game_get_gameflag_difficulty(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
397 {
398 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
399 return gameflag_get_difficultycxx . . $ `src/d2cs/game.h:65:9`!(game->gameflag);
400 }
401
402 extern int game_set_gameflag_laddercxx . . $ pvpgn/d2cs/game_set_gameflag_ladder(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int ladder)
403 {
404 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
405 gameflag_set_laddercxx . . $ `src/d2cs/game.h:76:9`!(game->gameflag, ladder);
406 return 0;
407 }
408
409 extern int game_set_gameflag_expansioncxx . . $ pvpgn/d2cs/game_set_gameflag_expansion(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int expansion)
410 {
411 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
412 gameflag_set_expansioncxx . . $ `src/d2cs/game.h:75:9`!(game->gameflag, expansion);
413 return 0;
414 }
415
416 extern int game_set_gameflag_hardcorecxx . . $ pvpgn/d2cs/game_set_gameflag_hardcore(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int hardcore)
417 {
418 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
419 gameflag_set_hardcorecxx . . $ `src/d2cs/game.h:77:9`!(game->gameflag, hardcore);
420 return 0;
421 }
422
423 extern int game_set_gameflag_difficultycxx . . $ pvpgn/d2cs/game_set_gameflag_difficulty(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int difficulty)
424 {
425 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
426 gameflag_set_difficultycxx . . $ `src/d2cs/game.h:74:9`!(game->gameflag, difficulty);
427 return 0;
428 }
429
430 extern unsigned int game_get_createdcxx . . $ pvpgn/d2cs/game_get_created(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
431 {
432 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
433 return game->createdcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#created.;
434 }
435
436 extern int game_set_createdcxx . . $ pvpgn/d2cs/game_set_created(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int created)
437 {
438 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
439 game->createdcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#created. = created;
440 return 0;
441 }
442
443 extern unsigned int game_get_maxcharcxx . . $ pvpgn/d2cs/game_get_maxchar(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
444 {
445 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
446 return game->maxcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#maxchar.;
447 }
448
449 extern int game_set_maxcharcxx . . $ pvpgn/d2cs/game_set_maxchar(b1b6f5a91b93abc1).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, unsigned int maxchar)
450 {
451 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
452 game->maxcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#maxchar. = maxchar;
453 return 0;
454 }
455
456 extern unsigned int game_get_currcharcxx . . $ pvpgn/d2cs/game_get_currchar(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
457 {
458 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
459 return game->currcharcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#currchar.;
460 }
461
462 extern char const * d2cs_game_get_namecxx . . $ pvpgn/d2cs/d2cs_game_get_name(d16e89b4cf68b40f).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
463 {
464 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
465 return game->namecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#name.;
466 }
467
468 extern char const * game_get_desccxx . . $ pvpgn/d2cs/game_get_desc(d16e89b4cf68b40f).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
469 {
470 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
471 return game->desccxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#desc.;
472 }
473
474 extern char const * d2cs_game_get_passcxx . . $ pvpgn/d2cs/d2cs_game_get_pass(d16e89b4cf68b40f).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
475 {
476 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
477 return game->passcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#pass.;
478 }
479
480 extern unsigned int game_get_gameflagcxx . . $ pvpgn/d2cs/game_get_gameflag(33681cfe92f0a311).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
481 {
482 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, 0);
483 return game->gameflagcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#gameflag.;
484 }
485
486 extern int d2cs_game_get_create_timecxx . . $ pvpgn/d2cs/d2cs_game_get_create_time(b198e66ed4b75071).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
487 {
488 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
489 return game->create_timecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#create_time.;
490 }
491
492 extern int game_set_create_timecxx . . $ pvpgn/d2cs/game_set_create_time(dabb4cff116e68c8).(t_gamecxx . . $ pvpgn/d2cs/t_game# * game, int create_time)
493 {
494 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, -1);
495 game->create_timecxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#create_time. = create_time;
496 return 0;
497 }
498
499 extern t_listcxx . . $ pvpgn/t_list# * game_get_charlistcxx . . $ pvpgn/d2cs/game_get_charlist(7b8f8c506dc6cd26).(t_gamecxx . . $ pvpgn/d2cs/t_game# const * game)
500 {
501 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(game, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
502 return game->charlistcxx . . $ pvpgn/d2cs/$anonymous_type_24810558b88c8e5a_1#charlist.;
503 }
504
505 extern unsigned int gamelist_get_totalgamecxx . . $ pvpgn/d2cs/gamelist_get_totalgame(db52760e79bf9054).(void)
506 {
507 return total_gamecxx . . $ pvpgn/d2cs/total_game.;
508 }
509
510 }
511
512 }