| 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_maplists.h"cxx . . $ `<file>/src/bnetd/anongame_maplists.h`/ |
| 21 | |
| 22 | #include <cstring> |
| 23 | #include <cstdio> |
| 24 | |
| 25 | #include "common/packet.h"cxx . . $ `<file>/src/common/packet.h`/ |
| 26 | #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/ |
| 27 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 28 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 29 | #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/ |
| 30 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 31 | |
| 32 | #define MAXMAPScxx . . $ `src/bnetd/anongame_maplists.cpp:32:9`! 100 |
| 33 | #define MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`! 32 /* cannot be changed (map_prefs only supports 32 maps) */ |
| 34 | |
| 35 | /**********************************************************************************/ |
| 36 | namespace pvpgncxx . . $ pvpgn/ |
| 37 | { |
| 38 | |
| 39 | namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 40 | { |
| 41 | |
| 42 | static char * maplist_war3cxx . . $ pvpgn/bnetd/maplist_war3.[MAXMAPScxx . . $ `src/bnetd/anongame_maplists.cpp:32:9`!]; |
| 43 | static char * maplist_w3xpcxx . . $ pvpgn/bnetd/maplist_w3xp.[MAXMAPScxx . . $ `src/bnetd/anongame_maplists.cpp:32:9`!]; |
| 44 | static char * maplist_ral2cxx . . $ pvpgn/bnetd/maplist_ral2.[MAXMAPScxx . . $ `src/bnetd/anongame_maplists.cpp:32:9`!]; |
| 45 | static char * maplist_yuricxx . . $ pvpgn/bnetd/maplist_yuri.[MAXMAPScxx . . $ `src/bnetd/anongame_maplists.cpp:32:9`!]; |
| 46 | static int number_maps_war3cxx . . $ pvpgn/bnetd/number_maps_war3. = 0; |
| 47 | static int number_maps_w3xpcxx . . $ pvpgn/bnetd/number_maps_w3xp. = 0; |
| 48 | static int number_maps_ral2cxx . . $ pvpgn/bnetd/number_maps_ral2. = 0; |
| 49 | static int number_maps_yuricxx . . $ pvpgn/bnetd/number_maps_yuri. = 0; |
| 50 | static char maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!][MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`! + 1]; |
| 51 | static char maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!][MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`! + 1]; |
| 52 | static char maplists_ral2cxx . . $ pvpgn/bnetd/maplists_ral2.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!][MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`! + 1]; |
| 53 | static char maplists_yuricxx . . $ pvpgn/bnetd/maplists_yuri.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!][MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`! + 1]; |
| 54 | |
| 55 | |
| 56 | static int _maplists_type_get_queuecxx . . $ pvpgn/bnetd/_maplists_type_get_queue(5c4306d8553b3696).(const char * type); |
| 57 | static const char * _maplists_queue_get_typecxx . . $ pvpgn/bnetd/_maplists_queue_get_type(f7ae7e56280f18ae).(int queue); |
| 58 | |
| 59 | static void _maplists_add_mapcxx . . $ pvpgn/bnetd/_maplists_add_map(9afcfc0fcf0b0c1d).(t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag, char * mapname, int queue); |
| 60 | |
| 61 | /*****/ |
| 62 | static const char * queue_namescxx . . $ pvpgn/bnetd/queue_names.[ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!] = { |
| 63 | "1v1", "2v2", "3v3", "4v4", "sffa", "at2v2", "tffa", "at3v3", "at4v4", |
| 64 | "TY", |
| 65 | "5v5", "6v6", "2v2v2", "3v3v3", "4v4v4", "2v2v2v2", "3v3v3v3", |
| 66 | "at2v2v2" |
| 67 | }; |
| 68 | /**********************************************************************************/ |
| 69 | static int _maplists_type_get_queuecxx . . $ pvpgn/bnetd/_maplists_type_get_queue(5c4306d8553b3696).(const char * type) |
| 70 | { |
| 71 | int i; |
| 72 | |
| 73 | for (i = 0; i < ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!; i++) |
| 74 | if (stdcxx . . $ std/::strcmp(type, queue_namescxx . . $ pvpgn/bnetd/queue_names.[i]) == 0) |
| 75 | return i; |
| 76 | |
| 77 | return -1; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | static const char * _maplists_queue_get_typecxx . . $ pvpgn/bnetd/_maplists_queue_get_type(f7ae7e56280f18ae).(int queue) |
| 82 | { |
| 83 | return queue_namescxx . . $ pvpgn/bnetd/queue_names.[queue]; |
| 84 | } |
| 85 | |
| 86 | static void _maplists_add_mapcxx . . $ pvpgn/bnetd/_maplists_add_map(9afcfc0fcf0b0c1d).(t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag, char * mapname, int queue) |
| 87 | { |
| 88 | /* this function does two things |
| 89 | * 1. adds the mapname to maplist for MAPS section |
| 90 | * maplist[mapnumber] = mapname |
| 91 | * number_maps = total maps held in maplist[] |
| 92 | * 2. adds the mapnumber to maplists for TYPE section |
| 93 | * maplists[queue][0] = number of maps for queue |
| 94 | * maplists[queue][1..32] = mapnumber |
| 95 | * ie. maplist[maplists[queue][1..32]] = mapname |
| 96 | */ |
| 97 | int in_list = 0; |
| 98 | int j; |
| 99 | char clienttag_str[5]; |
| 100 | |
| 101 | if (clienttag == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `src/common/tag.h:111:9`!) { |
| 102 | for (j = 0; j < number_maps_war3cxx . . $ pvpgn/bnetd/number_maps_war3.; j++) { |
| 103 | if (stdcxx . . $ std/::strcmp(maplist_war3cxx . . $ pvpgn/bnetd/maplist_war3.[j], mapname) == 0) { /* already in list */ |
| 104 | in_list = 1; |
| 105 | break; |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | if (!in_list) |
| 110 | maplist_war3cxx . . $ pvpgn/bnetd/maplist_war3.[number_maps_war3cxx . . $ pvpgn/bnetd/number_maps_war3.++] = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(mapname); |
| 111 | |
| 112 | if (maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][0] < MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!) { |
| 113 | maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][0]++; |
| 114 | maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][(int)maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][0]] = j; |
| 115 | } |
| 116 | else { |
| 117 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, |
| 118 | "cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})", |
| 119 | mapname, _maplists_queue_get_typecxx . . $ pvpgn/bnetd/_maplists_queue_get_type(f7ae7e56280f18ae).(queue), MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | else if (clienttag == CLIENTTAG_WAR3XP_UINTcxx . . $ `src/common/tag.h:113:9`!) { |
| 124 | for (j = 0; j < number_maps_w3xpcxx . . $ pvpgn/bnetd/number_maps_w3xp.; j++) { |
| 125 | if (stdcxx . . $ std/::strcmp(maplist_w3xpcxx . . $ pvpgn/bnetd/maplist_w3xp.[j], mapname) == 0) { /* already in list */ |
| 126 | in_list = 1; |
| 127 | break; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | if (!in_list) |
| 132 | maplist_w3xpcxx . . $ pvpgn/bnetd/maplist_w3xp.[number_maps_w3xpcxx . . $ pvpgn/bnetd/number_maps_w3xp.++] = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(mapname); |
| 133 | |
| 134 | if (maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][0] < MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!) { |
| 135 | maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][0]++; |
| 136 | maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][(int)maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][0]] = j; |
| 137 | } |
| 138 | else { |
| 139 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, |
| 140 | "cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})", |
| 141 | mapname, _maplists_queue_get_typecxx . . $ pvpgn/bnetd/_maplists_queue_get_type(f7ae7e56280f18ae).(queue), MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | else if (clienttag == CLIENTTAG_REDALERT2_UINTcxx . . $ `src/common/tag.h:128:9`!) { |
| 146 | for (j = 0; j < number_maps_ral2cxx . . $ pvpgn/bnetd/number_maps_ral2.; j++) { |
| 147 | if (stdcxx . . $ std/::strcmp(maplist_ral2cxx . . $ pvpgn/bnetd/maplist_ral2.[j], mapname) == 0) { /* already in list */ |
| 148 | in_list = 1; |
| 149 | break; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | if (!in_list) |
| 154 | maplist_ral2cxx . . $ pvpgn/bnetd/maplist_ral2.[number_maps_ral2cxx . . $ pvpgn/bnetd/number_maps_ral2.++] = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(mapname); |
| 155 | |
| 156 | if (maplists_ral2cxx . . $ pvpgn/bnetd/maplists_ral2.[queue][0] < MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!) { |
| 157 | maplists_ral2cxx . . $ pvpgn/bnetd/maplists_ral2.[queue][0]++; |
| 158 | maplists_ral2cxx . . $ pvpgn/bnetd/maplists_ral2.[queue][(int)maplists_ral2cxx . . $ pvpgn/bnetd/maplists_ral2.[queue][0]] = j; |
| 159 | } |
| 160 | else { |
| 161 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, |
| 162 | "cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})", |
| 163 | mapname, _maplists_queue_get_typecxx . . $ pvpgn/bnetd/_maplists_queue_get_type(f7ae7e56280f18ae).(queue), MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | else if (clienttag == CLIENTTAG_YURISREV_UINTcxx . . $ `src/common/tag.h:140:9`!) { |
| 168 | for (j = 0; j < number_maps_yuricxx . . $ pvpgn/bnetd/number_maps_yuri.; j++) { |
| 169 | if (stdcxx . . $ std/::strcmp(maplist_yuricxx . . $ pvpgn/bnetd/maplist_yuri.[j], mapname) == 0) { /* already in list */ |
| 170 | in_list = 1; |
| 171 | break; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | if (!in_list) |
| 176 | maplist_yuricxx . . $ pvpgn/bnetd/maplist_yuri.[number_maps_yuricxx . . $ pvpgn/bnetd/number_maps_yuri.++] = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(mapname); |
| 177 | |
| 178 | if (maplists_yuricxx . . $ pvpgn/bnetd/maplists_yuri.[queue][0] < MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!) { |
| 179 | maplists_yuricxx . . $ pvpgn/bnetd/maplists_yuri.[queue][0]++; |
| 180 | maplists_yuricxx . . $ pvpgn/bnetd/maplists_yuri.[queue][(int)maplists_yuricxx . . $ pvpgn/bnetd/maplists_yuri.[queue][0]] = j; |
| 181 | } |
| 182 | else { |
| 183 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, |
| 184 | "cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})", |
| 185 | mapname, _maplists_queue_get_typecxx . . $ pvpgn/bnetd/_maplists_queue_get_type(f7ae7e56280f18ae).(queue), MAXMAPS_PER_QUEUEcxx . . $ `src/bnetd/anongame_maplists.cpp:33:9`!); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | else eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid clienttag: {}", tag_uint_to_strcxx . . $ pvpgn/tag_uint_to_str(d172961b102a89a5).(clienttag_str, clienttag)); |
| 190 | } |
| 191 | |
| 192 | /**********************************************************************************/ |
| 193 | extern int anongame_maplists_createcxx . . $ pvpgn/bnetd/anongame_maplists_create(b126dc7c1de90089).(void) |
| 194 | { |
| 195 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# *mapfd; |
| 196 | char buffer[256]; |
| 197 | int len, i, queue; |
| 198 | char *p, *q, *r, *u; |
| 199 | |
| 200 | if (prefs_get_mapsfilecxx . . $ pvpgn/bnetd/prefs_get_mapsfile(33a1f659e94feb42).() == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 201 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., "anongame_maplists_create", "invalid mapsfile, check your config"); |
| 202 | return -1; |
| 203 | } |
| 204 | |
| 205 | if ((mapfd = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(prefs_get_mapsfilecxx . . $ pvpgn/bnetd/prefs_get_mapsfile(33a1f659e94feb42).(), "rt")) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 206 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., "anongame_maplists_create", "could not open mapsfile : \"{}\"", prefs_get_mapsfilecxx . . $ pvpgn/bnetd/prefs_get_mapsfile(33a1f659e94feb42).()); |
| 207 | return -1; |
| 208 | } |
| 209 | |
| 210 | /* init the maps, they say static vars are 0-ed anyway but u never know :) */ |
| 211 | for (i = 0; i < ANONGAME_TYPEScxx . . $ `src/common/anongame_protocol.h:468:9`!; i++) { |
| 212 | maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[i][0] = 0; |
| 213 | maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[i][0] = 0; |
| 214 | } |
| 215 | |
| 216 | while (stdcxx . . $ std/::fgetscxx . . $ std/fgets(efb0aaba7ac866ae).(buffer, 256, mapfd)) { |
| 217 | len = stdcxx . . $ std/::strlen(buffer); |
| 218 | if (len < 1) continue; |
| 219 | if (buffer[len - 1] == '\n') { |
| 220 | buffer[len - 1] = '\0'; |
| 221 | } |
| 222 | |
| 223 | /* search for comments and comment them out */ |
| 224 | for (p = buffer; *p; p++) |
| 225 | if (*p == '#') { |
| 226 | *p = '\0'; |
| 227 | break; |
| 228 | } |
| 229 | |
| 230 | /* skip spaces and/or tabs */ |
| 231 | for (p = buffer; *p && (*p == ' ' || *p == '\t'); p++); /* p = clienttag */ |
| 232 | if (*p == '\0') continue; |
| 233 | |
| 234 | /* find next delimiter */ |
| 235 | for (q = p; *q && *q != ' ' && *q != '\t'; q++); |
| 236 | if (*q == '\0' || q - p != 4) continue; /* clienttag needs to have 4 chars */ |
| 237 | |
| 238 | *q = '\0'; /* end of clienttag */ |
| 239 | |
| 240 | /* skip spaces and/or tabs */ |
| 241 | for (q++; *q && (*q == ' ' || *q == '\t'); q++); /* q = type */ |
| 242 | if (*q == '\0') continue; |
| 243 | |
| 244 | /* find next delimiter */ |
| 245 | for (r = q + 1; *r && *r != ' ' && *r != '\t'; r++); |
| 246 | |
| 247 | *r = '\0'; /* end of type */ |
| 248 | |
| 249 | /* skip spaces and/or tabs */ |
| 250 | for (r++; *r && (*r == ' ' || *r == '\t'); r++); /* r = mapname */ |
| 251 | if (*r == '\0') continue; |
| 252 | |
| 253 | if (*r != '\"') /* mapname without quotes */ |
| 254 | /* find next delimiter */ |
| 255 | for (u = r + 1; *u && *u != ' ' && *u != '\t'; u++); |
| 256 | else /* mapname with quotes */ |
| 257 | { |
| 258 | r++; /* skip quote */ |
| 259 | for (u = r + 1; *u && *u != '\"'; u++); /* find end quote or end of buffer */ |
| 260 | if (*u != '\"') |
| 261 | { |
| 262 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "missing \" at the end of the map name, presume it's ok anyway"); |
| 263 | } |
| 264 | } |
| 265 | *u = '\0'; /* end of mapname */ |
| 266 | |
| 267 | if ((queue = _maplists_type_get_queuecxx . . $ pvpgn/bnetd/_maplists_type_get_queue(5c4306d8553b3696).(q)) < 0) continue; /* invalid queue */ |
| 268 | |
| 269 | _maplists_add_mapcxx . . $ pvpgn/bnetd/_maplists_add_map(9afcfc0fcf0b0c1d).(tag_case_str_to_uintcxx . . $ pvpgn/tag_case_str_to_uint(c61c63047ce273de).(p), r, queue); |
| 270 | } |
| 271 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(mapfd); |
| 272 | return 0; |
| 273 | } |
| 274 | |
| 275 | /* used by the MAPS section */ |
| 276 | extern int maplists_get_totalmapscxx . . $ pvpgn/bnetd/maplists_get_totalmaps(4c679297bf94b9eb).(t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag) |
| 277 | { |
| 278 | switch (clienttag) { |
| 279 | case CLIENTTAG_WARCRAFT3_UINTcxx . . $ `src/common/tag.h:111:9`!: |
| 280 | return number_maps_war3cxx . . $ pvpgn/bnetd/number_maps_war3.; |
| 281 | case CLIENTTAG_WAR3XP_UINTcxx . . $ `src/common/tag.h:113:9`!: |
| 282 | return number_maps_w3xpcxx . . $ pvpgn/bnetd/number_maps_w3xp.; |
| 283 | case CLIENTTAG_REDALERT2_UINTcxx . . $ `src/common/tag.h:128:9`!: |
| 284 | return number_maps_ral2cxx . . $ pvpgn/bnetd/number_maps_ral2.; |
| 285 | case CLIENTTAG_YURISREV_UINTcxx . . $ `src/common/tag.h:140:9`!: |
| 286 | return number_maps_yuricxx . . $ pvpgn/bnetd/number_maps_yuri.; |
| 287 | default: |
| 288 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("Unknown clienttag"); |
| 289 | return 0; |
| 290 | } |
| 291 | return 0; |
| 292 | } |
| 293 | |
| 294 | extern void maplists_add_maps_to_packetcxx . . $ pvpgn/bnetd/maplists_add_maps_to_packet(72878d65f350b106).(t_packetcxx . . $ pvpgn/t_packet# * packet, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag) |
| 295 | { |
| 296 | int i; |
| 297 | |
| 298 | if (clienttag == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `src/common/tag.h:111:9`!) |
| 299 | for (i = 0; i < number_maps_war3cxx . . $ pvpgn/bnetd/number_maps_war3.; i++) |
| 300 | packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(packet, maplist_war3cxx . . $ pvpgn/bnetd/maplist_war3.[i]); |
| 301 | |
| 302 | if (clienttag == CLIENTTAG_WAR3XP_UINTcxx . . $ `src/common/tag.h:113:9`!) |
| 303 | for (i = 0; i < number_maps_w3xpcxx . . $ pvpgn/bnetd/number_maps_w3xp.; i++) |
| 304 | packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(packet, maplist_w3xpcxx . . $ pvpgn/bnetd/maplist_w3xp.[i]); |
| 305 | } |
| 306 | |
| 307 | /* used by TYPE section */ |
| 308 | extern int maplists_get_totalmaps_by_queuecxx . . $ pvpgn/bnetd/maplists_get_totalmaps_by_queue(1cb9ad283036edc7).(t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag, int queue) |
| 309 | { |
| 310 | switch (clienttag) { |
| 311 | case CLIENTTAG_WARCRAFT3_UINTcxx . . $ `src/common/tag.h:111:9`!: |
| 312 | return maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][0]; |
| 313 | case CLIENTTAG_WAR3XP_UINTcxx . . $ `src/common/tag.h:113:9`!: |
| 314 | return maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][0]; |
| 315 | case CLIENTTAG_REDALERT2_UINTcxx . . $ `src/common/tag.h:128:9`!: |
| 316 | return maplists_ral2cxx . . $ pvpgn/bnetd/maplists_ral2.[queue][0]; |
| 317 | case CLIENTTAG_YURISREV_UINTcxx . . $ `src/common/tag.h:140:9`!: |
| 318 | return maplists_yuricxx . . $ pvpgn/bnetd/maplists_yuri.[queue][0]; |
| 319 | default: |
| 320 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("Unknown clienttag"); |
| 321 | return 0; |
| 322 | } |
| 323 | return 0; |
| 324 | } |
| 325 | |
| 326 | extern void maplists_add_map_info_to_packetcxx . . $ pvpgn/bnetd/maplists_add_map_info_to_packet(4eccb6026b987a1e).(t_packetcxx . . $ pvpgn/t_packet# * rpacket, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag, int queue) |
| 327 | { |
| 328 | int i; |
| 329 | |
| 330 | if (clienttag == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `src/common/tag.h:111:9`!) { |
| 331 | for (i = 0; i < maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][0] + 1; i++) |
| 332 | packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][i], 1); |
| 333 | } |
| 334 | if (clienttag == CLIENTTAG_WAR3XP_UINTcxx . . $ `src/common/tag.h:113:9`!) { |
| 335 | for (i = 0; i < maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][0] + 1; i++) |
| 336 | packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][i], 1); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | /* used by _get_map_from_prefs() */ |
| 341 | extern char * maplists_get_mapcxx . . $ pvpgn/bnetd/maplists_get_map(825fca05dee0ea68).(int queue, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag, int mapnumber) |
| 342 | { |
| 343 | switch (clienttag) { |
| 344 | case CLIENTTAG_WARCRAFT3_UINTcxx . . $ `src/common/tag.h:111:9`!: |
| 345 | return maplist_war3cxx . . $ pvpgn/bnetd/maplist_war3.[(int)maplists_war3cxx . . $ pvpgn/bnetd/maplists_war3.[queue][mapnumber]]; |
| 346 | case CLIENTTAG_WAR3XP_UINTcxx . . $ `src/common/tag.h:113:9`!: |
| 347 | return maplist_w3xpcxx . . $ pvpgn/bnetd/maplist_w3xp.[(int)maplists_w3xpcxx . . $ pvpgn/bnetd/maplists_w3xp.[queue][mapnumber]]; |
| 348 | case CLIENTTAG_REDALERT2_UINTcxx . . $ `src/common/tag.h:128:9`!: |
| 349 | return maplist_ral2cxx . . $ pvpgn/bnetd/maplist_ral2.[(int)maplists_ral2cxx . . $ pvpgn/bnetd/maplists_ral2.[queue][mapnumber]]; |
| 350 | case CLIENTTAG_YURISREV_UINTcxx . . $ `src/common/tag.h:140:9`!: |
| 351 | return maplist_yuricxx . . $ pvpgn/bnetd/maplist_yuri.[(int)maplists_yuricxx . . $ pvpgn/bnetd/maplists_yuri.[queue][mapnumber]]; |
| 352 | default: |
| 353 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("Unknown clienttag"); |
| 354 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | extern void anongame_maplists_destroycxx . . $ pvpgn/bnetd/anongame_maplists_destroy(49f6e7a06ebc5aa8).() |
| 359 | { |
| 360 | int i; |
| 361 | |
| 362 | for (i = 0; i < MAXMAPScxx . . $ `src/bnetd/anongame_maplists.cpp:32:9`!; i++) { |
| 363 | if (maplist_war3cxx . . $ pvpgn/bnetd/maplist_war3.[i]) |
| 364 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)maplist_war3[i]); |
| 365 | if (maplist_w3xpcxx . . $ pvpgn/bnetd/maplist_w3xp.[i]) |
| 366 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)maplist_w3xp[i]); |
| 367 | if (maplist_ral2cxx . . $ pvpgn/bnetd/maplist_ral2.[i]) |
| 368 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)maplist_ral2[i]); |
| 369 | if (maplist_yuricxx . . $ pvpgn/bnetd/maplist_yuri.[i]) |
| 370 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)maplist_yuri[i]); |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | extern int anongame_add_tournament_mapcxx . . $ pvpgn/bnetd/anongame_add_tournament_map(fa84e865f2d62ca9).(t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag, char * mapname) |
| 375 | { |
| 376 | _maplists_add_mapcxx . . $ pvpgn/bnetd/_maplists_add_map(9afcfc0fcf0b0c1d).(clienttag, mapname, ANONGAME_TYPE_TYcxx . . $ `src/common/anongame_protocol.h:458:9`!); |
| 377 | return 0; |
| 378 | } |
| 379 | |
| 380 | extern void anongame_tournament_maplists_destroycxx . . $ pvpgn/bnetd/anongame_tournament_maplists_destroy(49f6e7a06ebc5aa8).(void) |
| 381 | { |
| 382 | return; /* nothing to destroy */ |
| 383 | } |
| 384 | |
| 385 | } |
| 386 | |
| 387 | } |