Debian Codegraph @

src/bnetd/anongame.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2004 CreepLord ([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
19 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
20 #include "anongame.h"cxx . . $ `<file>/src/bnetd/anongame.h`/
21
22 #include <cstdint>
23 #include <cstdlib>
24 #include <cstring>
25
26 #include "compat/strdup.h"cxx . . $ `<file>/src/compat/strdup.h`/
27 #include "common/packet.h"cxx . . $ `<file>/src/common/packet.h`/
28 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
29 #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/
30 #include "common/queue.h"cxx . . $ `<file>/src/common/queue.h`/
31 #include "common/bn_type.h"cxx . . $ `<file>/src/common/bn_type.h`/
32 #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/
33 #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/
34 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
35 #include "common/trans.h"cxx . . $ `<file>/src/common/trans.h`/
36
37 #include "team.h"cxx . . $ `<file>/src/bnetd/team.h`/
38 #include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/
39 #include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/
40 #include "connection.h"cxx . . $ `<file>/src/bnetd/connection.h`/
41 #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/
42 #include "versioncheck.h"cxx . . $ `<file>/src/bnetd/versioncheck.h`/
43 #include "tournament.h"cxx . . $ `<file>/src/bnetd/tournament.h`/
44 #include "timer.h"cxx . . $ `<file>/src/bnetd/timer.h`/
45 #include "ladder.h"cxx . . $ `<file>/src/bnetd/ladder.h`/
46 #include "server.h"cxx . . $ `<file>/src/bnetd/server.h`/
47 #include "anongame_maplists.h"cxx . . $ `<file>/src/bnetd/anongame_maplists.h`/
48 #include "anongame_gameresult.h"cxx . . $ `<file>/src/bnetd/anongame_gameresult.h`/
49 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
50
51 #define MAX_LEVELcxx . . $ `src/bnetd/anongame.cpp:51:9`! 100
52
53 namespace pvpgncxx . . $ pvpgn/
54 {
55
56 namespace bnetdcxx . . $ pvpgn/bnetd/
57 {
58
59 /* [quetzal] 20020827 - this one get modified by anongame_queue player when there're enough
60 * players and map has been chosen based on their preferences. otherwise its NULL
61 */
62 static const char *mapnamecxx . . $ pvpgn/bnetd/mapname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
63
64 static int playerscxx . . $ pvpgn/bnetd/players.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
65 static t_connection *playercxx . . $ pvpgn/bnetd/player.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!][ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.];
66
67 /* [quetzal] 20020815 - queue to hold matching players */
68 static t_list *matchlistscxx . . $ pvpgn/bnetd/matchlists.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!][MAX_LEVELcxx . . $ `src/bnetd/anongame.cpp:51:9`!];
69
70 long average_anongame_search_timecxx . . $ pvpgn/bnetd/average_anongame_search_time. = 30;
71 unsigned int anongame_search_countcxx . . $ pvpgn/bnetd/anongame_search_count. = 0;
72
73 /**********************************************************************************/
74 static t_connection *_connlist_find_connection_by_uidcxx . . $ pvpgn/bnetd/_connlist_find_connection_by_uid(f341f3d34aa180c2).(int uid);
75
76 static int _anongame_gametype_to_queuecxx . . $ pvpgn/bnetd/_anongame_gametype_to_queue(9b79fb6aee4c0440).(int type, int gametype);
77 static int _anongame_level_by_queuecxx . . $ pvpgn/bnetd/_anongame_level_by_queue(fa505503af8860d0).(t_connection * c, int queue);
78 static const char * _get_map_from_prefscxx . . $ pvpgn/bnetd/_get_map_from_prefs(403ecb6956e7053b).(int queue, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# cur_prefs, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag);
79 static unsigned int _anongame_get_gametype_tabcxx . . $ pvpgn/bnetd/_anongame_get_gametype_tab(46cc46841198e427).(int queue);
80
81 static int _anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(int queue);
82 static int _anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(int queue);
83
84 static int _handle_anongame_searchcxx . . $ pvpgn/bnetd/_handle_anongame_search(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *packet);
85 static int _anongame_queuecxx . . $ pvpgn/bnetd/_anongame_queue(74f749354b453df3).(t_connection * c, int queue, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# map_prefs);
86 static int _anongame_compare_levelcxx . . $ pvpgn/bnetd/_anongame_compare_level(9148c8c3ff42c9d8).(void const *a, void const *b);
87 static int _anongame_order_queuecxx . . $ pvpgn/bnetd/_anongame_order_queue(7864480464b09eea).(int queue);
88 static int _anongame_matchcxx . . $ pvpgn/bnetd/_anongame_match(fa505503af8860d0).(t_connection * c, int queue);
89 static int _anongame_search_foundcxx . . $ pvpgn/bnetd/_anongame_search_found(7864480464b09eea).(int queue);
90 /**********************************************************************************/
91
92 static t_connection *_connlist_find_connection_by_uidcxx . . $ pvpgn/bnetd/_connlist_find_connection_by_uid(f341f3d34aa180c2).(int uid)
93 {
94 return connlist_find_connection_by_accountcxx . . $ pvpgn/bnetd/connlist_find_connection_by_account(831fe2ed2f0bd703).(accountlist_find_account_by_uidcxx . . $ pvpgn/bnetd/accountlist_find_account_by_uid(c4505e327c9ccd36).(uid));
95 }
96
97 /**********/
98
99 static char const *_anongame_queue_to_stringcxx . . $ pvpgn/bnetd/_anongame_queue_to_string(f7ae7e56280f18ae).(int queue)
100 {
101 switch (queue) {
102 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
103 return "PG 1v1";
104 case ANONGAME_TYPE_2V2cxx . . $ `src/common/anongame_protocol.h:449:9`!:
105 return "PG 2v2";
106 case ANONGAME_TYPE_3V3cxx . . $ `src/common/anongame_protocol.h:450:9`!:
107 return "PG 3v3";
108 case ANONGAME_TYPE_4V4cxx . . $ `src/common/anongame_protocol.h:451:9`!:
109 return "PG 4v4";
110 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
111 return "PG SFFA";
112 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
113 return "AT 2v2";
114 case ANONGAME_TYPE_TEAM_FFAcxx . . $ `src/common/anongame_protocol.h:454:9`!:
115 return "AT TFFA";
116 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
117 return "AT 3v3";
118 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
119 return "AT 4v4";
120 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
121 return "TOURNEY";
122 case ANONGAME_TYPE_5V5cxx . . $ `src/common/anongame_protocol.h:459:9`!:
123 return "PG 5v5";
124 case ANONGAME_TYPE_6V6cxx . . $ `src/common/anongame_protocol.h:460:9`!:
125 return "PG 6v6";
126 case ANONGAME_TYPE_2V2V2cxx . . $ `src/common/anongame_protocol.h:461:9`!:
127 return "PG 2v2v2";
128 case ANONGAME_TYPE_3V3V3cxx . . $ `src/common/anongame_protocol.h:462:9`!:
129 return "PG 3v3v3";
130 case ANONGAME_TYPE_4V4V4cxx . . $ `src/common/anongame_protocol.h:463:9`!:
131 return "PG 4v4v4";
132 case ANONGAME_TYPE_2V2V2V2cxx . . $ `src/common/anongame_protocol.h:464:9`!:
133 return "PG 2v2v2v2";
134 case ANONGAME_TYPE_3V3V3V3cxx . . $ `src/common/anongame_protocol.h:465:9`!:
135 return "PG 3v3v3v3";
136 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
137 return "AT 2v2v2";
138 default:
139 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid queue number {}", queue);
140 return "error";
141 }
142 }
143
144 static int _anongame_gametype_to_queuecxx . . $ pvpgn/bnetd/_anongame_gametype_to_queue(9b79fb6aee4c0440).(int type, int gametype)
145 {
146 switch (type) {
147 case 0: /* PG */
148 switch (gametype) {
149 case 0:
150 return ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!;
151 case 1:
152 return ANONGAME_TYPE_2V2cxx . . $ `src/common/anongame_protocol.h:449:9`!;
153 case 2:
154 return ANONGAME_TYPE_3V3cxx . . $ `src/common/anongame_protocol.h:450:9`!;
155 case 3:
156 return ANONGAME_TYPE_4V4cxx . . $ `src/common/anongame_protocol.h:451:9`!;
157 case 4:
158 return ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!;
159 case 5:
160 return ANONGAME_TYPE_5V5cxx . . $ `src/common/anongame_protocol.h:459:9`!;
161 case 6:
162 return ANONGAME_TYPE_6V6cxx . . $ `src/common/anongame_protocol.h:460:9`!;
163 case 7:
164 return ANONGAME_TYPE_2V2V2cxx . . $ `src/common/anongame_protocol.h:461:9`!;
165 case 8:
166 return ANONGAME_TYPE_3V3V3cxx . . $ `src/common/anongame_protocol.h:462:9`!;
167 case 9:
168 return ANONGAME_TYPE_4V4V4cxx . . $ `src/common/anongame_protocol.h:463:9`!;
169 case 10:
170 return ANONGAME_TYPE_2V2V2V2cxx . . $ `src/common/anongame_protocol.h:464:9`!;
171 case 11:
172 return ANONGAME_TYPE_3V3V3V3cxx . . $ `src/common/anongame_protocol.h:465:9`!;
173 default:
174 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid PG game type: {}", gametype);
175 return -1;
176 }
177 case 1: /* AT */
178 switch (gametype) {
179 case 0:
180 return ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!;
181 case 2:
182 return ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!;
183 case 3:
184 return ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!;
185 case 4:
186 return ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!;
187 default:
188 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid AT game type: {}", gametype);
189 return -1;
190 }
191 case 2: /* TY */
192 return ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!;
193 default:
194 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid type: {}", type);
195 return -1;
196 }
197 }
198
199 static int _anongame_level_by_queuecxx . . $ pvpgn/bnetd/_anongame_level_by_queue(fa505503af8860d0).(t_connection * c, int queue)
200 {
201 t_clienttagcxx . . $ pvpgn/t_clienttag# ct = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
202
203 switch (queue) {
204 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
205 return account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), ct, ladder_id_solocxx . . $ pvpgn/bnetd/ladder_id_solo.);
206 case ANONGAME_TYPE_2V2cxx . . $ `src/common/anongame_protocol.h:449:9`!:
207 case ANONGAME_TYPE_3V3cxx . . $ `src/common/anongame_protocol.h:450:9`!:
208 case ANONGAME_TYPE_4V4cxx . . $ `src/common/anongame_protocol.h:451:9`!:
209 case ANONGAME_TYPE_5V5cxx . . $ `src/common/anongame_protocol.h:459:9`!:
210 case ANONGAME_TYPE_6V6cxx . . $ `src/common/anongame_protocol.h:460:9`!:
211 case ANONGAME_TYPE_2V2V2cxx . . $ `src/common/anongame_protocol.h:461:9`!:
212 case ANONGAME_TYPE_3V3V3cxx . . $ `src/common/anongame_protocol.h:462:9`!:
213 case ANONGAME_TYPE_4V4V4cxx . . $ `src/common/anongame_protocol.h:463:9`!:
214 case ANONGAME_TYPE_2V2V2V2cxx . . $ `src/common/anongame_protocol.h:464:9`!:
215 case ANONGAME_TYPE_3V3V3V3cxx . . $ `src/common/anongame_protocol.h:465:9`!:
216 return account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), ct, ladder_id_ffacxx . . $ pvpgn/bnetd/ladder_id_ffa.);
217 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
218 case ANONGAME_TYPE_TEAM_FFAcxx . . $ `src/common/anongame_protocol.h:454:9`!:
219 return account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), ct, ladder_id_ffacxx . . $ pvpgn/bnetd/ladder_id_ffa.);
220 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
221 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
222 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
223 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
224 return 0;
225 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!: /* set to ((wins * 3) + ties - losses) ie. prelim score */
226 return tournament_get_player_scorecxx . . $ pvpgn/bnetd/tournament_get_player_score(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c));
227 default:
228 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "unknown queue: {}", queue);
229 return -1;
230 }
231 }
232
233 static const char * _get_map_from_prefscxx . . $ pvpgn/bnetd/_get_map_from_prefs(403ecb6956e7053b).(int queue, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# cur_prefs, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag)
234 {
235 int i, j = 0;
236 const char *default_map, *selected;
237 char *res_maps[32];
238 char clienttag_str[5];
239
240 switch (clienttag) {
241 case CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`!:
242 default_map = "Maps\\(8)PlainsOfSnow.w3m";
243 break;
244 case CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`!:
245 default_map = "Maps\\(8)PlainsOfSnow.w3m";
246 break;
247 default:
248 ERROR1cxx . . $ `src/common/eventlog.h:74:9`!("invalid clienttag: {}", tag_uint_to_str(clienttag_str, clienttag));
249 return "Maps\\(8)PlainsOfSnow.w3m";
250 }
251
252 for (i = 0; i < 32; i++)
253 res_maps[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
254
255 for (i = 0; i < 32; i++) {
256 if (cur_prefs & 1)
257 res_maps[j++] = maplists_get_mapcxx . . $ pvpgn/bnetd/maplists_get_map(825fca05dee0ea68).(queue, clienttag, i + 1);
258 cur_prefs >>= 1;
259 }
260
261 i = stdcxx . . $ std/::rand() % j;
262 if (res_maps[i])
263 selected = res_maps[i];
264 else
265 selected = default_map;
266
267 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "got map {} from prefs", selected);
268 return selected;
269 }
270
271 static unsigned int _anongame_get_gametype_tabcxx . . $ pvpgn/bnetd/_anongame_get_gametype_tab(46cc46841198e427).(int queue)
272 {
273 /* dizzy: this changed in 1.05 */
274 switch (queue) {
275 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
276 return SERVER_ANONGAME_SOLO_STRcxx . . $ `src/common/anongame_protocol.h:431:9`!;
277 case ANONGAME_TYPE_2V2cxx . . $ `src/common/anongame_protocol.h:449:9`!:
278 case ANONGAME_TYPE_3V3cxx . . $ `src/common/anongame_protocol.h:450:9`!:
279 case ANONGAME_TYPE_4V4cxx . . $ `src/common/anongame_protocol.h:451:9`!:
280 case ANONGAME_TYPE_5V5cxx . . $ `src/common/anongame_protocol.h:459:9`!:
281 case ANONGAME_TYPE_6V6cxx . . $ `src/common/anongame_protocol.h:460:9`!:
282 case ANONGAME_TYPE_2V2V2cxx . . $ `src/common/anongame_protocol.h:461:9`!:
283 case ANONGAME_TYPE_3V3V3cxx . . $ `src/common/anongame_protocol.h:462:9`!:
284 case ANONGAME_TYPE_4V4V4cxx . . $ `src/common/anongame_protocol.h:463:9`!:
285 case ANONGAME_TYPE_2V2V2V2cxx . . $ `src/common/anongame_protocol.h:464:9`!:
286 case ANONGAME_TYPE_3V3V3V3cxx . . $ `src/common/anongame_protocol.h:465:9`!:
287 return SERVER_ANONGAME_TEAM_STRcxx . . $ `src/common/anongame_protocol.h:432:9`!;
288 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
289 return SERVER_ANONGAME_SFFA_STRcxx . . $ `src/common/anongame_protocol.h:433:9`!;
290 case ANONGAME_TYPE_TEAM_FFAcxx . . $ `src/common/anongame_protocol.h:454:9`!:
291 return 0; /* Team FFA is no longer supported */
292 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
293 return SERVER_ANONGAME_AT2v2_STRcxx . . $ `src/common/anongame_protocol.h:434:9`!;
294 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
295 return SERVER_ANONGAME_AT3v3_STRcxx . . $ `src/common/anongame_protocol.h:435:9`!;
296 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
297 return SERVER_ANONGAME_AT4v4_STRcxx . . $ `src/common/anongame_protocol.h:436:9`!;
298 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
299 return SERVER_ANONGAME_AT2v2_STRcxx . . $ `src/common/anongame_protocol.h:434:9`!; /* fixme */
300 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
301 return SERVER_ANONGAME_TY_STRcxx . . $ `src/common/anongame_protocol.h:437:9`!;
302 default:
303 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid queue ({})", queue);
304 return 0;
305 }
306 }
307
308 static int _anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(int queue)
309 {
310 switch (queue) {
311 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
312 return 2;
313 case ANONGAME_TYPE_2V2cxx . . $ `src/common/anongame_protocol.h:449:9`!:
314 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
315 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!: /* fixme: total players not always 4 */
316 return 4;
317 case ANONGAME_TYPE_3V3cxx . . $ `src/common/anongame_protocol.h:450:9`!:
318 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
319 case ANONGAME_TYPE_2V2V2cxx . . $ `src/common/anongame_protocol.h:461:9`!:
320 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
321 return 6;
322 case ANONGAME_TYPE_4V4cxx . . $ `src/common/anongame_protocol.h:451:9`!:
323 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
324 case ANONGAME_TYPE_TEAM_FFAcxx . . $ `src/common/anongame_protocol.h:454:9`!:
325 case ANONGAME_TYPE_2V2V2V2cxx . . $ `src/common/anongame_protocol.h:464:9`!:
326 return 8;
327 case ANONGAME_TYPE_3V3V3cxx . . $ `src/common/anongame_protocol.h:462:9`!:
328 return 9;
329 case ANONGAME_TYPE_5V5cxx . . $ `src/common/anongame_protocol.h:459:9`!:
330 return 10;
331 case ANONGAME_TYPE_6V6cxx . . $ `src/common/anongame_protocol.h:460:9`!:
332 case ANONGAME_TYPE_4V4V4cxx . . $ `src/common/anongame_protocol.h:463:9`!:
333 case ANONGAME_TYPE_3V3V3V3cxx . . $ `src/common/anongame_protocol.h:465:9`!:
334 return 12;
335 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
336 return tournament_get_totalplayerscxx . . $ pvpgn/bnetd/tournament_get_totalplayers(b126dc7c1de90089).();
337 default:
338 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "unknown queue: {}", queue);
339 return 0;
340 }
341 }
342
343 static int _anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(int queue)
344 {
345 /* dont forget to change this if you make some game type with more teams */
346 #define ANONGAME_MAX_TEAMScxx . . $ `src/bnetd/anongame.cpp:346:9`! 4
347 switch (queue) {
348 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
349 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
350 return 0;
351 case ANONGAME_TYPE_2V2cxx . . $ `src/common/anongame_protocol.h:449:9`!:
352 case ANONGAME_TYPE_3V3cxx . . $ `src/common/anongame_protocol.h:450:9`!:
353 case ANONGAME_TYPE_4V4cxx . . $ `src/common/anongame_protocol.h:451:9`!:
354 case ANONGAME_TYPE_5V5cxx . . $ `src/common/anongame_protocol.h:459:9`!:
355 case ANONGAME_TYPE_6V6cxx . . $ `src/common/anongame_protocol.h:460:9`!:
356 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
357 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
358 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
359 return 2;
360 case ANONGAME_TYPE_2V2V2cxx . . $ `src/common/anongame_protocol.h:461:9`!:
361 case ANONGAME_TYPE_3V3V3cxx . . $ `src/common/anongame_protocol.h:462:9`!:
362 case ANONGAME_TYPE_4V4V4cxx . . $ `src/common/anongame_protocol.h:463:9`!:
363 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
364 return 3;
365 case ANONGAME_TYPE_TEAM_FFAcxx . . $ `src/common/anongame_protocol.h:454:9`!: /* not even used */
366 case ANONGAME_TYPE_2V2V2V2cxx . . $ `src/common/anongame_protocol.h:464:9`!:
367 case ANONGAME_TYPE_3V3V3V3cxx . . $ `src/common/anongame_protocol.h:465:9`!:
368 return 4;
369 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
370 return 2; /* fixme: does not support 2v2v2 - tournament_get_totalteams() */
371 default:
372 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "unknown queue: {}", queue);
373 return 0;
374 }
375 }
376
377 /**********/
378 static int _handle_anongame_searchcxx . . $ pvpgn/bnetd/_handle_anongame_search(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *packet)
379 {
380 int i, j, temp, set = 1;
381 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
382 t_connection *tc[6];
383 t_anongamecxx . . $ pvpgn/bnetd/t_anongame# *a, *ta;
384 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# teamsize = 0;
385 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# option = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongamecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame..optioncxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_1#option.);
386
387 if (!(a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(c))) {
388 if (!(a = conn_create_anongamecxx . . $ pvpgn/bnetd/conn_create_anongame(28581bdaae3fd375).(c))) {
389 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] conn_create_anongame failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
390 return -1;
391 }
392 }
393
394 conn_set_anongame_search_starttimecxx . . $ pvpgn/bnetd/conn_set_anongame_search_starttime(2bc578cf1171360f).(c, nowcxx . . $ pvpgn/bnetd/now.);
395
396 switch (option) {
397 case CLIENT_FINDANONGAME_AT_INVITER_SEARCHcxx . . $ `src/common/anongame_protocol.h:50:9`!:
398 a->countcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#count. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#count.);
399 a->idcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#id. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..idcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#id.);
400 a->tidcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tid. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..tidcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#tid.);
401 a->racecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#race. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..racecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#race.);
402 a->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#map_prefs. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..map_prefscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#map_prefs.);
403 a->typecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#type. = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..typecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#type.);
404 a->gametypecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#gametype. = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..gametypecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#gametype.);
405 teamsize = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..teamsizecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#teamsize.);
406 break;
407 case CLIENT_FINDANONGAME_AT_SEARCHcxx . . $ `src/common/anongame_protocol.h:49:9`!:
408 a->countcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#count. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_atcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_3#count.);
409 a->idcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#id. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_atcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at..idcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_3#id.);
410 a->tidcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tid. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_atcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at..tidcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_3#tid.);
411 a->racecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#race. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_atcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at..racecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_3#race.);
412 teamsize = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_atcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at..teamsizecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_3#teamsize.);
413 break;
414 case CLIENT_FINDANONGAME_SEARCHcxx . . $ `src/common/anongame_protocol.h:45:9`!:
415 a->countcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#count. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongamecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_1#count.);
416 a->idcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#id. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongamecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame..idcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_1#id.);
417 a->racecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#race. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongamecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame..racecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_1#race.);
418 a->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#map_prefs. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongamecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame..map_prefscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_1#map_prefs.);
419 a->typecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#type. = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongamecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame..typecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_1#type.);
420 a->gametypecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#gametype. = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongamecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame..gametypecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_1#gametype.);
421 break;
422 default:
423 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid search option ({})", option);
424 return -1;
425 }
426
427 if (option != CLIENT_FINDANONGAME_AT_SEARCHcxx . . $ `src/common/anongame_protocol.h:49:9`!)
428 if ((a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue. = _anongame_gametype_to_queuecxx . . $ pvpgn/bnetd/_anongame_gametype_to_queue(9b79fb6aee4c0440).(a->typecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#type., a->gametypecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#gametype.)) < 0) {
429 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid queue: {}", a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.);
430 return -1;
431 }
432
433 account_set_w3pgracecxx . . $ pvpgn/bnetd/account_set_w3pgrace(d1a42c0f2badce10).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), a->racecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#race.);
434
435 /* send search reply to client */
436 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
437 return -1;
438 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_anongame_search_replycxx . . $ pvpgn/t_server_anongame_search_reply#));
439 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ANONGAME_SEARCH_REPLYcxx . . $ `src/common/anongame_protocol.h:169:9`!);
440 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_search_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_search_reply..optioncxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_4#option., SERVER_FINDANONGAME_SEARCHcxx . . $ `src/common/anongame_protocol.h:56:9`!);
441 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_search_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_search_reply..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_4#count., a->countcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#count.);
442 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_search_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_search_reply..replycxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_4#reply., 0);
443 temp = (int)average_anongame_search_timecxx . . $ pvpgn/bnetd/average_anongame_search_time.;
444 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &temp, 2);
445 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
446 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
447 /* end search reply */
448
449 switch (option) {
450 case CLIENT_FINDANONGAME_AT_INVITER_SEARCHcxx . . $ `src/common/anongame_protocol.h:50:9`!:
451 for (i = 0; i < teamsize; i++) { /* assign player conns to tc[] array */
452 if (!(tc[i] = _connlist_find_connection_by_uidcxx . . $ pvpgn/bnetd/_connlist_find_connection_by_uid(f341f3d34aa180c2).(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_at_invcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at_inv..infocxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_2#info.[i])))) {
453 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got NULL connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(tc[i]));
454 return -1;
455 }
456 }
457 for (i = 0; i < teamsize; i++) { /* assign info from inviter to other team players */
458 if (!(ta = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(tc[i]))) {
459 if (!(ta = conn_create_anongamecxx . . $ pvpgn/bnetd/conn_create_anongame(28581bdaae3fd375).(tc[i]))) {
460 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] conn_create_anongame failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(tc[i]));
461 return -1;
462 }
463 }
464 for (j = 0; j < teamsize; j++) /* add each players conn to each anongame struct */
465 ta->tccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tc.[j] = tc[j];
466
467 ta->typecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#type. = a->typecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#type.;
468 ta->gametypecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#gametype. = a->gametypecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#gametype.;
469 ta->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue. = a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.;
470 ta->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#map_prefs. = a->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#map_prefs.;
471
472 if (ta->tidcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tid. != a->tidcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tid.)
473 set = 0;
474 }
475 if (!set) /* check if search packet has been recieved from each team member */
476 return 0;
477 break;
478 case CLIENT_FINDANONGAME_AT_SEARCHcxx . . $ `src/common/anongame_protocol.h:49:9`!:
479 for (i = 0; i < teamsize; i++) { /* assign player conns to tc[] array */
480 if (!(tc[i] = _connlist_find_connection_by_uidcxx . . $ pvpgn/bnetd/_connlist_find_connection_by_uid(f341f3d34aa180c2).(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_findanongame_atcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_findanongame_at..infocxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_3#info.[i])))) {
481 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got NULL connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(tc[i]));
482 return -1;
483 }
484 }
485 for (i = 0; i < teamsize; i++) { /* check if search packet has been recieved from each team member */
486 if (!(ta = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(tc[i])))
487 return 0;
488 if (ta->tidcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tid. != a->tidcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tid.)
489 return 0;
490 }
491 break;
492 case CLIENT_FINDANONGAME_SEARCHcxx . . $ `src/common/anongame_protocol.h:45:9`!:
493 tc[0] = c;
494 a->tccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tc.[0] = c;
495 break;
496 default:
497 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid search option ({})", option);
498 return -1;
499 }
500
501 if (_anongame_queuecxx . . $ pvpgn/bnetd/_anongame_queue(74f749354b453df3).(tc[0], a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue., a->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#map_prefs.) < 0) {
502 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "queue failed");
503 return -1;
504 }
505
506 _anongame_matchcxx . . $ pvpgn/bnetd/_anongame_match(fa505503af8860d0).(c, a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.);
507
508 /* if enough players are queued send found packet */
509 if (playerscxx . . $ pvpgn/bnetd/players.[a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.] == _anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.))
510 if (_anongame_search_foundcxx . . $ pvpgn/bnetd/_anongame_search_found(7864480464b09eea).(a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.) < 0)
511 return -1;
512
513 return 0;
514 }
515
516 static int _anongame_queuecxx . . $ pvpgn/bnetd/_anongame_queue(74f749354b453df3).(t_connection * c, int queue, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# map_prefs)
517 {
518 int level;
519 t_matchdatacxx . . $ pvpgn/bnetd/t_matchdata# *md;
520
521 if (!c) {
522 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection");
523 }
524
525 if (queue >= ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!) {
526 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "unknown queue: {}", queue);
527 return -1;
528 }
529
530 level = _anongame_level_by_queuecxx . . $ pvpgn/bnetd/_anongame_level_by_queue(fa505503af8860d0).(c, queue);
531
532 if (!matchlistscxx . . $ pvpgn/bnetd/matchlists.[queue][level])
533 matchlistscxx . . $ pvpgn/bnetd/matchlists.[queue][level] = list_createcxx . . $ pvpgn/list_create(7a6cb11de248e2c9).();
534
535 md = (t_matchdatacxx . . $ pvpgn/bnetd/t_matchdata#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_matchdata));
536 md->ccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#c. = c;
537 md->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#map_prefs. = map_prefs;
538 md->versiontagcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#versiontag. = conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c) ? conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).() : nullptr;
539
540 list_append_datacxx . . $ pvpgn/list_append_data(4e1348bd294d996f).(matchlistscxx . . $ pvpgn/bnetd/matchlists.[queue][level], md);
541
542 return 0;
543 }
544
545 static int _anongame_compare_levelcxx . . $ pvpgn/bnetd/_anongame_compare_level(9148c8c3ff42c9d8).(void const *a, void const *b)
546 {
547 t_connection *ca = *(t_connection * const *)a;
548 t_connection *cb = *(t_connection * const *)b;
549
550 int level_a = _anongame_level_by_queuecxx . . $ pvpgn/bnetd/_anongame_level_by_queue(fa505503af8860d0).(ca, anongame_get_queuecxx . . $ pvpgn/bnetd/anongame_get_queue(73d41d83ff85f81f).(conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(ca)));
551 int level_b = _anongame_level_by_queuecxx . . $ pvpgn/bnetd/_anongame_level_by_queue(fa505503af8860d0).(cb, anongame_get_queuecxx . . $ pvpgn/bnetd/anongame_get_queue(73d41d83ff85f81f).(conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(cb)));
552
553 return (level_a > level_b) ? -1 : ((level_a < level_b) ? 1 : 0);
554 }
555
556 static int _anongame_order_queuecxx . . $ pvpgn/bnetd/_anongame_order_queue(7864480464b09eea).(int queue)
557 {
558 if (_anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(queue) != 0 && !anongame_arrangedcxx . . $ pvpgn/bnetd/anongame_arranged(266ca1ce69549011).(queue)) { /* no need to reorder 1v1, sffa, or AT queues */
559 int i, j;
560 t_connection *temp;
561 int level[ANONGAME_MAX_TEAMScxx . . $ `src/bnetd/anongame.cpp:346:9`!];
562 int teams = _anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(queue); /* number of teams */
563 int ppt = (teams > 0) ? (playerscxx . . $ pvpgn/bnetd/players.[queue] / teams) : 0; /* players per team */
564
565 for (i = 0; i < ANONGAME_MAX_TEAMScxx . . $ `src/bnetd/anongame.cpp:346:9`!; i++)
566 level[i] = 0;
567
568 for (i = 0; i < ppt - 1; i++) { /* loop through the number of players per team */
569 for (j = 0; j < teams; j++) {
570 level[j] = level[j] + _anongame_level_by_queuecxx . . $ pvpgn/bnetd/_anongame_level_by_queue(fa505503af8860d0).(playercxx . . $ pvpgn/bnetd/player.[queue][i * ppt + j], queue);
571 }
572
573 if (teams == 2) {
574 /* 1 >= 2 */
575 if (level[i * teams] >= level[i * teams + 1]) {
576 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * teams];
577 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * teams] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * teams + 1];
578 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * teams + 1] = temp;
579 }
580 /* 2 >= 1 */
581 else if (level[i * teams + 1] >= level[i * teams]) {
582 ; /* nothing to do */
583 }
584 }
585 /* end 2 teams */
586 else if (teams == 3) {
587 /* 1 >= 2 >= 3 */
588 if (level[i * 3] >= level[i * 3 + 1] && level[i * 3 + 1] >= level[i * 3 + 2]) {
589 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3];
590 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2];
591 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2] = temp;
592 }
593 /* 1 >= 3 >= 2 */
594 else if (level[i * 3] >= level[i * 3 + 2] && level[i * 3 + 2] >= level[i * 3 + 1]) {
595 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3];
596 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2];
597 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1];
598 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1] = temp;
599 }
600 /* 2 >= 1 >= 3 */
601 else if (level[i * 3 + 1] >= level[i * 3] && level[i * 3] >= level[i * 3 + 2]) {
602 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3];
603 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1];
604 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2];
605 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2] = temp;
606 }
607 /* 2 >= 3 >= 1 */
608 else if (level[i * 3 + 1] >= level[i * 3 + 2] && level[i * 3 + 2] >= level[i * 3]) {
609 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1];
610 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2];
611 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 2] = temp;
612 }
613 /* 3 >= 1 >= 2 */
614 else if (level[i * 3 + 2] >= level[i * 3] && level[i * 3] >= level[i * 3 + 1]) {
615 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3];
616 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1];
617 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 3 + 1] = temp;
618 }
619 /* 3 >= 2 >= 1 */
620 else if (level[i * 3 + 2] >= level[i * 3 + 1] && level[i * 3 + 1] >= level[i * 3]) {
621 ; /* nothing to do */
622 }
623 }
624 /* end 3 teams */
625 else if (teams == 4) {
626 /* 1234 */
627 if (level[i * 4] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 3]) {
628 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
629 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
630 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
631 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
632 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
633 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
634 }
635 /* 1243 */
636 else if (level[i * 4] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 2] && level[i * 4 + 3] >= level[i * 4 + 2]) {
637 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
638 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
639 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
640 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
641 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
642 }
643 /* 1324 */
644 else if (level[i * 4] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 3]) {
645 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
646 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
647 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
648 }
649 /* 1342 */
650 else if (level[i * 4] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4 + 1]) {
651 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
652 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
653 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
654 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = temp;
655 }
656 /* 1423 */
657 else if (level[i * 4] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 2]) {
658 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
659 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
660 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
661 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
662 }
663 /* 1432 */
664 else if (level[i * 4] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 1]) {
665 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
666 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
667 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
668 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
669 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = temp;
670 }
671 /* 2134 */
672 else if (level[i * 4 + 1] >= level[i * 4] && level[i * 4] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 3]) {
673 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
674 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
675 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
676 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
677 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
678 }
679 /* 2143 */
680 else if (level[i * 4 + 1] >= level[i * 4] && level[i * 4] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4 + 2]) {
681 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
682 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
683 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
684 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
685 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
686 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
687 }
688 /* 2314 */
689 else if (level[i * 4 + 1] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4] && level[i * 4] >= level[i * 4 + 3]) {
690 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
691 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
692 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
693 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = temp;
694 }
695 /* 2341 */
696 else if (level[i * 4 + 1] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4]) {
697 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
698 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
699 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
700 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
701 }
702 /* 2413 */
703 else if (level[i * 4 + 1] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4] && level[i * 4] >= level[i * 4 + 2]) {
704 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
705 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
706 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
707 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
708 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
709 }
710 /* 2431 */
711 else if (level[i * 4 + 1] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4]) {
712 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
713 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
714 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
715 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
716 }
717 /* 3124 */
718 else if (level[i * 4 + 2] >= level[i * 4] && level[i * 4] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 3]) {
719 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
720 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
721 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
722 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
723 }
724 /* 3142 */
725 else if (level[i * 4 + 2] >= level[i * 4] && level[i * 4] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4 + 1]) {
726 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
727 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
728 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
729 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
730 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = temp;
731 }
732 /* 3214 */
733 else if (level[i * 4 + 2] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4] && level[i * 4] >= level[i * 4 + 3]) {
734 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
735 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
736 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
737 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
738 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
739 }
740 /* 3241 */
741 else if (level[i * 4 + 2] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4]) {
742 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
743 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
744 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
745 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
746 }
747 /* 3412 */
748 else if (level[i * 4 + 2] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4] && level[i * 4] >= level[i * 4 + 1]) {
749 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
750 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
751 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = temp;
752 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
753 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
754 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
755 }
756 /* 3421 */
757 else if (level[i * 4 + 2] >= level[i * 4 + 3] && level[i * 4 + 3] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4]) {
758 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
759 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3];
760 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 3] = temp;
761 }
762 /* 4123 */
763 else if (level[i * 4 + 3] >= level[i * 4] && level[i * 4] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 2]) {
764 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
765 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
766 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
767 }
768 /* 4132 */
769 else if (level[i * 4 + 3] >= level[i * 4] && level[i * 4] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 1]) {
770 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
771 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
772 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
773 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = temp;
774 }
775 /* 4213 */
776 else if (level[i * 4 + 3] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4] && level[i * 4] >= level[i * 4 + 2]) {
777 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
778 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
779 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
780 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
781 }
782 /* 4231 */
783 else if (level[i * 4 + 3] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4]) {
784 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
785 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2];
786 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 2] = temp;
787 }
788 /* 4312 */
789 else if (level[i * 4 + 3] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4] && level[i * 4] >= level[i * 4 + 1]) {
790 temp = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4];
791 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4] = playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1];
792 playercxx . . $ pvpgn/bnetd/player.[queue][(i + 1) * 4 + 1] = temp;
793 }
794 /* 4321 */
795 else if (level[i * 4 + 3] >= level[i * 4 + 2] && level[i * 4 + 2] >= level[i * 4 + 1] && level[i * 4 + 1] >= level[i * 4]) {
796 ; /* nothing to do */
797 }
798 } /* end 4 teams */
799 } /* end ppt loop */
800 } /* end "if" statement */
801 return 0;
802 }
803
804 static int _anongame_matchcxx . . $ pvpgn/bnetd/_anongame_match(fa505503af8860d0).(t_connection * c, int queue)
805 {
806 int level = _anongame_level_by_queuecxx . . $ pvpgn/bnetd/_anongame_level_by_queue(fa505503af8860d0).(c, queue);
807 int delta = 0;
808 int i;
809 t_matchdatacxx . . $ pvpgn/bnetd/t_matchdata# *md;
810 t_elem *curr;
811 int diff;
812 t_anongamecxx . . $ pvpgn/bnetd/t_anongame# *a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(c);
813 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# cur_prefs = a->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#map_prefs.;
814 t_connection *inv_c[ANONGAME_MAX_TEAMScxx . . $ `src/bnetd/anongame.cpp:346:9`!];
815 int maxlevel, minlevel;
816 int teams = 0;
817 playerscxx . . $ pvpgn/bnetd/players.[queue] = 0;
818
819 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] matching started for level {} player in queue {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), level, queue);
820
821 diff = war3_get_maxleveldiffcxx . . $ pvpgn/bnetd/war3_get_maxleveldiff(b126dc7c1de90089).();
822 maxlevel = level + diff;
823 minlevel = (level - diff < 0) ? 0 : level - diff;
824
825 while (abs(delta) < (diff + 1)) {
826 if ((level + delta <= maxlevel) && (level + delta >= minlevel)) {
827 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "Traversing level {} players", level + delta);
828
829 LIST_TRAVERSEcxx . . $ `src/common/list.h:94:9`!(matchlists[queue][level + delta], curr) {
830 md = (t_matchdatacxx . . $ pvpgn/bnetd/t_matchdata#*)elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(curr);
831 if (md->versiontagcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#versiontag.
832 && conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)
833 && !stdcxx . . $ std/::strcmp(md->versiontagcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#versiontag., conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).())
834 && (cur_prefs & md->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#map_prefs.))
835 {
836 /* set maxlevel and minlevel to keep all players within 6 levels */
837 maxlevel = (level + delta + diff < maxlevel) ? level + delta + diff : maxlevel;
838 minlevel = (level + delta - diff > minlevel) ? level + delta - diff : minlevel;
839 cur_prefs &= md->map_prefscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#map_prefs.;
840
841 /* AT match */
842 if (anongame_arrangedcxx . . $ pvpgn/bnetd/anongame_arranged(266ca1ce69549011).(queue)) {
843
844 /* set the inv_c for unqueueing later */
845 inv_c[teams] = md->ccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#c.;
846
847 a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(md->ccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#c.);
848
849 /* add all the players on the team to player[][] */
850 int totalplayers = _anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(queue);
851 int totalteams = _anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(queue);
852 int totalcount = (totalteams > 0) ? totalplayers / totalteams : 0;
853 for (i = 0; i < totalcount; i++) {
854 playercxx . . $ pvpgn/bnetd/player.[queue][teams + i * _anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(queue)] = a->tccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tc.[i];
855 playerscxx . . $ pvpgn/bnetd/players.[queue]++;
856 }
857 teams++;
858
859 /* check for enough players */
860 if (playerscxx . . $ pvpgn/bnetd/players.[queue] == _anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(queue)) {
861
862 /* unqueue just the single team entry */
863 for (i = 0; i < teams; i++)
864 anongame_unqueuecxx . . $ pvpgn/bnetd/anongame_unqueue(fa505503af8860d0).(inv_c[i], queue);
865
866 mapnamecxx . . $ pvpgn/bnetd/mapname. = _get_map_from_prefscxx . . $ pvpgn/bnetd/_get_map_from_prefs(403ecb6956e7053b).(queue, cur_prefs, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c));
867 return 0;
868 }
869
870 /* PG match */
871 }
872 else {
873 playercxx . . $ pvpgn/bnetd/player.[queue][playerscxx . . $ pvpgn/bnetd/players.[queue]++] = md->ccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#c.;
874
875 if (playerscxx . . $ pvpgn/bnetd/players.[queue] == _anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(queue)) {
876 /* first sort queue by level */
877 stdcxx . . $ std/::qsort(playercxx . . $ pvpgn/bnetd/player.[queue], playerscxx . . $ pvpgn/bnetd/players.[queue], sizeof(t_connection *), _anongame_compare_levelcxx . . $ pvpgn/bnetd/_anongame_compare_level(9148c8c3ff42c9d8).);
878 /* next call reodering function */
879 _anongame_order_queuecxx . . $ pvpgn/bnetd/_anongame_order_queue(7864480464b09eea).(queue);
880 /* unqueue players */
881 for (i = 0; i < playerscxx . . $ pvpgn/bnetd/players.[queue]; i++)
882 anongame_unqueuecxx . . $ pvpgn/bnetd/anongame_unqueue(fa505503af8860d0).(playercxx . . $ pvpgn/bnetd/player.[queue][i], queue);
883
884 mapnamecxx . . $ pvpgn/bnetd/mapname. = _get_map_from_prefscxx . . $ pvpgn/bnetd/_get_map_from_prefs(403ecb6956e7053b).(queue, cur_prefs, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c));
885 return 0;
886 }
887 }
888 }
889 }
890 }
891
892 if (delta <= 0 || level - delta < 0)
893 delta = abs(delta) + 1;
894 else
895 delta = -delta;
896
897 if (level + delta > MAX_LEVELcxx . . $ `src/bnetd/anongame.cpp:51:9`!)
898 delta = -delta;
899
900 if (level + delta < 0)
901 break; /* cant really happen */
902
903 }
904 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] Matching finished, not enough players (found {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), playerscxx . . $ pvpgn/bnetd/players.[queue]);
905 mapnamecxx . . $ pvpgn/bnetd/mapname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
906 return 0;
907 }
908
909 static int w3routeipcxx . . $ pvpgn/bnetd/w3routeip. = -1; /* changed by dizzy to show the w3routeshow addr if available */
910 static unsigned short w3routeportcxx . . $ pvpgn/bnetd/w3routeport. = BNETD_W3ROUTE_PORTcxx . . $ BNETD_W3ROUTE_PORT.;
911
912 static int _anongame_search_foundcxx . . $ pvpgn/bnetd/_anongame_search_found(7864480464b09eea).(int queue)
913 {
914 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
915 t_anongamecxx . . $ pvpgn/bnetd/t_anongame# *a;
916 int i, j;
917 t_saf_pt2cxx . . $ pvpgn/t_saf_pt2# *pt2;
918
919 /* FIXME: maybe periodically lookup w3routeaddr to support dynamic ips?
920 * (or should dns lookup be even quick enough to do it everytime?)
921 */
922
923 if (w3routeipcxx . . $ pvpgn/bnetd/w3routeip. == -1) {
924 t_addrcxx . . $ pvpgn/t_addr# *routeraddr;
925
926 routeraddr = addr_create_strcxx . . $ pvpgn/addr_create_str(1da662362765fa7c).(prefs_get_w3route_addrcxx . . $ pvpgn/bnetd/prefs_get_w3route_addr(33a1f659e94feb42).(), 0, BNETD_W3ROUTE_PORTcxx . . $ BNETD_W3ROUTE_PORT.);
927
928 if (!routeraddr) {
929 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error getting w3route_addr");
930 return -1;
931 }
932
933 w3routeipcxx . . $ pvpgn/bnetd/w3routeip. = addr_get_ipcxx . . $ pvpgn/addr_get_ip(9026149328323fab).(routeraddr);
934 w3routeportcxx . . $ pvpgn/bnetd/w3routeport. = addr_get_portcxx . . $ pvpgn/addr_get_port(51ac8fdf58f03e6a).(routeraddr);
935 addr_destroycxx . . $ pvpgn/addr_destroy(b8ff9276d6945afa).(routeraddr);
936 }
937
938 t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo#* const info = anongameinfo_createcxx . . $ pvpgn/bnetd/anongameinfo_create(d850d49e9fa50194).(_anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(queue));
939 if (!info)
940 {
941 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "anongameinfo_create failed");
942 return -1;
943 }
944
945 /* create data to be appended to end of packet */
946 pt2 = (t_saf_pt2cxx . . $ pvpgn/t_saf_pt2#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_saf_pt2));
947 bn_int_set(&pt2->unknown1cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_6#unknown1., 0xFFFFFFFF);
948 bn_int_set(&pt2->anongame_stringcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_6#anongame_string., _anongame_get_gametype_tabcxx . . $ pvpgn/bnetd/_anongame_get_gametype_tab(46cc46841198e427).(queue));
949 bn_byte_set(&pt2->totalplayerscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_6#totalplayers., _anongame_totalplayerscxx . . $ pvpgn/bnetd/_anongame_totalplayers(7864480464b09eea).(queue));
950 bn_byte_set(&pt2->totalteamscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_6#totalteams., _anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(queue)); /* 1v1 & sffa are set to zero in _anongame_totalteams() */
951 bn_short_set(&pt2->unknown2cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_6#unknown2., 0);
952 bn_byte_set(&pt2->visibilitycxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_6#visibility., 2); /* visibility. 0x01 - dark 0x02 - default */
953 bn_byte_set(&pt2->unknown3cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_6#unknown3., 2);
954
955 /* send found packet to each of the players */
956 for (i = 0; i < playerscxx . . $ pvpgn/bnetd/players.[queue]; i++)
957 {
958 if (!(a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(playercxx . . $ pvpgn/bnetd/player.[queue][i])))
959 {
960 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "no anongame struct for queued player");
961 xfreecxx . . $ `src/common/xalloc.h:51:9`!(pt2);
962 anongameinfo_destroycxx . . $ pvpgn/bnetd/anongameinfo_destroy(2779310e7a7a5560).(info);
963 return -1;
964 }
965
966 a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info. = info;
967 a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum. = i + 1;
968
969 for (j = 0; j < playerscxx . . $ pvpgn/bnetd/players.[queue]; j++) {
970 a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->playercxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#player.[j] = playercxx . . $ pvpgn/bnetd/player.[queue][j];
971 a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[j] = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(playercxx . . $ pvpgn/bnetd/player.[queue][j]);
972 }
973
974 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
975 xfreecxx . . $ `src/common/xalloc.h:51:9`!(pt2);
976 anongameinfo_destroycxx . . $ pvpgn/bnetd/anongameinfo_destroy(2779310e7a7a5560).(info);
977 return -1;
978 }
979
980 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_anongame_foundcxx . . $ pvpgn/t_server_anongame_found#));
981 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ANONGAME_FOUNDcxx . . $ `src/common/anongame_protocol.h:247:9`!);
982 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..optioncxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#option., 1);
983 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#count., a->countcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#count.);
984 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..unknown1cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#unknown1., 0);
985 { /* trans support */
986 unsigned int w3ip = w3routeipcxx . . $ pvpgn/bnetd/w3routeip.;
987 unsigned short w3port = w3routeportcxx . . $ pvpgn/bnetd/w3routeport.;
988
989 trans_netcxx . . $ pvpgn/trans_net(cf0ba8ec647fd542).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(playercxx . . $ pvpgn/bnetd/player.[queue][i]), &w3ip, &w3port);
990
991 /* if ip to send is 0.0.0.0 (which will not work anyway) try
992 * to guess the reachable IP of pvpgn by using the local
993 * endpoing address of the bnet class connection */
994 if (!w3ip)
995 w3ip = conn_get_real_local_addrcxx . . $ pvpgn/bnetd/conn_get_real_local_addr(8bd2285a65940781).(playercxx . . $ pvpgn/bnetd/player.[queue][i]);
996
997 bn_int_nset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..ipcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#ip., w3ip);
998 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..portcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#port., w3port);
999 }
1000 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..unknown2cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#unknown2., i + 1);
1001 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..unknown3cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#unknown3., queue);
1002 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..unknown4cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#unknown4., 0);
1003 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..idcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#id., 0xdeadbeef);
1004 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..unknown5cxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#unknown5., 6);
1005 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..typecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#type., a->typecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#type.);
1006 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_anongame_foundcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_anongame_found..gametypecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_5#gametype., a->gametypecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#gametype.);
1007 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, mapnamecxx . . $ pvpgn/bnetd/mapname.);
1008 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, pt2, sizeof(t_saf_pt2cxx . . $ pvpgn/t_saf_pt2#));
1009 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(playercxx . . $ pvpgn/bnetd/player.[queue][i], rpacket);
1010 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1011 }
1012
1013 /* clear queue */
1014 playerscxx . . $ pvpgn/bnetd/players.[queue] = 0;
1015 xfreecxx . . $ `src/common/xalloc.h:51:9`!(pt2);
1016
1017 return 0;
1018 }
1019
1020 /**********************************************************************************/
1021 /* external functions */
1022 /**********************************************************************************/
1023 extern int anongame_matchlists_createcxx . . $ pvpgn/bnetd/anongame_matchlists_create(b126dc7c1de90089).()
1024 {
1025 int i, j;
1026
1027 for (i = 0; i < ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!; i++) {
1028 for (j = 0; j < MAX_LEVELcxx . . $ `src/bnetd/anongame.cpp:51:9`!; j++) {
1029 matchlistscxx . . $ pvpgn/bnetd/matchlists.[i][j] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1030 }
1031 }
1032 return 0;
1033 }
1034
1035 extern int anongame_matchlists_destroycxx . . $ pvpgn/bnetd/anongame_matchlists_destroy(b126dc7c1de90089).()
1036 {
1037 int i, j;
1038 for (i = 0; i < ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!; i++) {
1039 for (j = 0; j < MAX_LEVELcxx . . $ `src/bnetd/anongame.cpp:51:9`!; j++) {
1040 if (matchlistscxx . . $ pvpgn/bnetd/matchlists.[i][j]) {
1041 list_destroycxx . . $ pvpgn/list_destroy(20db0232078327de).(matchlistscxx . . $ pvpgn/bnetd/matchlists.[i][j]);
1042 }
1043 }
1044 }
1045 return 0;
1046 }
1047
1048 /**********/
1049 extern int handle_anongame_searchcxx . . $ pvpgn/bnetd/handle_anongame_search(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *packet)
1050 {
1051 return _handle_anongame_searchcxx . . $ pvpgn/bnetd/_handle_anongame_search(8d07eb83d60bed1d).(c, packet);
1052 }
1053
1054 extern int anongame_unqueuecxx . . $ pvpgn/bnetd/anongame_unqueue(fa505503af8860d0).(t_connection * c, int queue)
1055 {
1056 int i;
1057 t_elem *curr;
1058 t_matchdatacxx . . $ pvpgn/bnetd/t_matchdata# *md;
1059
1060 if (queue < 0) {
1061 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got negative queue id ({})", queue);
1062 return -1;
1063 }
1064
1065 if (queue >= ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!) {
1066 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "unknown queue: {}", queue);
1067 return -1;
1068 }
1069
1070 if (conn_get_anongame_search_starttimecxx . . $ pvpgn/bnetd/conn_get_anongame_search_starttime(c2cdf9dfb46ed026).(c) != ((stdcxx . . $ std/::time_tcxx . . $ std/time_t#) 0)) {
1071 average_anongame_search_timecxx . . $ pvpgn/bnetd/average_anongame_search_time. *= anongame_search_countcxx . . $ pvpgn/bnetd/anongame_search_count.;
1072 average_anongame_search_timecxx . . $ pvpgn/bnetd/average_anongame_search_time. += (long)stdcxx . . $ std/::difftimecxx . . $ std/difftime(f630275aa3e30a1e).(stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!), conn_get_anongame_search_starttimecxx . . $ pvpgn/bnetd/conn_get_anongame_search_starttime(c2cdf9dfb46ed026).(c));
1073 anongame_search_countcxx . . $ pvpgn/bnetd/anongame_search_count.++;
1074 average_anongame_search_timecxx . . $ pvpgn/bnetd/average_anongame_search_time. /= anongame_search_countcxx . . $ pvpgn/bnetd/anongame_search_count.;
1075 if (anongame_search_countcxx . . $ pvpgn/bnetd/anongame_search_count. > 20000)
1076 anongame_search_countcxx . . $ pvpgn/bnetd/anongame_search_count. = anongame_search_countcxx . . $ pvpgn/bnetd/anongame_search_count. / 2; /* to prevent an overflow of the average time */
1077 conn_set_anongame_search_starttimecxx . . $ pvpgn/bnetd/conn_set_anongame_search_starttime(2bc578cf1171360f).(c, ((stdcxx . . $ std/::time_tcxx . . $ std/time_t#) 0));
1078 }
1079
1080 for (i = 0; i < MAX_LEVELcxx . . $ `src/bnetd/anongame.cpp:51:9`!; i++) {
1081 if (matchlistscxx . . $ pvpgn/bnetd/matchlists.[queue][i] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
1082 continue;
1083
1084 LIST_TRAVERSEcxx . . $ `src/common/list.h:94:9`!(matchlists[queue][i], curr) {
1085 md = (t_matchdatacxx . . $ pvpgn/bnetd/t_matchdata#*)elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(curr);
1086 if (md->ccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_2#c. == c) {
1087 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "unqueued player [{}] level {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i);
1088 list_remove_elemcxx . . $ pvpgn/list_remove_elem(17f7246ce0d3563b).(matchlistscxx . . $ pvpgn/bnetd/matchlists.[queue][i], &curr);
1089 xfreecxx . . $ `src/common/xalloc.h:51:9`!(md);
1090 return 0;
1091 }
1092 }
1093 }
1094
1095 /* Output error to std::log for PG queues, AT players are queued with single
1096 * entry. Because anongame_unqueue() is called for each player, only the first
1097 * time called will the team be removed, the rest are therefore not an error.
1098 * [Omega]
1099 */
1100 if (anongame_arrangedcxx . . $ pvpgn/bnetd/anongame_arranged(266ca1ce69549011).(queue) == 0) {
1101 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] player not found in \"{}\" queue", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), _anongame_queue_to_stringcxx . . $ pvpgn/bnetd/_anongame_queue_to_string(f7ae7e56280f18ae).(queue));
1102 return -1;
1103 }
1104
1105 return 0;
1106 }
1107
1108 /**********/
1109 extern char anongame_arrangedcxx . . $ pvpgn/bnetd/anongame_arranged(266ca1ce69549011).(int queue)
1110 {
1111 switch (queue) {
1112 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
1113 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
1114 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
1115 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
1116 return 1;
1117 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
1118 return tournament_is_arrangedcxx . . $ pvpgn/bnetd/tournament_is_arranged(b126dc7c1de90089).();
1119 default:
1120 return 0;
1121 }
1122 }
1123
1124 extern int anongame_evaluate_resultscxx . . $ pvpgn/bnetd/anongame_evaluate_results(ed13df91a2d61cf).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * anongame)
1125 {
1126 int i, j, number;
1127 int wins[ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.];
1128 int losses[ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.];
1129 int result;
1130 t_anongame_gameresultcxx . . $ pvpgn/bnetd/t_anongame_gameresult# *results;
1131 t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo# *anoninfo = anongame->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.;
1132
1133 for (i = 0; i < ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.; i++) {
1134 wins[i] = 0;
1135 losses[i] = 0;
1136 }
1137
1138 for (i = 0; i < anongame_get_totalplayerscxx . . $ pvpgn/bnetd/anongame_get_totalplayers(ed13df91a2d61cf).(anongame); i++) {
1139 if ((results = anoninfo->resultscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#results.[i])) {
1140 for (j = 0; j < gameresult_get_number_of_resultscxx . . $ pvpgn/bnetd/gameresult_get_number_of_results(dcc703a55377cfa1).(results); j++) {
1141 number = gameresult_get_player_numbercxx . . $ pvpgn/bnetd/gameresult_get_player_number(4919fea90e2d0dd3).(results, j) - 1;
1142 result = gameresult_get_player_resultcxx . . $ pvpgn/bnetd/gameresult_get_player_result(4919fea90e2d0dd3).(results, j);
1143
1144 if ((result == W3_GAMERESULT_WINcxx . . $ `src/common/bnet_protocol.h:227:9`!))
1145 wins[number]++;
1146 if ((result == W3_GAMERESULT_LOSScxx . . $ `src/common/bnet_protocol.h:226:9`!))
1147 losses[number]++;
1148 }
1149 }
1150 }
1151
1152 for (i = 0; i < anongame_get_totalplayerscxx . . $ pvpgn/bnetd/anongame_get_totalplayers(ed13df91a2d61cf).(anongame); i++) {
1153 if ((wins[i] > losses[i])) {
1154 if ((anoninfo->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i] != W3_GAMERESULT_WINcxx . . $ `src/common/bnet_protocol.h:227:9`!)) {
1155 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "player {} reported DISC/LOSS for self, but others agree on WIN", i + 1);
1156 anoninfo->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i] = W3_GAMERESULT_WINcxx . . $ `src/common/bnet_protocol.h:227:9`!;
1157 }
1158 }
1159 else {
1160 if ((anoninfo->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i] != W3_GAMERESULT_LOSScxx . . $ `src/common/bnet_protocol.h:226:9`!)) {
1161 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "player {} reported DISC/WIN for self, but others agree on LOSS", i + 1);
1162 anoninfo->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i] = W3_GAMERESULT_LOSScxx . . $ `src/common/bnet_protocol.h:226:9`!;
1163 }
1164 }
1165 }
1166
1167 return 0;
1168
1169 }
1170
1171 extern int anongame_statscxx . . $ pvpgn/bnetd/anongame_stats(c4dfbc2386fe4fc3).(t_connection * c)
1172 {
1173 int i;
1174 int wins = 0, losses = 0, discs = 0;
1175 t_connection *gamec = conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(c);
1176 t_anongamecxx . . $ pvpgn/bnetd/t_anongame# *a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(gamec);
1177 int tp = anongame_get_totalplayerscxx . . $ pvpgn/bnetd/anongame_get_totalplayers(ed13df91a2d61cf).(a);
1178 int oppon_level[ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.];
1179 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# gametype = a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.;
1180 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# plnum = a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum.;
1181 t_clienttagcxx . . $ pvpgn/t_clienttag# ct = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
1182 int tt = _anongame_totalteamscxx . . $ pvpgn/bnetd/_anongame_totalteams(7864480464b09eea).(gametype);
1183
1184 /* do nothing till all other players have w3route conn closed */
1185 for (i = 0; i < tp; i++)
1186 if (i + 1 != plnum && a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->playercxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#player.[i])
1187 if (conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->playercxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#player.[i]))
1188 return 0;
1189
1190 anongame_evaluate_resultscxx . . $ pvpgn/bnetd/anongame_evaluate_results(ed13df91a2d61cf).(a);
1191
1192 /* count wins, losses, discs */
1193 for (i = 0; i < tp; i++) {
1194 if (a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i] == W3_GAMERESULT_WINcxx . . $ `src/common/bnet_protocol.h:227:9`!)
1195 wins++;
1196 else if (a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i] == W3_GAMERESULT_LOSScxx . . $ `src/common/bnet_protocol.h:226:9`!)
1197 losses++;
1198 else
1199 discs++;
1200 }
1201
1202 /* do some sanity checking (hack prevention) */
1203 switch (gametype) {
1204 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
1205 if (wins != 1) {
1206 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "bogus game result: wins != 1 in small ffa game");
1207 return -1;
1208 }
1209 break;
1210 case ANONGAME_TYPE_TEAM_FFAcxx . . $ `src/common/anongame_protocol.h:454:9`!:
1211 if (!discs && wins != 2) {
1212 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "bogus game result: wins != 2 in team ffa game");
1213 return -1;
1214 }
1215 break;
1216 default:
1217 if (!discs && wins > losses) {
1218 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "bogus game result: wins > losses");
1219 return -1;
1220 }
1221 break;
1222 }
1223
1224 /* prevent users from getting loss if server is shutdown (does not prevent errors from crash) - [Omega] */
1225 /* also discard games with no winners at all (i.e. games where game host disc'ed and so all players do) */
1226 if (!wins)
1227 return -1;
1228
1229 /* according to zap, order of players in anongame is:
1230 * for PG: t1_p1, t2_p1, t1_p2, t2_p2, ...
1231 * for AT: t1_p1, t1_p2, ..., t2_p1, t2_p2, ...
1232 *
1233 * (Not True.. follows same order as PG)
1234 * 4v4 = t1_p1, t2_p1, t1_p2, t2_p2, t1_p3, t2_p3, t1_p4, t2_p4
1235 * 3v3v3 = t1_p1, t2_p1, t3_p1, t1_p2, t2_p2, t3_p2, t1_p3, t2_p3, t3_p3
1236 * 2v2v2v2 = t1_p1, t2_p1, t3_p1, t4_p1, t1_p2, t2_p2, t3_p2, t4_p2
1237 */
1238
1239 /* opponent level calculation has to be done here, because later on, the level of other players
1240 * may already be modified
1241 */
1242 for (i = 0; i < tp; i++) {
1243 int j, k, l;
1244 t_accountcxx . . $ pvpgn/bnetd/t_account# *oacc;
1245 oppon_level[i] = 0;
1246 switch (gametype) {
1247 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
1248 /* FIXME-TY: ADD TOURNAMENT STATS RECORDING (this part not required?) */
1249 break;
1250 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
1251 oppon_level[i] = account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[(i + 1) % tp], ct, ladder_id_solocxx . . $ pvpgn/bnetd/ladder_id_solo.);
1252 break;
1253 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
1254 /* oppon_level = average level of all other players */
1255 for (j = 0; j < tp; j++)
1256 if (i != j)
1257 oppon_level[i] += account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[j], ct, ladder_id_ffacxx . . $ pvpgn/bnetd/ladder_id_ffa.);
1258 oppon_level[i] /= (tp - 1);
1259 break;
1260 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
1261 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
1262 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
1263 oacc = a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[(i + 1) % tp];
1264 oppon_level[i] = team_get_levelcxx . . $ pvpgn/bnetd/team_get_level(bfd9c5af88c00d10).(account_find_team_by_teamidcxx . . $ pvpgn/bnetd/account_find_team_by_teamid(23ecc65a048e0bcb).(oacc, account_get_currentatteamcxx . . $ pvpgn/bnetd/account_get_currentatteam(367bfb076f70247b).(oacc)));
1265 break;
1266 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
1267 oacc = a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[(i + 1) % tp];
1268 oppon_level[i] = team_get_levelcxx . . $ pvpgn/bnetd/team_get_level(bfd9c5af88c00d10).(account_find_team_by_teamidcxx . . $ pvpgn/bnetd/account_find_team_by_teamid(23ecc65a048e0bcb).(oacc, account_get_currentatteamcxx . . $ pvpgn/bnetd/account_get_currentatteam(367bfb076f70247b).(oacc)));
1269 oacc = a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[(i + 2) % tp];
1270 oppon_level[i] = team_get_levelcxx . . $ pvpgn/bnetd/team_get_level(bfd9c5af88c00d10).(account_find_team_by_teamidcxx . . $ pvpgn/bnetd/account_find_team_by_teamid(23ecc65a048e0bcb).(oacc, account_get_currentatteamcxx . . $ pvpgn/bnetd/account_get_currentatteam(367bfb076f70247b).(oacc)));
1271 oppon_level[i] /= 2;
1272 break;
1273 default:
1274 /* oppon_level = average level of all opponents
1275 * this should work for all PG team games
1276 * [Omega] */
1277 k = i + 1;
1278 int _count = (tt > 0) ? tp / tt : 0;
1279 for (j = 0; j < _count; j++) {
1280 for (l = 0; l < (tt - 1); l++) {
1281 oppon_level[i] += account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[k % tp], ct, ladder_id_teamcxx . . $ pvpgn/bnetd/ladder_id_team.);
1282 k++;
1283 }
1284 k++;
1285 }
1286 oppon_level[i] /= (_count * (tt - 1));
1287 }
1288 }
1289
1290 for (i = 0; i < tp; i++) {
1291 t_accountcxx . . $ pvpgn/bnetd/t_account# *acc;
1292 t_teamcxx . . $ pvpgn/bnetd/t_team# *team;
1293 unsigned int currteam;
1294 int result = a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i];
1295
1296 if (result == -1)
1297 result = W3_GAMERESULT_LOSScxx . . $ `src/common/bnet_protocol.h:226:9`!;
1298
1299 acc = a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[i];
1300
1301 switch (gametype) {
1302 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
1303 if (result == W3_GAMERESULT_WINcxx . . $ `src/common/bnet_protocol.h:227:9`!)
1304 tournament_add_statcxx . . $ pvpgn/bnetd/tournament_add_stat(9f6a50bf8c531a3f).(acc, 1);
1305 if (result == W3_GAMERESULT_LOSScxx . . $ `src/common/bnet_protocol.h:226:9`!)
1306 tournament_add_statcxx . . $ pvpgn/bnetd/tournament_add_stat(9f6a50bf8c531a3f).(acc, 2);
1307 /* FIXME-TY: how to do ties? */
1308 break;
1309 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
1310 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
1311 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
1312 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
1313
1314 if ((currteam = account_get_currentatteamcxx . . $ pvpgn/bnetd/account_get_currentatteam(367bfb076f70247b).(acc))) {
1315 team = account_find_team_by_teamidcxx . . $ pvpgn/bnetd/account_find_team_by_teamid(23ecc65a048e0bcb).(acc, currteam);
1316 team_set_saveladderstatscxx . . $ pvpgn/bnetd/team_set_saveladderstats(2629837aadad176e).(team, gametype, result, oppon_level[i], ct);
1317 }
1318
1319 break;
1320 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
1321 case ANONGAME_TYPE_2V2cxx . . $ `src/common/anongame_protocol.h:449:9`!:
1322 case ANONGAME_TYPE_3V3cxx . . $ `src/common/anongame_protocol.h:450:9`!:
1323 case ANONGAME_TYPE_4V4cxx . . $ `src/common/anongame_protocol.h:451:9`!:
1324 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
1325 case ANONGAME_TYPE_5V5cxx . . $ `src/common/anongame_protocol.h:459:9`!:
1326 case ANONGAME_TYPE_6V6cxx . . $ `src/common/anongame_protocol.h:460:9`!:
1327 case ANONGAME_TYPE_2V2V2cxx . . $ `src/common/anongame_protocol.h:461:9`!:
1328 case ANONGAME_TYPE_3V3V3cxx . . $ `src/common/anongame_protocol.h:462:9`!:
1329 case ANONGAME_TYPE_4V4V4cxx . . $ `src/common/anongame_protocol.h:463:9`!:
1330 case ANONGAME_TYPE_2V2V2V2cxx . . $ `src/common/anongame_protocol.h:464:9`!:
1331 case ANONGAME_TYPE_3V3V3V3cxx . . $ `src/common/anongame_protocol.h:465:9`!:
1332 if (result == W3_GAMERESULT_WINcxx . . $ `src/common/bnet_protocol.h:227:9`!)
1333 account_set_saveladderstatscxx . . $ pvpgn/bnetd/account_set_saveladderstats(b5430b8827179d2a).(acc, gametype, game_result_wincxx . . $ pvpgn/bnetd/game_result_win., oppon_level[i], ct);
1334 if (result == W3_GAMERESULT_LOSScxx . . $ `src/common/bnet_protocol.h:226:9`!)
1335 account_set_saveladderstatscxx . . $ pvpgn/bnetd/account_set_saveladderstats(b5430b8827179d2a).(acc, gametype, game_result_losscxx . . $ pvpgn/bnetd/game_result_loss., oppon_level[i], ct);
1336 break;
1337 default:
1338 break;
1339 }
1340 }
1341 /* aaron: now update war3 ladders */
1342 ladderscxx . . $ pvpgn/bnetd/ladders..updatecxx . . $ pvpgn/bnetd/Ladders#update(49f6e7a06ebc5aa8).();
1343 return 1;
1344 }
1345
1346 /**********/
1347 extern t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo# *anongameinfo_createcxx . . $ pvpgn/bnetd/anongameinfo_create(d850d49e9fa50194).(int totalplayers)
1348 {
1349 t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo# *temp;
1350 int i;
1351
1352 temp = (t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_anongameinfo));
1353
1354 temp->totalplayerscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#totalplayers. = temp->currentplayerscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#currentplayers. = totalplayers;
1355 for (i = 0; i < ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.; i++) {
1356 temp->playercxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#player.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1357 temp->accountcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#account.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1358 temp->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[i] = -1; /* consider DISC default */
1359 temp->resultscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#results.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1360 }
1361
1362 return temp;
1363 }
1364
1365 extern void anongameinfo_destroycxx . . $ pvpgn/bnetd/anongameinfo_destroy(2779310e7a7a5560).(t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo# * i)
1366 {
1367 int j;
1368
1369 if (!i) {
1370 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongameinfo");
1371 return;
1372 }
1373 for (j = 0; j < ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.; j++)
1374 if (i->resultscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#results.[j])
1375 gameresult_destroycxx . . $ pvpgn/bnetd/gameresult_destroy(8722457eb06eb166).(i->resultscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#results.[j]);
1376 xfreecxx . . $ `src/common/xalloc.h:51:9`!(i);
1377 }
1378
1379 /**********/
1380 extern t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo# *anongame_get_infocxx . . $ pvpgn/bnetd/anongame_get_info(2a9b9e993eac3a19).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1381 {
1382 if (!a) {
1383 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1384 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1385 }
1386
1387 return a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.;
1388 }
1389
1390 extern int anongame_get_currentplayerscxx . . $ pvpgn/bnetd/anongame_get_currentplayers(ed13df91a2d61cf).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1391 {
1392 if (!a) {
1393 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1394 return 0;
1395 }
1396 if (!a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.) {
1397 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "NULL anongameinfo");
1398 return 0;
1399 }
1400
1401 return a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->currentplayerscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#currentplayers.;
1402 }
1403
1404 extern int anongame_get_totalplayerscxx . . $ pvpgn/bnetd/anongame_get_totalplayers(ed13df91a2d61cf).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1405 {
1406 if (!a) {
1407 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1408 return 0;
1409 }
1410 if (!a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.) {
1411 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "NULL anongameinfo");
1412 return 0;
1413 }
1414
1415 return a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->totalplayerscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#totalplayers.;
1416 }
1417
1418 extern t_connection *anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, int plnum)
1419 {
1420 if (!a) {
1421 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1422 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1423 }
1424 if (!a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.) {
1425 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "NULL anongameinfo");
1426 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1427 }
1428
1429 if (plnum < 0 || plnum > 7 || plnum >= a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->totalplayerscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#totalplayers.) {
1430 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid plnum: {}", plnum);
1431 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1432 }
1433
1434 return a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->playercxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#player.[plnum];
1435 }
1436
1437 extern int anongame_get_countcxx . . $ pvpgn/bnetd/anongame_get_count(ed13df91a2d61cf).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1438 {
1439 if (!a) {
1440 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1441 return 0;
1442 }
1443 return a->countcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#count.;
1444 }
1445
1446 extern stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# anongame_get_idcxx . . $ pvpgn/bnetd/anongame_get_id(7480407b697dfb85).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1447 {
1448 if (!a) {
1449 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1450 return 0;
1451 }
1452 return a->idcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#id.;
1453 }
1454
1455 extern t_connection *anongame_get_tccxx . . $ pvpgn/bnetd/anongame_get_tc(2bdefcb8f1f983a9).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, int tpnumber)
1456 {
1457 if (!a) {
1458 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1459 return 0;
1460 }
1461 return a->tccxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#tc.[tpnumber];
1462 }
1463
1464 extern stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# anongame_get_racecxx . . $ pvpgn/bnetd/anongame_get_race(7480407b697dfb85).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1465 {
1466 if (!a) {
1467 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1468 return 0;
1469 }
1470 return a->racecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#race.;
1471 }
1472
1473 extern stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# anongame_get_handlecxx . . $ pvpgn/bnetd/anongame_get_handle(7480407b697dfb85).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1474 {
1475 if (!a) {
1476 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1477 return 0;
1478 }
1479 return a->handlecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#handle.;
1480 }
1481
1482 extern unsigned int anongame_get_addrcxx . . $ pvpgn/bnetd/anongame_get_addr(7480407b697dfb85).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1483 {
1484 if (!a) {
1485 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1486 return 0;
1487 }
1488 return a->addrcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#addr.;
1489 }
1490
1491 extern char anongame_get_loadedcxx . . $ pvpgn/bnetd/anongame_get_loaded(e16ac247a913586a).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1492 {
1493 if (!a) {
1494 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1495 return 0;
1496 }
1497 return a->loadedcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#loaded.;
1498 }
1499
1500 extern char anongame_get_joinedcxx . . $ pvpgn/bnetd/anongame_get_joined(e16ac247a913586a).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1501 {
1502 if (!a) {
1503 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1504 return 0;
1505 }
1506 return a->joinedcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#joined.;
1507 }
1508
1509 extern stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# anongame_get_playernumcxx . . $ pvpgn/bnetd/anongame_get_playernum(73d41d83ff85f81f).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1510 {
1511 if (!a) {
1512 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1513 return 0;
1514 }
1515 return a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum.;
1516 }
1517
1518 extern stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# anongame_get_queuecxx . . $ pvpgn/bnetd/anongame_get_queue(73d41d83ff85f81f).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a)
1519 {
1520 if (!a) {
1521 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1522 return 0;
1523 }
1524 return a->queuecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#queue.;
1525 }
1526
1527 /**********/
1528 extern void anongame_set_resultcxx . . $ pvpgn/bnetd/anongame_set_result(707ef3d3d5fab011).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, int result)
1529 {
1530 if (!a) {
1531 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1532 return;
1533 }
1534 if (!a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.) {
1535 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "NULL anongameinfo");
1536 return;
1537 }
1538
1539 if (a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum. < 1 || a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum. > ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.) {
1540 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid playernum: {}", a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum.);
1541 return;
1542 }
1543
1544 a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->resultcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#result.[a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum. - 1] = result;
1545 }
1546
1547 extern void anongame_set_gameresultscxx . . $ pvpgn/bnetd/anongame_set_gameresults(57d9320bf9955583).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, t_anongame_gameresultcxx . . $ pvpgn/bnetd/t_anongame_gameresult# * results)
1548 {
1549 if (!a) {
1550 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1551 return;
1552 }
1553 if (!a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.) {
1554 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "NULL anongameinfo");
1555 return;
1556 }
1557
1558 if (a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum. < 1 || a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum. > ANONGAME_MAX_GAMECOUNTcxx . . $ ANONGAME_MAX_GAMECOUNT.) {
1559 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid playernum: {}", a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum.);
1560 return;
1561 }
1562
1563 a->infocxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#info.->resultscxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_0#results.[a->playernumcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#playernum. - 1] = results;
1564 }
1565
1566 extern void anongame_set_handlecxx . . $ pvpgn/bnetd/anongame_set_handle(b4c4eef0513293fe).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# h)
1567 {
1568 if (!a) {
1569 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1570 return;
1571 }
1572
1573 a->handlecxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#handle. = h;
1574 }
1575
1576 extern void anongame_set_addrcxx . . $ pvpgn/bnetd/anongame_set_addr(b4c4eef0513293fe).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, unsigned int addr)
1577 {
1578 if (!a) {
1579 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1580 return;
1581 }
1582
1583 a->addrcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#addr. = addr;
1584 }
1585
1586 extern void anongame_set_loadedcxx . . $ pvpgn/bnetd/anongame_set_loaded(8213a23c9642a9a3).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, char loaded)
1587 {
1588 if (!a) {
1589 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1590 return;
1591 }
1592
1593 a->loadedcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#loaded. = loaded;
1594 }
1595
1596 extern void anongame_set_joinedcxx . . $ pvpgn/bnetd/anongame_set_joined(8213a23c9642a9a3).(t_anongamecxx . . $ pvpgn/bnetd/t_anongame# * a, char joined)
1597 {
1598 if (!a) {
1599 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL anongame");
1600 return;
1601 }
1602
1603 a->joinedcxx . . $ pvpgn/bnetd/$anonymous_type_f87250fcf39fce72_1#joined. = joined;
1604 }
1605
1606 /**********/
1607 /* move to own .c/.h file for handling w3route connections */
1608 extern int handle_w3route_packetcxx . . $ pvpgn/bnetd/handle_w3route_packet(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1609 {
1610 /* [smith] 20030427 fixed Big-Endian/Little-Endian conversion (Solaris bug) then
1611 * use packet_append_data for append platform dependent data types - like
1612 * "int", cos this code was broken for BE platforms. it's rewriten in platform
1613 * independent style whis usege bn_int and other bn_* like datatypes and
1614 * fuctions for wor with datatypes - bn_int_set(), what provide right
1615 * byteorder, not depended on LE/BE
1616 * fixed broken htonl() conversion for BE platforms - change it to
1617 * bn_int_nset(). i hope it's worked on intel too %) */
1618
1619 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1620 t_connection *gamec;
1621 char const *username;
1622 t_anongamecxx . . $ pvpgn/bnetd/t_anongame# *a = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1623 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# gametype, plnum;
1624 int tp, i;
1625
1626 if (!c) {
1627 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got NULL connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1628 return -1;
1629 }
1630 if (!packet) {
1631 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got NULL packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1632 return -1;
1633 }
1634 if (packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet) != packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.) {
1635 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad packet (class {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet));
1636 return -1;
1637 }
1638 if (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(c) != conn_state_connected) {
1639 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] not connected", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1640 return -1;
1641 }
1642
1643 /* init route connection */
1644 if (packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet) == CLIENT_W3ROUTE_REQcxx . . $ `src/common/bnet_protocol.h:84:9`!) {
1645 t_connection *oldc;
1646
1647 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] sizeof t_client_w3route_req {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_w3route_reqcxx . . $ pvpgn/t_client_w3route_req#));
1648 username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_w3route_reqcxx . . $ pvpgn/t_client_w3route_req#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.);
1649 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] got username '{}'", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1650 gamec = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(username);
1651
1652 if (!gamec) {
1653 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] no game connection found for this w3route connection; closing", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1654 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
1655 return 0;
1656 }
1657
1658 if (!(a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(gamec))) {
1659 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] no anongame struct for game connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1660 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
1661 return 0;
1662 }
1663
1664 if (bn_int_get((unsigned char const *)packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..datacxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#data. + sizeof(t_client_w3route_reqcxx . . $ pvpgn/t_client_w3route_req#)+stdcxx . . $ std/::strlen(username) + 2) != anongame_get_idcxx . . $ pvpgn/bnetd/anongame_get_id(7480407b697dfb85).(a)) {
1665 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client sent wrong id for user '{}', closing connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1666 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
1667 return 0;
1668 }
1669
1670 oldc = conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(gamec);
1671 if (oldc) {
1672 conn_set_routeconncxx . . $ pvpgn/bnetd/conn_set_routeconn(91f93fcc9edcb042).(oldc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1673 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(oldc, conn_state_destroy);
1674 }
1675
1676 if (conn_set_routeconncxx . . $ pvpgn/bnetd/conn_set_routeconn(91f93fcc9edcb042).(c, gamec) < 0 || conn_set_routeconncxx . . $ pvpgn/bnetd/conn_set_routeconn(91f93fcc9edcb042).(gamec, c) < 0) {
1677 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] conn_set_routeconn failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1678 return -1;
1679 }
1680
1681 /* set clienttag for w3route connections; we can do conn_get_clienttag() on them */
1682 conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(c, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(gamec));
1683
1684 anongame_set_addrcxx . . $ pvpgn/bnetd/anongame_set_addr(b4c4eef0513293fe).(a, bn_int_get((unsigned char const *)packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..datacxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#data. + sizeof(t_client_w3route_reqcxx . . $ pvpgn/t_client_w3route_req#)+stdcxx . . $ std/::strlen(username) + 2 + 12));
1685 anongame_set_joinedcxx . . $ pvpgn/bnetd/anongame_set_joined(8213a23c9642a9a3).(a, 0);
1686 anongame_set_loadedcxx . . $ pvpgn/bnetd/anongame_set_loaded(8213a23c9642a9a3).(a, 0);
1687 anongame_set_resultcxx . . $ pvpgn/bnetd/anongame_set_result(707ef3d3d5fab011).(a, -1);
1688 anongame_set_gameresultscxx . . $ pvpgn/bnetd/anongame_set_gameresults(57d9320bf9955583).(a, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1689
1690 anongame_set_handlecxx . . $ pvpgn/bnetd/anongame_set_handle(b4c4eef0513293fe).(a, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_w3route_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_w3route_req..handlecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_4#handle.));
1691
1692 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.))) {
1693 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] packet_create failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1694 return -1;
1695 }
1696
1697 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_w3route_ackcxx . . $ pvpgn/t_server_w3route_ack#));
1698 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_W3ROUTE_ACKcxx . . $ `src/common/bnet_protocol.h:283:9`!);
1699 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#unknown1., 7);
1700 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#unknown2., 0);
1701 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..unknown3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#unknown3., SERVER_W3ROUTE_ACK_UNKNOWN3cxx . . $ `src/common/bnet_protocol.h:300:9`!);
1702
1703 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..unknown4cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#unknown4., 0xcccc);
1704 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..playernumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#playernum., anongame_get_playernumcxx . . $ pvpgn/bnetd/anongame_get_playernum(73d41d83ff85f81f).(a));
1705 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..unknown5cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#unknown5., 0x0002);
1706 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#port., conn_get_portcxx . . $ pvpgn/bnetd/conn_get_port(70207a9c46bcade7).(c));
1707 bn_int_nset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..ipcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#ip., conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c));
1708 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..unknown7cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#unknown7., 0);
1709 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_ack..unknown8cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_16#unknown8., 0);
1710 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1711 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1712
1713 return 0;
1714 }
1715 else {
1716 gamec = conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(c);
1717 if (gamec)
1718 a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(gamec);
1719 }
1720
1721 if (!gamec) {
1722 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] no game connection found for this w3route connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1723 return 0;
1724 }
1725
1726 if (!a) {
1727 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] no anongame struct found for this w3route connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1728 return 0;
1729 }
1730
1731 gametype = anongame_get_queuecxx . . $ pvpgn/bnetd/anongame_get_queue(73d41d83ff85f81f).(a);
1732 plnum = anongame_get_playernumcxx . . $ pvpgn/bnetd/anongame_get_playernum(73d41d83ff85f81f).(a);
1733 tp = anongame_get_totalplayerscxx . . $ pvpgn/bnetd/anongame_get_totalplayers(ed13df91a2d61cf).(a);
1734
1735 /* handle these packets _before_ checking for routeconn of other players */
1736 switch (packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet)) {
1737 case CLIENT_W3ROUTE_ECHOREPLYcxx . . $ `src/common/bnet_protocol.h:175:9`!:
1738 return 0;
1739 case CLIENT_W3ROUTE_CONNECTEDcxx . . $ `src/common/bnet_protocol.h:154:9`!:
1740 return 0;
1741 case CLIENT_W3ROUTE_GAMERESULTcxx . . $ `src/common/bnet_protocol.h:189:9`!:
1742 case CLIENT_W3ROUTE_GAMERESULT_W3XPcxx . . $ `src/common/bnet_protocol.h:212:9`!:
1743 {
1744
1745 /* insert reading of whole packet into t_gameresult */
1746
1747 t_anongame_gameresultcxx . . $ pvpgn/bnetd/t_anongame_gameresult# *gameresult;
1748 int result;
1749
1750 t_timer_datacxx . . $ pvpgn/bnetd/t_timer_data# data;
1751 t_anongameinfocxx . . $ pvpgn/bnetd/t_anongameinfo# *inf = anongame_get_infocxx . . $ pvpgn/bnetd/anongame_get_info(2a9b9e993eac3a19).(a);
1752 t_connection *ac;
1753
1754 data.pcxx . . $ pvpgn/bnetd/$anonymous_type_64e82d6b10ad28f9_0#p. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1755
1756 if (!(gameresult = anongame_gameresult_parsecxx . . $ pvpgn/bnetd/anongame_gameresult_parse(afad805d69d149a8).(packet)))
1757 result = -1;
1758 else /* own result is always stored as first result */
1759 result = gameresult_get_player_resultcxx . . $ pvpgn/bnetd/gameresult_get_player_result(4919fea90e2d0dd3).(gameresult, 0);
1760
1761 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] got W3ROUTE_GAMERESULT: {:08}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), result);
1762
1763 if (!inf) {
1764 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] NULL anongameinfo", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1765 return -1;
1766 }
1767
1768 anongame_set_gameresultscxx . . $ pvpgn/bnetd/anongame_set_gameresults(57d9320bf9955583).(a, gameresult);
1769 anongame_set_resultcxx . . $ pvpgn/bnetd/anongame_set_result(707ef3d3d5fab011).(a, result);
1770
1771 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
1772
1773 /* activate timers on open w3route connectons */
1774 if (result == W3_GAMERESULT_WINcxx . . $ `src/common/bnet_protocol.h:227:9`!) {
1775 for (i = 0; i < tp; i++) {
1776 if (anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i)) {
1777 ac = conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i));
1778 if (ac) {
1779 /* 300 seconds or 5 minute timer */
1780 timerlist_add_timercxx . . $ pvpgn/bnetd/timerlist_add_timer(f16dcbfb825fabda).(ac, nowcxx . . $ pvpgn/bnetd/now. + (stdcxx . . $ std/::time_tcxx . . $ std/time_t#) 300, conn_shutdowncxx . . $ pvpgn/bnetd/conn_shutdown(9b6c929c3dbc4c93)., data);
1781 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] started timer to close w3route", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(ac));
1782 }
1783 }
1784 }
1785 }
1786
1787 return 0;
1788 }
1789 }
1790
1791 for (i = 0; i < tp; i++)
1792 if (i + 1 != plnum && anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i))
1793 if (!conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i)) || !conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i))) {
1794 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] not all players have w3route connections up yet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1795 return 0;
1796 }
1797
1798 /* handle these packets _after_ checking for routeconns of other players */
1799 switch (packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet)) {
1800 case CLIENT_W3ROUTE_LOADINGDONEcxx . . $ `src/common/bnet_protocol.h:103:9`!:
1801 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] got LOADINGDONE, playernum: {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), plnum);
1802
1803 anongame_set_loadedcxx . . $ pvpgn/bnetd/anongame_set_loaded(8213a23c9642a9a3).(a, 1);
1804
1805 for (i = 0; i < tp; i++) {
1806 if (!anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i)) /* ignore disconnected players */
1807 continue;
1808 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.))) {
1809 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] packet_create failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1810 return -1;
1811 }
1812 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_w3route_loadingackcxx . . $ pvpgn/t_server_w3route_loadingack#));
1813 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_W3ROUTE_LOADINGACKcxx . . $ `src/common/bnet_protocol.h:141:9`!);
1814 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_loadingackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_loadingack..playernumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_8#playernum., plnum);
1815 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i)), rpacket);
1816 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1817 }
1818
1819 /* have all players loaded? */
1820 for (i = 0; i < tp; i++)
1821 if (i + 1 != plnum && anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i) && !anongame_get_loadedcxx . . $ pvpgn/bnetd/anongame_get_loaded(e16ac247a913586a).(conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i))))
1822 return 0;
1823
1824 for (i = 0; i < tp; i++) {
1825 if (!anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i))
1826 continue;
1827
1828 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.))) {
1829 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] packet_create failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1830 return -1;
1831 }
1832
1833 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_w3route_readycxx . . $ pvpgn/t_server_w3route_ready#));
1834 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_W3ROUTE_READYcxx . . $ `src/common/bnet_protocol.h:115:9`!);
1835 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_hostcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_host..unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_6#unknown1., 0);
1836 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i)), rpacket);
1837 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1838 }
1839
1840 break;
1841
1842 case CLIENT_W3ROUTE_ABORTcxx . . $ `src/common/bnet_protocol.h:129:9`!:
1843 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] got W3ROUTE_ABORT", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1844 break;
1845
1846 default:
1847 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] default: got packet type: {:04}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet));
1848 }
1849
1850 return 0;
1851 }
1852
1853 extern int handle_anongame_joincxx . . $ pvpgn/bnetd/handle_anongame_join(c4dfbc2386fe4fc3).(t_connection * c)
1854 {
1855 t_anongamecxx . . $ pvpgn/bnetd/t_anongame# *a, *ja, *oa;
1856 t_connection *jc, *o;
1857 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1858 int tp, level;
1859 char gametype;
1860 t_accountcxx . . $ pvpgn/bnetd/t_account# *acct;
1861 t_clienttagcxx . . $ pvpgn/t_clienttag# ct = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
1862
1863 static t_server_w3route_playerinfo2cxx . . $ pvpgn/t_server_w3route_playerinfo2# pl2;
1864 static t_server_w3route_levelinfo2cxx . . $ pvpgn/t_server_w3route_levelinfo2# li2;
1865 static t_server_w3route_playerinfo_addrcxx . . $ pvpgn/t_server_w3route_playerinfo_addr# pl_addr;
1866
1867 int i, j;
1868
1869 if (!c) {
1870 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got NULL connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1871 return -1;
1872 }
1873 if (!(conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(c))) {
1874 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] no route connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1875 return -1;
1876 }
1877 if (!(a = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(c))) {
1878 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] no anongame struct", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1879 return -1;
1880 }
1881
1882 anongame_set_joinedcxx . . $ pvpgn/bnetd/anongame_set_joined(8213a23c9642a9a3).(a, 1);
1883 gametype = anongame_get_queuecxx . . $ pvpgn/bnetd/anongame_get_queue(73d41d83ff85f81f).(a);
1884 tp = anongame_get_totalplayerscxx . . $ pvpgn/bnetd/anongame_get_totalplayers(ed13df91a2d61cf).(a);
1885
1886 /* wait till all players have w3route conns */
1887 for (i = 0; i < tp; i++)
1888 if (anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i) && (!conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i)) || !conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i)) || !anongame_get_joinedcxx . . $ pvpgn/bnetd/anongame_get_joined(e16ac247a913586a).(conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, i))))) {
1889 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] not all players have joined game BNet yet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1890 return 0;
1891 }
1892
1893 /* then send each player info about all others */
1894 for (j = 0; j < tp; j++) {
1895 jc = anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(a, j);
1896 if (!jc) /* ignore disconnected players */
1897 continue;
1898 ja = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(jc);
1899
1900 /* send a playerinfo packet for this player to each other player */
1901 for (i = 0; i < tp; i++) {
1902 if (i + 1 != anongame_get_playernumcxx . . $ pvpgn/bnetd/anongame_get_playernum(73d41d83ff85f81f).(ja)) {
1903 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "i = {}", i);
1904
1905 if (!(o = anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(ja, i))) {
1906 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] player {} disconnected, ignoring", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i);
1907 continue;
1908 }
1909
1910 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.))) {
1911 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] packet_create failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1912 return -1;
1913 }
1914
1915 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_w3route_playerinfocxx . . $ pvpgn/t_server_w3route_playerinfo#));
1916 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_W3ROUTE_PLAYERINFOcxx . . $ `src/common/bnet_protocol.h:311:9`!);
1917
1918
1919 if (!(oa = conn_get_anongamecxx . . $ pvpgn/bnetd/conn_get_anongame(28581bdaae3fd375).(o))) {
1920 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] no anongame struct of player {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i);
1921 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1922 return -1;
1923 }
1924
1925 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_playerinfocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_playerinfo..handlecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_17#handle., anongame_get_handlecxx . . $ pvpgn/bnetd/anongame_get_handle(7480407b697dfb85).(oa));
1926 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_playerinfocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_playerinfo..playernumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_17#playernum., anongame_get_playernumcxx . . $ pvpgn/bnetd/anongame_get_playernum(73d41d83ff85f81f).(oa));
1927
1928 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(o));
1929
1930 /* playerinfo2 */
1931 bn_byte_set(&pl2.unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_18#unknown1., 8);
1932 bn_int_set(&pl2.idcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_18#id., anongame_get_idcxx . . $ pvpgn/bnetd/anongame_get_id(7480407b697dfb85).(oa));
1933 bn_int_set(&pl2.racecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_18#race., anongame_get_racecxx . . $ pvpgn/bnetd/anongame_get_race(7480407b697dfb85).(oa));
1934 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &pl2, sizeof(pl2));
1935
1936 /* external addr */
1937 bn_short_set(&pl_addr.unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#unknown1., 2);
1938 { /* trans support */
1939 unsigned short port = conn_get_game_portcxx . . $ pvpgn/bnetd/conn_get_game_port(70207a9c46bcade7).(o);
1940 unsigned int addr = conn_get_game_addrcxx . . $ pvpgn/bnetd/conn_get_game_addr(8bd2285a65940781).(o);
1941
1942 trans_netcxx . . $ pvpgn/trans_net(cf0ba8ec647fd542).(conn_get_game_addrcxx . . $ pvpgn/bnetd/conn_get_game_addr(8bd2285a65940781).(jc), &addr, &port);
1943
1944 bn_short_nset(&pl_addr.portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#port., port);
1945 bn_int_nset(&pl_addr.ipcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#ip., addr);
1946 }
1947 bn_int_set(&pl_addr.unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#unknown2., 0);
1948 bn_int_set(&pl_addr.unknown3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#unknown3., 0);
1949 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &pl_addr, sizeof(pl_addr));
1950
1951 /* local addr */
1952 bn_short_set(&pl_addr.unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#unknown1., 2);
1953 bn_short_nset(&pl_addr.portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#port., conn_get_game_portcxx . . $ pvpgn/bnetd/conn_get_game_port(70207a9c46bcade7).(o));
1954 bn_int_set(&pl_addr.ipcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#ip., anongame_get_addrcxx . . $ pvpgn/bnetd/anongame_get_addr(7480407b697dfb85).(oa));
1955 bn_int_set(&pl_addr.unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#unknown2., 0);
1956 bn_int_set(&pl_addr.unknown3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_21#unknown3., 0);
1957 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &pl_addr, sizeof(pl_addr));
1958
1959 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(jc), rpacket);
1960 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1961 }
1962 }
1963
1964 /* levelinfo */
1965 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.))) {
1966 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] packet_create failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1967 return -1;
1968 }
1969
1970 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_w3route_levelinfocxx . . $ pvpgn/t_server_w3route_levelinfo#));
1971 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_W3ROUTE_LEVELINFOcxx . . $ `src/common/bnet_protocol.h:332:9`!);
1972 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_w3route_levelinfocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_w3route_levelinfo..numplayerscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_19#numplayers., anongame_get_currentplayerscxx . . $ pvpgn/bnetd/anongame_get_currentplayers(ed13df91a2d61cf).(a));
1973
1974 for (i = 0; i < tp; i++) {
1975 if (!anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(ja, i))
1976 continue;
1977
1978 bn_byte_set(&li2.plnumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_20#plnum., i + 1);
1979 bn_byte_set(&li2.unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_20#unknown1., 3);
1980
1981 switch (gametype) {
1982 case ANONGAME_TYPE_1V1cxx . . $ `src/common/anongame_protocol.h:448:9`!:
1983 level = account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(ja, i)), ct, ladder_id_solocxx . . $ pvpgn/bnetd/ladder_id_solo.);
1984 break;
1985 case ANONGAME_TYPE_SMALL_FFAcxx . . $ `src/common/anongame_protocol.h:452:9`!:
1986 case ANONGAME_TYPE_TEAM_FFAcxx . . $ `src/common/anongame_protocol.h:454:9`!:
1987 level = account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(ja, i)), ct, ladder_id_ffacxx . . $ pvpgn/bnetd/ladder_id_ffa.);
1988 break;
1989 case ANONGAME_TYPE_AT_2V2cxx . . $ `src/common/anongame_protocol.h:453:9`!:
1990 case ANONGAME_TYPE_AT_3V3cxx . . $ `src/common/anongame_protocol.h:455:9`!:
1991 case ANONGAME_TYPE_AT_4V4cxx . . $ `src/common/anongame_protocol.h:456:9`!:
1992 case ANONGAME_TYPE_AT_2V2V2cxx . . $ `src/common/anongame_protocol.h:466:9`!:
1993 acct = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(ja, i));
1994 level = team_get_levelcxx . . $ pvpgn/bnetd/team_get_level(bfd9c5af88c00d10).(account_find_team_by_teamidcxx . . $ pvpgn/bnetd/account_find_team_by_teamid(23ecc65a048e0bcb).(acct, account_get_currentatteamcxx . . $ pvpgn/bnetd/account_get_currentatteam(367bfb076f70247b).(acct)));
1995 break;
1996 case ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!:
1997 level = 0; /* FIXME-TY: WHAT TO DO HERE */
1998 break;
1999 default:
2000 level = account_get_ladder_levelcxx . . $ pvpgn/bnetd/account_get_ladder_level(829aa05f631ee398).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(anongame_get_playercxx . . $ pvpgn/bnetd/anongame_get_player(2bdefcb8f1f983a9).(ja, i)), ct, ladder_id_teamcxx . . $ pvpgn/bnetd/ladder_id_team.);
2001 break;
2002 }
2003
2004 /* first anongame shows level 0 as level 1 */
2005 bn_byte_set(&li2.levelcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_20#level., level ? level : 1);
2006
2007 bn_short_set(&li2.unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_20#unknown2., 0);
2008 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &li2, sizeof(li2));
2009 }
2010
2011 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(jc), rpacket);
2012 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2013
2014 /* startgame1 */
2015 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.))) {
2016 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] packet_create failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2017 return -1;
2018 }
2019 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_w3route_startgame1cxx . . $ pvpgn/t_server_w3route_startgame1#));
2020 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_W3ROUTE_STARTGAME1cxx . . $ `src/common/bnet_protocol.h:363:9`!);
2021 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(jc), rpacket);
2022 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2023
2024 /* startgame2 */
2025 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_w3routecxx . . $ pvpgn/packet_class_w3route.))) {
2026 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] packet_create failed", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2027 return -1;
2028 }
2029 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_w3route_startgame2cxx . . $ pvpgn/t_server_w3route_startgame2#));
2030 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_W3ROUTE_STARTGAME2cxx . . $ `src/common/bnet_protocol.h:369:9`!);
2031 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn_get_routeconncxx . . $ pvpgn/bnetd/conn_get_routeconn(30bd672f85ddc689).(jc), rpacket);
2032 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2033 }
2034 return 0;
2035 }
2036
2037 extern const char * anongame_get_map_from_prefscxx . . $ pvpgn/bnetd/anongame_get_map_from_prefs(1663101b4c2f8326).(int queue, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag)
2038 {
2039 int i, j = 0;
2040 const char *default_map, *selected;
2041 char *res_maps[32];
2042 char clienttag_str[5];
2043
2044 switch (clienttag) {
2045 case CLIENTTAG_REDALERT2_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:128:9`!:
2046 default_map = "eb2.map";
2047 break;
2048 case CLIENTTAG_YURISREV_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:140:9`!:
2049 default_map = "xgrinder.map";
2050 break;
2051 default:
2052 ERROR1cxx . . $ `src/common/eventlog.h:74:9`!("invalid clienttag: {}", tag_uint_to_str(clienttag_str, clienttag));
2053 return "eb2.map";
2054 }
2055
2056 for (i = 0; i < 32; i++)
2057 res_maps[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2058
2059 for (i = 0; i < maplists_get_totalmaps_by_queuecxx . . $ pvpgn/bnetd/maplists_get_totalmaps_by_queue(1cb9ad283036edc7).(clienttag, queue); i++) {
2060 res_maps[j++] = maplists_get_mapcxx . . $ pvpgn/bnetd/maplists_get_map(825fca05dee0ea68).(queue, clienttag, i + 1);
2061 }
2062
2063 if (j == 0)
2064 {
2065 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "j == 0; returning \"eb2.map\"");
2066 return "eb2.map";
2067 }
2068 i = stdcxx . . $ std/::rand() % j;
2069 if (res_maps[i])
2070 selected = res_maps[i];
2071 else
2072 selected = default_map;
2073
2074 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "got map {} from prefs", selected);
2075 return selected;
2076
2077 }
2078
2079 }
2080
2081 }