| 1 | /* |
| 2 | * Copyright (C) 1998 Mark Baysinger ([email protected]) |
| 3 | * Copyright (C) 1998,1999,2000 Ross Combs ([email protected]) |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | #define GAME_INTERNAL_ACCESScxx . . $ `src/bnetd/game.cpp:19:9`! |
| 20 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 21 | #include "game.h"cxx . . $ `<file>/src/bnetd/game.h`/ |
| 22 | |
| 23 | #include <cerrno> |
| 24 | #include <cstring> |
| 25 | #include <cassert> |
| 26 | |
| 27 | #include "compat/rename.h"cxx . . $ `<file>/src/compat/rename.h`/ |
| 28 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 29 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 30 | #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/ |
| 31 | #include "common/bnettime.h"cxx . . $ `<file>/src/common/bnettime.h`/ |
| 32 | |
| 33 | #include "connection.h"cxx . . $ `<file>/src/bnetd/connection.h`/ |
| 34 | #include "channel.h"cxx . . $ `<file>/src/bnetd/channel.h`/ |
| 35 | #include "server.h"cxx . . $ `<file>/src/bnetd/server.h`/ |
| 36 | #include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/ |
| 37 | #include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/ |
| 38 | #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/ |
| 39 | #include "watch.h"cxx . . $ `<file>/src/bnetd/watch.h`/ |
| 40 | #include "realm.h"cxx . . $ `<file>/src/bnetd/realm.h`/ |
| 41 | #include "ladder.h"cxx . . $ `<file>/src/bnetd/ladder.h`/ |
| 42 | #include "game_conv.h"cxx . . $ `<file>/src/bnetd/game_conv.h`/ |
| 43 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 44 | |
| 45 | #ifdef WITH_LUA |
| 46 | #include "luainterface.h" |
| 47 | #endif |
| 48 | namespace pvpgncxx . . $ pvpgn/ |
| 49 | { |
| 50 | |
| 51 | namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 52 | { |
| 53 | |
| 54 | DECLARE_ELIST_INITcxx . . $ `src/common/elist.h:194:9`!(gamelist_head); |
| 55 | static int glist_lengthcxx . . $ pvpgn/bnetd/glist_length. = 0; |
| 56 | static int totalcountcxx . . $ pvpgn/bnetd/totalcount. = 0; |
| 57 | |
| 58 | |
| 59 | static void game_choose_hostcxx . . $ pvpgn/bnetd/game_choose_host(59d2203d3d741d18).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game); |
| 60 | static void game_destroycxx . . $ pvpgn/bnetd/game_destroy(59d2203d3d741d18).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game); |
| 61 | static int game_reportcxx . . $ pvpgn/bnetd/game_report(7ab38d5cc74e6b21).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game); |
| 62 | |
| 63 | |
| 64 | static void game_choose_hostcxx . . $ pvpgn/bnetd/game_choose_host(59d2203d3d741d18).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game) |
| 65 | { |
| 66 | unsigned int i; |
| 67 | |
| 68 | if (game->countcxx . . $ pvpgn/bnetd/game#count. < 1) |
| 69 | { |
| 70 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game has had no connections?!"); |
| 71 | return; |
| 72 | } |
| 73 | if (!game->connectionscxx . . $ pvpgn/bnetd/game#connections.) |
| 74 | { |
| 75 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game has NULL connections array"); |
| 76 | return; |
| 77 | } |
| 78 | |
| 79 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 80 | if (game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i]) |
| 81 | { |
| 82 | game->ownercxx . . $ pvpgn/bnetd/game#owner. = game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i]; |
| 83 | game->addrcxx . . $ pvpgn/bnetd/game#addr. = conn_get_game_addrcxx . . $ pvpgn/bnetd/conn_get_game_addr(8bd2285a65940781).(game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i]); |
| 84 | game->portcxx . . $ pvpgn/bnetd/game#port. = conn_get_game_portcxx . . $ pvpgn/bnetd/conn_get_game_port(70207a9c46bcade7).(game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i]); |
| 85 | return; |
| 86 | } |
| 87 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "no valid connections found"); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | extern char const * game_type_get_strcxx . . $ pvpgn/bnetd/game_type_get_str(99410026be00fa29).(t_game_typecxx . . $ pvpgn/bnetd/t_game_type# type) |
| 92 | { |
| 93 | switch (type) |
| 94 | { |
| 95 | case game_type_nonecxx . . $ pvpgn/bnetd/game_type_none.: |
| 96 | return "NONE"; |
| 97 | |
| 98 | case game_type_meleecxx . . $ pvpgn/bnetd/game_type_melee.: |
| 99 | return "melee"; |
| 100 | |
| 101 | case game_type_topvbotcxx . . $ pvpgn/bnetd/game_type_topvbot.: |
| 102 | return "top vs bottom"; |
| 103 | |
| 104 | case game_type_ffacxx . . $ pvpgn/bnetd/game_type_ffa.: |
| 105 | return "free for all"; |
| 106 | |
| 107 | case game_type_oneononecxx . . $ pvpgn/bnetd/game_type_oneonone.: |
| 108 | return "one on one"; |
| 109 | |
| 110 | case game_type_ctfcxx . . $ pvpgn/bnetd/game_type_ctf.: |
| 111 | return "capture the flag"; |
| 112 | |
| 113 | case game_type_greedcxx . . $ pvpgn/bnetd/game_type_greed.: |
| 114 | return "greed"; |
| 115 | |
| 116 | case game_type_slaughtercxx . . $ pvpgn/bnetd/game_type_slaughter.: |
| 117 | return "slaughter"; |
| 118 | |
| 119 | case game_type_sdeathcxx . . $ pvpgn/bnetd/game_type_sdeath.: |
| 120 | return "sudden death"; |
| 121 | |
| 122 | case game_type_laddercxx . . $ pvpgn/bnetd/game_type_ladder.: |
| 123 | return "ladder"; |
| 124 | |
| 125 | case game_type_ironmancxx . . $ pvpgn/bnetd/game_type_ironman.: |
| 126 | return "ironman"; |
| 127 | |
| 128 | case game_type_mapsetcxx . . $ pvpgn/bnetd/game_type_mapset.: |
| 129 | return "mapset"; |
| 130 | |
| 131 | case game_type_teammeleecxx . . $ pvpgn/bnetd/game_type_teammelee.: |
| 132 | return "team melee"; |
| 133 | |
| 134 | case game_type_teamffacxx . . $ pvpgn/bnetd/game_type_teamffa.: |
| 135 | return "team free for all"; |
| 136 | |
| 137 | case game_type_teamctfcxx . . $ pvpgn/bnetd/game_type_teamctf.: |
| 138 | return "team capture the flag"; |
| 139 | |
| 140 | case game_type_pglcxx . . $ pvpgn/bnetd/game_type_pgl.: |
| 141 | return "PGL"; |
| 142 | |
| 143 | case game_type_diablocxx . . $ pvpgn/bnetd/game_type_diablo.: |
| 144 | return "Diablo"; |
| 145 | |
| 146 | case game_type_diablo2opencxx . . $ pvpgn/bnetd/game_type_diablo2open.: |
| 147 | return "Diablo II (open)"; |
| 148 | |
| 149 | case game_type_diablo2closedcxx . . $ pvpgn/bnetd/game_type_diablo2closed.: |
| 150 | return "Diablo II (closed)"; |
| 151 | |
| 152 | case game_type_allcxx . . $ pvpgn/bnetd/game_type_all.: |
| 153 | default: |
| 154 | return "UNKNOWN"; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | |
| 159 | extern char const * game_status_get_strcxx . . $ pvpgn/bnetd/game_status_get_str(919d871ac64ee540).(t_game_statuscxx . . $ pvpgn/bnetd/t_game_status# status) |
| 160 | { |
| 161 | switch (status) |
| 162 | { |
| 163 | case game_status_startedcxx . . $ pvpgn/bnetd/game_status_started.: |
| 164 | return "started"; |
| 165 | |
| 166 | case game_status_fullcxx . . $ pvpgn/bnetd/game_status_full.: |
| 167 | return "full"; |
| 168 | |
| 169 | case game_status_opencxx . . $ pvpgn/bnetd/game_status_open.: |
| 170 | return "open"; |
| 171 | |
| 172 | case game_status_donecxx . . $ pvpgn/bnetd/game_status_done.: |
| 173 | return "done"; |
| 174 | |
| 175 | case game_status_loadedcxx . . $ pvpgn/bnetd/game_status_loaded.: |
| 176 | return "loaded"; |
| 177 | |
| 178 | default: |
| 179 | return "UNKNOWN"; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | |
| 184 | extern char const * game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# result) |
| 185 | { |
| 186 | switch (result) |
| 187 | { |
| 188 | case game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.: |
| 189 | return "NONE"; |
| 190 | |
| 191 | case game_result_wincxx . . $ pvpgn/bnetd/game_result_win.: |
| 192 | return "WIN"; |
| 193 | |
| 194 | case game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.: |
| 195 | return "LOSS"; |
| 196 | |
| 197 | case game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.: |
| 198 | return "DRAW"; |
| 199 | |
| 200 | case game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.: |
| 201 | return "DISCONNECT"; |
| 202 | |
| 203 | case game_result_observercxx . . $ pvpgn/bnetd/game_result_observer.: |
| 204 | return "OBSERVER"; |
| 205 | |
| 206 | default: |
| 207 | return "UNKNOWN"; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | |
| 212 | extern char const * game_option_get_strcxx . . $ pvpgn/bnetd/game_option_get_str(e828d4f1344dfcc).(t_game_optioncxx . . $ pvpgn/bnetd/t_game_option# option) |
| 213 | { |
| 214 | switch (option) |
| 215 | { |
| 216 | case game_option_melee_normalcxx . . $ pvpgn/bnetd/game_option_melee_normal.: |
| 217 | return "normal"; |
| 218 | case game_option_ffa_normalcxx . . $ pvpgn/bnetd/game_option_ffa_normal.: |
| 219 | return "normal"; |
| 220 | case game_option_oneonone_normalcxx . . $ pvpgn/bnetd/game_option_oneonone_normal.: |
| 221 | return "normal"; |
| 222 | case game_option_ctf_normalcxx . . $ pvpgn/bnetd/game_option_ctf_normal.: |
| 223 | return "normal"; |
| 224 | case game_option_greed_10000cxx . . $ pvpgn/bnetd/game_option_greed_10000.: |
| 225 | return "10000 minerals"; |
| 226 | case game_option_greed_7500cxx . . $ pvpgn/bnetd/game_option_greed_7500.: |
| 227 | return "7500 minerals"; |
| 228 | case game_option_greed_5000cxx . . $ pvpgn/bnetd/game_option_greed_5000.: |
| 229 | return "5000 minerals"; |
| 230 | case game_option_greed_2500cxx . . $ pvpgn/bnetd/game_option_greed_2500.: |
| 231 | return "2500 minerals"; |
| 232 | case game_option_slaughter_60cxx . . $ pvpgn/bnetd/game_option_slaughter_60.: |
| 233 | return "60 minutes"; |
| 234 | case game_option_slaughter_45cxx . . $ pvpgn/bnetd/game_option_slaughter_45.: |
| 235 | return "45 minutes"; |
| 236 | case game_option_slaughter_30cxx . . $ pvpgn/bnetd/game_option_slaughter_30.: |
| 237 | return "30 minutes"; |
| 238 | case game_option_slaughter_15cxx . . $ pvpgn/bnetd/game_option_slaughter_15.: |
| 239 | return "15 minutes"; |
| 240 | case game_option_sdeath_normalcxx . . $ pvpgn/bnetd/game_option_sdeath_normal.: |
| 241 | return "normal"; |
| 242 | case game_option_ladder_countaslosscxx . . $ pvpgn/bnetd/game_option_ladder_countasloss.: |
| 243 | return "count as loss"; |
| 244 | case game_option_ladder_nopenaltycxx . . $ pvpgn/bnetd/game_option_ladder_nopenalty.: |
| 245 | return "no penalty"; |
| 246 | case game_option_mapset_normalcxx . . $ pvpgn/bnetd/game_option_mapset_normal.: |
| 247 | return "normal"; |
| 248 | case game_option_teammelee_4cxx . . $ pvpgn/bnetd/game_option_teammelee_4.: |
| 249 | return "4 teams"; |
| 250 | case game_option_teammelee_3cxx . . $ pvpgn/bnetd/game_option_teammelee_3.: |
| 251 | return "3 teams"; |
| 252 | case game_option_teammelee_2cxx . . $ pvpgn/bnetd/game_option_teammelee_2.: |
| 253 | return "2 teams"; |
| 254 | case game_option_teamffa_4cxx . . $ pvpgn/bnetd/game_option_teamffa_4.: |
| 255 | return "4 teams"; |
| 256 | case game_option_teamffa_3cxx . . $ pvpgn/bnetd/game_option_teamffa_3.: |
| 257 | return "3 teams"; |
| 258 | case game_option_teamffa_2cxx . . $ pvpgn/bnetd/game_option_teamffa_2.: |
| 259 | return "2 teams"; |
| 260 | case game_option_teamctf_4cxx . . $ pvpgn/bnetd/game_option_teamctf_4.: |
| 261 | return "4 teams"; |
| 262 | case game_option_teamctf_3cxx . . $ pvpgn/bnetd/game_option_teamctf_3.: |
| 263 | return "3 teams"; |
| 264 | case game_option_teamctf_2cxx . . $ pvpgn/bnetd/game_option_teamctf_2.: |
| 265 | return "2 teams"; |
| 266 | case game_option_topvbot_7cxx . . $ pvpgn/bnetd/game_option_topvbot_7.: |
| 267 | return "7 vs all"; |
| 268 | case game_option_topvbot_6cxx . . $ pvpgn/bnetd/game_option_topvbot_6.: |
| 269 | return "6 vs all"; |
| 270 | case game_option_topvbot_5cxx . . $ pvpgn/bnetd/game_option_topvbot_5.: |
| 271 | return "5 vs all"; |
| 272 | case game_option_topvbot_4cxx . . $ pvpgn/bnetd/game_option_topvbot_4.: |
| 273 | return "4 vs all"; |
| 274 | case game_option_topvbot_3cxx . . $ pvpgn/bnetd/game_option_topvbot_3.: |
| 275 | return "3 vs all"; |
| 276 | case game_option_topvbot_2cxx . . $ pvpgn/bnetd/game_option_topvbot_2.: |
| 277 | return "2 vs all"; |
| 278 | case game_option_topvbot_1cxx . . $ pvpgn/bnetd/game_option_topvbot_1.: |
| 279 | return "1 vs all"; |
| 280 | |
| 281 | case game_option_nonecxx . . $ pvpgn/bnetd/game_option_none.: |
| 282 | return "none"; |
| 283 | default: |
| 284 | return "UNKNOWN"; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | |
| 289 | extern char const * game_maptype_get_strcxx . . $ pvpgn/bnetd/game_maptype_get_str(1e9597ee27ef5802).(t_game_maptypecxx . . $ pvpgn/bnetd/t_game_maptype# maptype) |
| 290 | { |
| 291 | switch (maptype) |
| 292 | { |
| 293 | case game_maptype_selfmadecxx . . $ pvpgn/bnetd/game_maptype_selfmade.: |
| 294 | return "Self-Made"; |
| 295 | case game_maptype_blizzardcxx . . $ pvpgn/bnetd/game_maptype_blizzard.: |
| 296 | return "Blizzard"; |
| 297 | case game_maptype_laddercxx . . $ pvpgn/bnetd/game_maptype_ladder.: |
| 298 | return "Ladder"; |
| 299 | case game_maptype_pglcxx . . $ pvpgn/bnetd/game_maptype_pgl.: |
| 300 | return "PGL"; |
| 301 | case game_maptype_kbkcxx . . $ pvpgn/bnetd/game_maptype_kbk.: |
| 302 | return "KBK"; |
| 303 | case game_maptype_compusacxx . . $ pvpgn/bnetd/game_maptype_compusa.: |
| 304 | return "CompUSA"; |
| 305 | default: |
| 306 | return "Unknown"; |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | |
| 311 | extern char const * game_tileset_get_strcxx . . $ pvpgn/bnetd/game_tileset_get_str(ad8e0289366c942d).(t_game_tilesetcxx . . $ pvpgn/bnetd/t_game_tileset# tileset) |
| 312 | { |
| 313 | switch (tileset) |
| 314 | { |
| 315 | case game_tileset_badlandscxx . . $ pvpgn/bnetd/game_tileset_badlands.: |
| 316 | return "Badlands"; |
| 317 | case game_tileset_spacecxx . . $ pvpgn/bnetd/game_tileset_space.: |
| 318 | return "Space"; |
| 319 | case game_tileset_installationcxx . . $ pvpgn/bnetd/game_tileset_installation.: |
| 320 | return "Installation"; |
| 321 | case game_tileset_ashworldcxx . . $ pvpgn/bnetd/game_tileset_ashworld.: |
| 322 | return "Ash World"; |
| 323 | case game_tileset_junglecxx . . $ pvpgn/bnetd/game_tileset_jungle.: |
| 324 | return "Jungle"; |
| 325 | case game_tileset_desertcxx . . $ pvpgn/bnetd/game_tileset_desert.: |
| 326 | return "Desert"; |
| 327 | case game_tileset_icecxx . . $ pvpgn/bnetd/game_tileset_ice.: |
| 328 | return "Ice"; |
| 329 | case game_tileset_twilightcxx . . $ pvpgn/bnetd/game_tileset_twilight.: |
| 330 | return "Twilight"; |
| 331 | default: |
| 332 | return "Unknown"; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | |
| 337 | extern char const * game_speed_get_strcxx . . $ pvpgn/bnetd/game_speed_get_str(9b098fefc635a97d).(t_game_speedcxx . . $ pvpgn/bnetd/t_game_speed# speed) |
| 338 | { |
| 339 | switch (speed) |
| 340 | { |
| 341 | case game_speed_slowestcxx . . $ pvpgn/bnetd/game_speed_slowest.: |
| 342 | return "slowest"; |
| 343 | case game_speed_slowercxx . . $ pvpgn/bnetd/game_speed_slower.: |
| 344 | return "slower"; |
| 345 | case game_speed_slowcxx . . $ pvpgn/bnetd/game_speed_slow.: |
| 346 | return "slow"; |
| 347 | case game_speed_normalcxx . . $ pvpgn/bnetd/game_speed_normal.: |
| 348 | return "normal"; |
| 349 | case game_speed_fastcxx . . $ pvpgn/bnetd/game_speed_fast.: |
| 350 | return "fast"; |
| 351 | case game_speed_fastercxx . . $ pvpgn/bnetd/game_speed_faster.: |
| 352 | return "faster"; |
| 353 | case game_speed_fastestcxx . . $ pvpgn/bnetd/game_speed_fastest.: |
| 354 | return "fastest"; |
| 355 | default: |
| 356 | return "unknown"; |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | |
| 361 | extern char const * game_difficulty_get_strcxx . . $ pvpgn/bnetd/game_difficulty_get_str(81a3ae90da26a711).(unsigned difficulty) |
| 362 | { |
| 363 | switch (difficulty) |
| 364 | { |
| 365 | case game_difficulty_normalcxx . . $ pvpgn/bnetd/game_difficulty_normal.: |
| 366 | return "normal"; |
| 367 | case game_difficulty_nightmarecxx . . $ pvpgn/bnetd/game_difficulty_nightmare.: |
| 368 | return "nightmare"; |
| 369 | case game_difficulty_hellcxx . . $ pvpgn/bnetd/game_difficulty_hell.: |
| 370 | return "hell"; |
| 371 | case game_difficulty_hardcore_normalcxx . . $ pvpgn/bnetd/game_difficulty_hardcore_normal.: |
| 372 | return "hardcore normal"; |
| 373 | case game_difficulty_hardcore_nightmarecxx . . $ pvpgn/bnetd/game_difficulty_hardcore_nightmare.: |
| 374 | return "hardcore nightmare"; |
| 375 | case game_difficulty_hardcore_hellcxx . . $ pvpgn/bnetd/game_difficulty_hardcore_hell.: |
| 376 | return "hardcore hell"; |
| 377 | default: |
| 378 | return "unknown"; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | |
| 383 | extern t_gamecxx . . $ pvpgn/bnetd/t_game# * game_createcxx . . $ pvpgn/bnetd/game_create(75b438a61efed074).(char const * name, char const * pass, char const * info, t_game_typecxx . . $ pvpgn/bnetd/t_game_type# type, int startver, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag, unsigned long gameversion) |
| 384 | { |
| 385 | t_gamecxx . . $ pvpgn/bnetd/t_game# * game; |
| 386 | |
| 387 | if (!name) |
| 388 | { |
| 389 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "got NULL game name"); |
| 390 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 391 | } |
| 392 | if (!pass) |
| 393 | { |
| 394 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "got NULL game pass"); |
| 395 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 396 | } |
| 397 | if (!info) |
| 398 | { |
| 399 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "got NULL game info"); |
| 400 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 401 | } |
| 402 | |
| 403 | if (gamelist_find_game_availablecxx . . $ pvpgn/bnetd/gamelist_find_game_available(e383c2f40f0b546f).(name, clienttag, game_type_allcxx . . $ pvpgn/bnetd/game_type_all.)) |
| 404 | { |
| 405 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "game \"{}\" not created because it already exists", name); |
| 406 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; /* already have a game by that name */ |
| 407 | } |
| 408 | |
| 409 | game = (t_gamecxx . . $ pvpgn/bnetd/t_game#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_game)); |
| 410 | game->namecxx . . $ pvpgn/bnetd/game#name. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(name); |
| 411 | game->passcxx . . $ pvpgn/bnetd/game#pass. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(pass); |
| 412 | game->infocxx . . $ pvpgn/bnetd/game#info. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(info); |
| 413 | if (!(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. = clienttag)) |
| 414 | { |
| 415 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got UNKNOWN clienttag"); |
| 416 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->info); /* avoid warning */ |
| 417 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->pass); /* avoid warning */ |
| 418 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->name); /* avoid warning */ |
| 419 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(game); |
| 420 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 421 | } |
| 422 | |
| 423 | game->typecxx . . $ pvpgn/bnetd/game#type. = type; |
| 424 | game->addrcxx . . $ pvpgn/bnetd/game#addr. = 0; /* will be set by first player */ |
| 425 | game->portcxx . . $ pvpgn/bnetd/game#port. = 0; /* will be set by first player */ |
| 426 | game->versioncxx . . $ pvpgn/bnetd/game#version. = gameversion; |
| 427 | game->startvercxx . . $ pvpgn/bnetd/game#startver. = startver; /* start packet version */ |
| 428 | game->statuscxx . . $ pvpgn/bnetd/game#status. = game_status_opencxx . . $ pvpgn/bnetd/game_status_open.; |
| 429 | game->realmcxx . . $ pvpgn/bnetd/game#realm. = 0; |
| 430 | game->realmnamecxx . . $ pvpgn/bnetd/game#realmname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 431 | game->idcxx . . $ pvpgn/bnetd/game#id. = ++totalcountcxx . . $ pvpgn/bnetd/totalcount.; |
| 432 | game->mapnamecxx . . $ pvpgn/bnetd/game#mapname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 433 | game->refcxx . . $ pvpgn/bnetd/game#ref. = 0; |
| 434 | game->countcxx . . $ pvpgn/bnetd/game#count. = 0; |
| 435 | game->ownercxx . . $ pvpgn/bnetd/game#owner. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 436 | game->connectionscxx . . $ pvpgn/bnetd/game#connections. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 437 | game->playerscxx . . $ pvpgn/bnetd/game#players. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 438 | game->resultscxx . . $ pvpgn/bnetd/game#results. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 439 | game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 440 | game->report_headscxx . . $ pvpgn/bnetd/game#report_heads. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 441 | game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 442 | game->create_timecxx . . $ pvpgn/bnetd/game#create_time. = nowcxx . . $ pvpgn/bnetd/now.; |
| 443 | game->start_timecxx . . $ pvpgn/bnetd/game#start_time. = (stdcxx . . $ std/::time_tcxx . . $ std/time_t#)0; |
| 444 | game->lastaccess_timecxx . . $ pvpgn/bnetd/game#lastaccess_time. = nowcxx . . $ pvpgn/bnetd/now.; |
| 445 | game->optioncxx . . $ pvpgn/bnetd/game#option. = game_option_nonecxx . . $ pvpgn/bnetd/game_option_none.; |
| 446 | game->maptypecxx . . $ pvpgn/bnetd/game#maptype. = game_maptype_nonecxx . . $ pvpgn/bnetd/game_maptype_none.; |
| 447 | game->tilesetcxx . . $ pvpgn/bnetd/game#tileset. = game_tileset_nonecxx . . $ pvpgn/bnetd/game_tileset_none.; |
| 448 | game->speedcxx . . $ pvpgn/bnetd/game#speed. = game_speed_nonecxx . . $ pvpgn/bnetd/game_speed_none.; |
| 449 | game->mapsize_xcxx . . $ pvpgn/bnetd/game#mapsize_x. = 0; |
| 450 | game->mapsize_ycxx . . $ pvpgn/bnetd/game#mapsize_y. = 0; |
| 451 | game->maxplayerscxx . . $ pvpgn/bnetd/game#maxplayers. = 0; |
| 452 | game->badcxx . . $ pvpgn/bnetd/game#bad. = 0; |
| 453 | game->descriptioncxx . . $ pvpgn/bnetd/game#description. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 454 | game->flagcxx . . $ pvpgn/bnetd/game#flag. = stdcxx . . $ std/::strcmp(pass, "") ? game_flag_privatecxx . . $ pvpgn/bnetd/game_flag_private. : game_flag_nonecxx . . $ pvpgn/bnetd/game_flag_none.; |
| 455 | game->difficultycxx . . $ pvpgn/bnetd/game#difficulty. = game_difficulty_nonecxx . . $ pvpgn/bnetd/game_difficulty_none.; |
| 456 | |
| 457 | game_parse_infocxx . . $ pvpgn/bnetd/game_parse_info(bfbe5c8efad5152b).(game, info); |
| 458 | |
| 459 | elist_addcxx . . $ pvpgn/elist_add(3e860e19053b2cfa).(&gamelist_headcxx . . $ pvpgn/bnetd/gamelist_head., &game->glist_linkcxx . . $ pvpgn/bnetd/game#glist_link.); |
| 460 | glist_lengthcxx . . $ pvpgn/bnetd/glist_length.++; |
| 461 | |
| 462 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "game \"{}\" (pass \"{}\") type {}({}) startver {} created", name, pass, (unsigned short)type, game_type_get_strcxx . . $ pvpgn/bnetd/game_type_get_str(99410026be00fa29).(game->typecxx . . $ pvpgn/bnetd/game#type.), startver); |
| 463 | |
| 464 | return game; |
| 465 | } |
| 466 | |
| 467 | |
| 468 | static void game_destroycxx . . $ pvpgn/bnetd/game_destroy(59d2203d3d741d18).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game) |
| 469 | { |
| 470 | unsigned int i; |
| 471 | |
| 472 | if (!game) |
| 473 | { |
| 474 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 475 | return; |
| 476 | } |
| 477 | |
| 478 | #ifdef WITH_LUA |
| 479 | lua_handle_game(game, NULL, luaevent_game_destroy); |
| 480 | #endif |
| 481 | |
| 482 | elist_delcxx . . $ pvpgn/elist_del(c14d3311d3358512).(&game->glist_linkcxx . . $ pvpgn/bnetd/game#glist_link.); |
| 483 | glist_lengthcxx . . $ pvpgn/bnetd/glist_length.--; |
| 484 | |
| 485 | if (game->realmnamecxx . . $ pvpgn/bnetd/game#realmname.) |
| 486 | { |
| 487 | realm_add_game_numbercxx . . $ pvpgn/bnetd/realm_add_game_number(776df6f6ee711b79).(realmlist_find_realmcxx . . $ pvpgn/bnetd/realmlist_find_realm(8fe5f3fa56e7fb14).(game->realmnamecxx . . $ pvpgn/bnetd/game#realmname.), -1); |
| 488 | } |
| 489 | |
| 490 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "game \"{}\" (count={} ref={}) removed from list...", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->countcxx . . $ pvpgn/bnetd/game#count., game->refcxx . . $ pvpgn/bnetd/game#ref.); |
| 491 | |
| 492 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 493 | { |
| 494 | if (game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies. && game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[i]) |
| 495 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->report_bodies[i]); /* avoid warning */ |
| 496 | if (game->report_headscxx . . $ pvpgn/bnetd/game#report_heads. && game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[i]) |
| 497 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->report_heads[i]); /* avoid warning */ |
| 498 | if (game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results. && game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[i]) |
| 499 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->reported_results[i]); |
| 500 | } |
| 501 | if (game->realmnamecxx . . $ pvpgn/bnetd/game#realmname.) |
| 502 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->realmname); /* avoid warining */ |
| 503 | if (game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.) |
| 504 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->report_bodies); /* avoid warning */ |
| 505 | if (game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.) |
| 506 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->report_heads); /* avoid warning */ |
| 507 | if (game->resultscxx . . $ pvpgn/bnetd/game#results.) |
| 508 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->results); /* avoid warning */ |
| 509 | if (game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.) |
| 510 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->reported_results); |
| 511 | if (game->connectionscxx . . $ pvpgn/bnetd/game#connections.) |
| 512 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->connections); /* avoid warning */ |
| 513 | if (game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 514 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->players); /* avoid warning */ |
| 515 | if (game->mapnamecxx . . $ pvpgn/bnetd/game#mapname.) |
| 516 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->mapname); /* avoid warning */ |
| 517 | if (game->descriptioncxx . . $ pvpgn/bnetd/game#description.) |
| 518 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->description); /* avoid warning */ |
| 519 | |
| 520 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->info); /* avoid warning */ |
| 521 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->pass); /* avoid warning */ |
| 522 | if (game->namecxx . . $ pvpgn/bnetd/game#name.) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->name); /* avoid warning */ |
| 523 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game); /* avoid warning */ |
| 524 | |
| 525 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "game deleted"); |
| 526 | |
| 527 | return; |
| 528 | } |
| 529 | |
| 530 | static int game_evaluate_resultscxx . . $ pvpgn/bnetd/game_evaluate_results(7ab38d5cc74e6b21).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game) |
| 531 | { |
| 532 | unsigned int i, j; |
| 533 | unsigned int wins, losses, draws, disconnects, reports; |
| 534 | |
| 535 | if (!game) |
| 536 | { |
| 537 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 538 | return -1; |
| 539 | } |
| 540 | if (!game->resultscxx . . $ pvpgn/bnetd/game#results.) |
| 541 | { |
| 542 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "results array is NULL"); |
| 543 | return -1; |
| 544 | } |
| 545 | |
| 546 | if (!game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.) |
| 547 | { |
| 548 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "reported_results array is NULL"); |
| 549 | return -1; |
| 550 | } |
| 551 | |
| 552 | int discisloss = game_discislosscxx . . $ pvpgn/bnetd/game_discisloss(7ab38d5cc74e6b21).(game); |
| 553 | |
| 554 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 555 | { |
| 556 | wins = losses = draws = disconnects = reports = 0; |
| 557 | |
| 558 | for (j = 0; j < game->countcxx . . $ pvpgn/bnetd/game#count.; j++) |
| 559 | { |
| 560 | if (game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[j]) |
| 561 | { |
| 562 | switch (game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[j][i]) |
| 563 | { |
| 564 | case game_result_wincxx . . $ pvpgn/bnetd/game_result_win.: |
| 565 | wins++; |
| 566 | reports++; |
| 567 | break; |
| 568 | case game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.: |
| 569 | losses++; |
| 570 | reports++; |
| 571 | break; |
| 572 | case game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.: |
| 573 | draws++; |
| 574 | reports++; |
| 575 | break; |
| 576 | case game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.: |
| 577 | disconnects++; |
| 578 | reports++; |
| 579 | break; |
| 580 | default: |
| 581 | break; |
| 582 | } |
| 583 | } |
| 584 | } |
| 585 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "wins: {} losses: {} draws: {} disconnects: {}", wins, losses, draws, disconnects); |
| 586 | |
| 587 | //now decide what result we give |
| 588 | if (!(reports)) // no results at all - game canceled before starting |
| 589 | { |
| 590 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.; |
| 591 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "deciding to give \"none\" to player {}", i); |
| 592 | } |
| 593 | else if ((disconnects >= draws) && (disconnects >= losses) && (disconnects >= wins)) |
| 594 | { |
| 595 | if (discisloss) |
| 596 | { |
| 597 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.; //losses are also bad... |
| 598 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "deciding to give \"loss\" to player {} (due to discisloss)", i); |
| 599 | } |
| 600 | else |
| 601 | { |
| 602 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.; //consider disconnects the worst case... |
| 603 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "deciding to give \"disconnect\" to player {}", i); |
| 604 | } |
| 605 | } |
| 606 | else if ((losses >= wins) && (losses >= draws)) |
| 607 | { |
| 608 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.; //losses are also bad... |
| 609 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "deciding to give \"loss\" to player {}", i); |
| 610 | } |
| 611 | else if ((draws >= wins)) |
| 612 | { |
| 613 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.; |
| 614 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "deciding to give \"draw\" to player {}", i); |
| 615 | } |
| 616 | else if (wins) |
| 617 | { |
| 618 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_wincxx . . $ pvpgn/bnetd/game_result_win.; |
| 619 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "deciding to give \"win\" to player {}", i); |
| 620 | } |
| 621 | } |
| 622 | return 0; |
| 623 | } |
| 624 | |
| 625 | static int game_match_typecxx . . $ pvpgn/bnetd/game_match_type(f66f3c9caada6691).(t_game_typecxx . . $ pvpgn/bnetd/t_game_type# type, const char *gametypes) |
| 626 | { |
| 627 | char *p, *q; |
| 628 | int res; |
| 629 | |
| 630 | if (!gametypes || !gametypes[0]) return 0; |
| 631 | |
| 632 | gametypes = p = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(gametypes); |
| 633 | res = 0; |
| 634 | do { |
| 635 | q = stdcxx . . $ std/::strchr(p, ','); |
| 636 | if (q) *q = '\0'; |
| 637 | if (!strcasecmp(p, "topvbot")) { |
| 638 | if (type == game_type_topvbotcxx . . $ pvpgn/bnetd/game_type_topvbot.) { res = 1; break; } |
| 639 | } |
| 640 | else if (!strcasecmp(p, "melee")) { |
| 641 | if (type == game_type_meleecxx . . $ pvpgn/bnetd/game_type_melee.) { res = 1; break; } |
| 642 | } |
| 643 | else if (!strcasecmp(p, "ffa")) { |
| 644 | if (type == game_type_ffacxx . . $ pvpgn/bnetd/game_type_ffa.) { res = 1; break; } |
| 645 | } |
| 646 | else if (!strcasecmp(p, "oneonone")) { |
| 647 | if (type == game_type_oneononecxx . . $ pvpgn/bnetd/game_type_oneonone.) { res = 1; break; } |
| 648 | } |
| 649 | if (q) p = q + 1; |
| 650 | } while (q); |
| 651 | |
| 652 | free((void*)gametypes); |
| 653 | return res; |
| 654 | } |
| 655 | |
| 656 | static int game_sanity_checkcxx . . $ pvpgn/bnetd/game_sanity_check(141af0ab8bca7c40).(t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# * results, t_accountcxx . . $ pvpgn/bnetd/t_account# * * players, unsigned int count, unsigned int discisloss) |
| 657 | { |
| 658 | unsigned int winners = 0; |
| 659 | unsigned int losers = 0; |
| 660 | unsigned int draws = 0; |
| 661 | unsigned int discs = 0; |
| 662 | |
| 663 | for (unsigned int curr = 0; curr < count; curr++) |
| 664 | { |
| 665 | if (!players[curr]) |
| 666 | { |
| 667 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL player[{}] (of {})", curr, count); |
| 668 | return -1; |
| 669 | } |
| 670 | |
| 671 | switch (results[curr]) |
| 672 | { |
| 673 | case game_result_wincxx . . $ pvpgn/bnetd/game_result_win.: |
| 674 | winners++; |
| 675 | break; |
| 676 | case game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.: |
| 677 | losers++; |
| 678 | break; |
| 679 | case game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.: |
| 680 | draws++; |
| 681 | break; |
| 682 | case game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.: |
| 683 | discs++; |
| 684 | break; |
| 685 | default: |
| 686 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "bad results[{}]={}", curr, (unsigned int)results[curr]); |
| 687 | return -1; |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | if (draws > 0) |
| 692 | { |
| 693 | if (draws != count) |
| 694 | { |
| 695 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "some, but not all players had a draw count={} (winners={} losers={} draws={})", count, winners, losers, draws); |
| 696 | return -1; |
| 697 | } |
| 698 | return 0; |
| 699 | } |
| 700 | |
| 701 | if ((discisloss) && ((losers < 1) || (winners<1) || (winners>1 && (winners != losers)))) |
| 702 | { |
| 703 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "missing winner or loser for count={} (winners={} losers={})", count, winners, losers); |
| 704 | return -1; |
| 705 | } |
| 706 | |
| 707 | return 0; |
| 708 | } |
| 709 | |
| 710 | static int game_reportcxx . . $ pvpgn/bnetd/game_report(7ab38d5cc74e6b21).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game) |
| 711 | { |
| 712 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 713 | char * realname; |
| 714 | char * tempname; |
| 715 | unsigned int i; |
| 716 | unsigned int realcount; |
| 717 | t_ladder_infocxx . . $ pvpgn/bnetd/t_ladder_info# * ladder_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 718 | char clienttag_str[5]; |
| 719 | |
| 720 | if (!game) |
| 721 | { |
| 722 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 723 | return -1; |
| 724 | } |
| 725 | if (!game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.) |
| 726 | { |
| 727 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got UNKNOWN clienttag"); |
| 728 | return -1; |
| 729 | } |
| 730 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 731 | { |
| 732 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player array is NULL"); |
| 733 | return -1; |
| 734 | } |
| 735 | if (!game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.) |
| 736 | { |
| 737 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "reported_results array is NULL"); |
| 738 | return -1; |
| 739 | } |
| 740 | if (!game->resultscxx . . $ pvpgn/bnetd/game#results.) |
| 741 | { |
| 742 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "results array is NULL"); |
| 743 | return -1; |
| 744 | } |
| 745 | |
| 746 | #ifdef WITH_LUA |
| 747 | lua_handle_game(game, NULL, luaevent_game_end); |
| 748 | #endif |
| 749 | |
| 750 | if (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `src/common/tag.h:111:9`! || game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_WAR3XP_UINTcxx . . $ `src/common/tag.h:113:9`!) |
| 751 | // war3 game reporting is done elsewhere, so we can skip this function |
| 752 | return 0; |
| 753 | |
| 754 | if ((game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_WCHAT_UINTcxx . . $ `src/common/tag.h:120:9`!) || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_REDALERT_UINTcxx . . $ `src/common/tag.h:126:9`!) |
| 755 | || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_DUNE2000_UINTcxx . . $ `src/common/tag.h:130:9`!) || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_NOX_UINTcxx . . $ `src/common/tag.h:132:9`!) |
| 756 | || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_NOXQUEST_UINTcxx . . $ `src/common/tag.h:134:9`!) || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_RENEGADE_UINTcxx . . $ `src/common/tag.h:136:9`!) |
| 757 | || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_RENGDFDS_UINTcxx . . $ `src/common/tag.h:138:9`!) || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_EMPERORBD_UINTcxx . . $ `src/common/tag.h:142:9`!) |
| 758 | || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_LOFLORE3_UINTcxx . . $ `src/common/tag.h:144:9`!) || (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_WWOL_UINTcxx . . $ `src/common/tag.h:146:9`!)) |
| 759 | // PELISH: We are not supporting ladders for all WOL clients yet |
| 760 | return 0; |
| 761 | |
| 762 | if (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_DIABLOSHR_UINTcxx . . $ `src/common/tag.h:95:9`! || |
| 763 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_DIABLORTL_UINTcxx . . $ `src/common/tag.h:93:9`! || |
| 764 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_DIABLO2ST_UINTcxx . . $ `src/common/tag.h:103:9`! || |
| 765 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_DIABLO2DV_UINTcxx . . $ `src/common/tag.h:99:9`! || |
| 766 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_DIABLO2XP_UINTcxx . . $ `src/common/tag.h:105:9`!) |
| 767 | { |
| 768 | if (prefs_get_report_diablo_gamescxx . . $ pvpgn/bnetd/prefs_get_report_diablo_games(db52760e79bf9054).() == 1) |
| 769 | /* diablo games have transient players and no reported winners/losers */ |
| 770 | realcount = 0; |
| 771 | else |
| 772 | { |
| 773 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "diablo gamereport disabled: ignoring game"); |
| 774 | return 0; |
| 775 | } |
| 776 | } |
| 777 | else |
| 778 | { |
| 779 | game_evaluate_resultscxx . . $ pvpgn/bnetd/game_evaluate_results(7ab38d5cc74e6b21).(game); // evaluate results from the reported results |
| 780 | /* "compact" the game; move all the real players to the top... */ |
| 781 | realcount = 0; |
| 782 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 783 | { |
| 784 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.[i]) |
| 785 | { |
| 786 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player slot {} has NULL account", i); |
| 787 | continue; |
| 788 | } |
| 789 | |
| 790 | if (game->resultscxx . . $ pvpgn/bnetd/game#results.[i] != game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.) |
| 791 | { |
| 792 | game->playerscxx . . $ pvpgn/bnetd/game#players.[realcount] = game->playerscxx . . $ pvpgn/bnetd/game#players.[i]; |
| 793 | game->resultscxx . . $ pvpgn/bnetd/game#results.[realcount] = game->resultscxx . . $ pvpgn/bnetd/game#results.[i]; |
| 794 | game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[realcount] = game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[i]; |
| 795 | game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[realcount] = game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[i]; |
| 796 | realcount++; |
| 797 | } |
| 798 | } |
| 799 | |
| 800 | /* then nuke duplicate players after the real players */ |
| 801 | for (i = realcount; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 802 | { |
| 803 | game->playerscxx . . $ pvpgn/bnetd/game#players.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 804 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.; |
| 805 | game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 806 | game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 807 | } |
| 808 | |
| 809 | if (realcount < 1) |
| 810 | { |
| 811 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "ignoring game"); |
| 812 | return -1; |
| 813 | } |
| 814 | |
| 815 | if (game_sanity_checkcxx . . $ pvpgn/bnetd/game_sanity_check(141af0ab8bca7c40).(game->resultscxx . . $ pvpgn/bnetd/game#results., game->playerscxx . . $ pvpgn/bnetd/game#players., realcount, game_is_laddercxx . . $ pvpgn/bnetd/game_is_ladder(7ab38d5cc74e6b21).(game) && game_discislosscxx . . $ pvpgn/bnetd/game_discisloss(7ab38d5cc74e6b21).(game)) < 0) |
| 816 | { |
| 817 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "game results ignored due to inconsistencies"); |
| 818 | game->badcxx . . $ pvpgn/bnetd/game#bad. = 1; |
| 819 | } |
| 820 | |
| 821 | if (((tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.)) || (tag_check_wolv2cxx . . $ pvpgn/tag_check_wolv2(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.))) && (realcount == 2) |
| 822 | && (game->resultscxx . . $ pvpgn/bnetd/game#results.[0] == game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.) && (game->resultscxx . . $ pvpgn/bnetd/game#results.[0] == game->resultscxx . . $ pvpgn/bnetd/game#results.[1])) { |
| 823 | //FIXME: Find more general solution for that (we are not supporting more than 2 players now) |
| 824 | DEBUG0cxx . . $ `src/common/eventlog.h:88:9`!("WOL Both players got game_result_disconnect - ignoring game"); |
| 825 | game->badcxx . . $ pvpgn/bnetd/game#bad. = 1; |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "realcount={} count={}", realcount, game->countcxx . . $ pvpgn/bnetd/game#count.); |
| 830 | |
| 831 | if (realcount >= 1 && !game->badcxx . . $ pvpgn/bnetd/game#bad.) |
| 832 | { |
| 833 | if (game_is_laddercxx . . $ pvpgn/bnetd/game_is_ladder(7ab38d5cc74e6b21).(game)) |
| 834 | { |
| 835 | t_ladder_idcxx . . $ pvpgn/bnetd/t_ladder_id# id; |
| 836 | |
| 837 | if (game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) == game_type_ironmancxx . . $ pvpgn/bnetd/game_type_ironman.) |
| 838 | id = ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.; |
| 839 | else |
| 840 | id = ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.; |
| 841 | |
| 842 | for (i = 0; i < realcount; i++) |
| 843 | { |
| 844 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "realplayer {} result={}", i + 1, (unsigned int)game->resultscxx . . $ pvpgn/bnetd/game#results.[i]); |
| 845 | |
| 846 | if ((tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.)) || (tag_check_wolv2cxx . . $ pvpgn/tag_check_wolv2(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.))) { |
| 847 | id = ladder_id_solocxx . . $ pvpgn/bnetd/ladder_id_solo.; |
| 848 | ladder_init_account_wolcxx . . $ pvpgn/bnetd/ladder_init_account_wol(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 849 | switch (game->resultscxx . . $ pvpgn/bnetd/game#results.[i]) |
| 850 | { |
| 851 | case game_result_wincxx . . $ pvpgn/bnetd/game_result_win.: |
| 852 | account_inc_ladder_winscxx . . $ pvpgn/bnetd/account_inc_ladder_wins(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 853 | break; |
| 854 | case game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.: |
| 855 | account_inc_ladder_lossescxx . . $ pvpgn/bnetd/account_inc_ladder_losses(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 856 | break; |
| 857 | case game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.: |
| 858 | account_inc_ladder_disconnectscxx . . $ pvpgn/bnetd/account_inc_ladder_disconnects(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 859 | break; |
| 860 | default: |
| 861 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "bad ladder game realplayer results[{}] = {}", i, game->resultscxx . . $ pvpgn/bnetd/game#results.[i]); |
| 862 | account_inc_ladder_disconnectscxx . . $ pvpgn/bnetd/account_inc_ladder_disconnects(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 863 | } |
| 864 | } |
| 865 | else { |
| 866 | ladder_init_accountcxx . . $ pvpgn/bnetd/ladder_init_account(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 867 | switch (game->resultscxx . . $ pvpgn/bnetd/game#results.[i]) |
| 868 | { |
| 869 | case game_result_wincxx . . $ pvpgn/bnetd/game_result_win.: |
| 870 | account_inc_ladder_winscxx . . $ pvpgn/bnetd/account_inc_ladder_wins(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 871 | account_set_ladder_last_resultcxx . . $ pvpgn/bnetd/account_set_ladder_last_result(7808eb821b85d01f).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_wincxx . . $ pvpgn/bnetd/game_result_win.)); |
| 872 | break; |
| 873 | case game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.: |
| 874 | account_inc_ladder_lossescxx . . $ pvpgn/bnetd/account_inc_ladder_losses(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 875 | account_set_ladder_last_resultcxx . . $ pvpgn/bnetd/account_set_ladder_last_result(7808eb821b85d01f).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.)); |
| 876 | break; |
| 877 | case game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.: |
| 878 | account_inc_ladder_drawscxx . . $ pvpgn/bnetd/account_inc_ladder_draws(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 879 | account_set_ladder_last_resultcxx . . $ pvpgn/bnetd/account_set_ladder_last_result(7808eb821b85d01f).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.)); |
| 880 | break; |
| 881 | case game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.: |
| 882 | account_inc_ladder_disconnectscxx . . $ pvpgn/bnetd/account_inc_ladder_disconnects(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 883 | account_set_ladder_last_resultcxx . . $ pvpgn/bnetd/account_set_ladder_last_result(7808eb821b85d01f).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.)); |
| 884 | break; |
| 885 | default: |
| 886 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "bad ladder game realplayer results[{}] = {}", i, game->resultscxx . . $ pvpgn/bnetd/game#results.[i]); |
| 887 | account_inc_ladder_disconnectscxx . . $ pvpgn/bnetd/account_inc_ladder_disconnects(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id); |
| 888 | account_set_ladder_last_resultcxx . . $ pvpgn/bnetd/account_set_ladder_last_result(7808eb821b85d01f).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.)); |
| 889 | } |
| 890 | account_set_ladder_last_timecxx . . $ pvpgn/bnetd/account_set_ladder_last_time(32ef04081d2febf2).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, bnettimecxx . . $ pvpgn/bnettime(c08f2632e82bc0c).()); |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | if ((tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.)) || (tag_check_wolv2cxx . . $ pvpgn/tag_check_wolv2(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.))) { |
| 895 | id = ladder_id_solocxx . . $ pvpgn/bnetd/ladder_id_solo.; |
| 896 | ladder_update_wolcxx . . $ pvpgn/bnetd/ladder_update_wol(d1ed5ef110d0cee8).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, game->playerscxx . . $ pvpgn/bnetd/game#players., game->resultscxx . . $ pvpgn/bnetd/game#results.); |
| 897 | } |
| 898 | else { |
| 899 | ladder_info = (t_ladder_infocxx . . $ pvpgn/bnetd/t_ladder_info#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_ladder_info)*realcount); |
| 900 | if (ladder_updatecxx . . $ pvpgn/bnetd/ladder_update(4752c89782a4cabb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., id, |
| 901 | realcount, game->playerscxx . . $ pvpgn/bnetd/game#players., game->resultscxx . . $ pvpgn/bnetd/game#results., ladder_info) < 0) |
| 902 | { |
| 903 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "unable to update ladder stats"); |
| 904 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(ladder_info); |
| 905 | ladder_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 906 | } |
| 907 | } |
| 908 | } |
| 909 | else |
| 910 | { |
| 911 | if (!(tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.)) || !(tag_check_wolv2cxx . . $ pvpgn/tag_check_wolv2(4c679297bf94b9eb).(game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.))) { |
| 912 | for (i = 0; i < realcount; i++) |
| 913 | { |
| 914 | switch (game->resultscxx . . $ pvpgn/bnetd/game#results.[i]) |
| 915 | { |
| 916 | case game_result_wincxx . . $ pvpgn/bnetd/game_result_win.: |
| 917 | account_inc_normal_winscxx . . $ pvpgn/bnetd/account_inc_normal_wins(43f7d0f5a7c4b307).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.); |
| 918 | account_set_normal_last_resultcxx . . $ pvpgn/bnetd/account_set_normal_last_result(571eb5b9fcb96c29).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_wincxx . . $ pvpgn/bnetd/game_result_win.)); |
| 919 | break; |
| 920 | case game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.: |
| 921 | account_inc_normal_lossescxx . . $ pvpgn/bnetd/account_inc_normal_losses(43f7d0f5a7c4b307).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.); |
| 922 | account_set_normal_last_resultcxx . . $ pvpgn/bnetd/account_set_normal_last_result(571eb5b9fcb96c29).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.)); |
| 923 | break; |
| 924 | case game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.: |
| 925 | account_inc_normal_drawscxx . . $ pvpgn/bnetd/account_inc_normal_draws(43f7d0f5a7c4b307).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.); |
| 926 | account_set_normal_last_resultcxx . . $ pvpgn/bnetd/account_set_normal_last_result(571eb5b9fcb96c29).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.)); |
| 927 | break; |
| 928 | case game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.: |
| 929 | account_inc_normal_disconnectscxx . . $ pvpgn/bnetd/account_inc_normal_disconnects(43f7d0f5a7c4b307).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.); |
| 930 | account_set_normal_last_resultcxx . . $ pvpgn/bnetd/account_set_normal_last_result(571eb5b9fcb96c29).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.)); |
| 931 | break; |
| 932 | default: |
| 933 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "bad normal game realplayer results[{}] = {}", i, game->resultscxx . . $ pvpgn/bnetd/game#results.[i]); |
| 934 | account_inc_normal_disconnectscxx . . $ pvpgn/bnetd/account_inc_normal_disconnects(43f7d0f5a7c4b307).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.); |
| 935 | account_set_normal_last_resultcxx . . $ pvpgn/bnetd/account_set_normal_last_result(571eb5b9fcb96c29).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.)); |
| 936 | } |
| 937 | account_set_normal_last_timecxx . . $ pvpgn/bnetd/account_set_normal_last_time(d6a1914573ef2a55).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., bnettimecxx . . $ pvpgn/bnettime(c08f2632e82bc0c).()); |
| 938 | } |
| 939 | } |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | if (game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) != game_type_laddercxx . . $ pvpgn/bnetd/game_type_ladder. && prefs_get_report_all_gamescxx . . $ pvpgn/bnetd/prefs_get_report_all_games(db52760e79bf9054).() != 1) |
| 944 | { |
| 945 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "not reporting normal games"); |
| 946 | |
| 947 | if (ladder_info) |
| 948 | { |
| 949 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(ladder_info); |
| 950 | } |
| 951 | |
| 952 | return 0; |
| 953 | } |
| 954 | |
| 955 | { |
| 956 | struct stdcxx . . $ std/::tmcxx . . $ tm# * tmval; |
| 957 | char dstr[64]; |
| 958 | |
| 959 | if (!(tmval = stdcxx . . $ std/::localtimecxx . . $ std/localtime(7d91c9e5f6bb884b).(&nowcxx . . $ pvpgn/bnetd/now.))) |
| 960 | dstr[0] = '\0'; |
| 961 | else |
| 962 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(dstr, "%04d%02d%02d%02d%02d%02d", |
| 963 | 1900 + tmval->tm_yearcxx . . $ tm#tm_year., |
| 964 | tmval->tm_moncxx . . $ tm#tm_mon. + 1, |
| 965 | tmval->tm_mdaycxx . . $ tm#tm_mday., |
| 966 | tmval->tm_hourcxx . . $ tm#tm_hour., |
| 967 | tmval->tm_mincxx . . $ tm#tm_min., |
| 968 | tmval->tm_seccxx . . $ tm#tm_sec.); |
| 969 | |
| 970 | tempname = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_reportdir()) + 1 + 1 + 5 + 1 + 2 + 1 + std::strlen(dstr) + 1 + 6 + 1); |
| 971 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(tempname, "%s/_bnetd-gr_%s_%06u", prefs_get_reportdircxx . . $ pvpgn/bnetd/prefs_get_reportdir(33a1f659e94feb42).(), dstr, game->idcxx . . $ pvpgn/bnetd/game#id.); |
| 972 | realname = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_reportdir()) + 1 + 2 + 1 + std::strlen(dstr) + 1 + 6 + 1); |
| 973 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(realname, "%s/gr_%s_%06u", prefs_get_reportdircxx . . $ pvpgn/bnetd/prefs_get_reportdir(33a1f659e94feb42).(), dstr, game->idcxx . . $ pvpgn/bnetd/game#id.); |
| 974 | } |
| 975 | |
| 976 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(tempname, "w"))) |
| 977 | { |
| 978 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not open report file \"{}\" for writing (std::fopen: {})", tempname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 979 | if (ladder_info) |
| 980 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(ladder_info); |
| 981 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(realname); |
| 982 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(tempname); |
| 983 | return -1; |
| 984 | } |
| 985 | |
| 986 | if (game->badcxx . . $ pvpgn/bnetd/game#bad.) |
| 987 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "[ game results ignored due to inconsistencies ]\n\n"); |
| 988 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "name=\"%s\" id=" GAMEID_FORMATFcxx . . $ `src/common/setup_before.h:88:9`! "\n", |
| 989 | game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), |
| 990 | game->idcxx . . $ pvpgn/bnetd/game#id.); |
| 991 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "clienttag=%4s type=\"%s\" option=\"%s\"\n", |
| 992 | tag_uint_to_strcxx . . $ pvpgn/tag_uint_to_str(d172961b102a89a5).(clienttag_str, game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.), |
| 993 | game_type_get_strcxx . . $ pvpgn/bnetd/game_type_get_str(99410026be00fa29).(game->typecxx . . $ pvpgn/bnetd/game#type.), |
| 994 | game_option_get_strcxx . . $ pvpgn/bnetd/game_option_get_str(e828d4f1344dfcc).(game->optioncxx . . $ pvpgn/bnetd/game#option.)); |
| 995 | { |
| 996 | struct stdcxx . . $ std/::tmcxx . . $ tm# * gametime; |
| 997 | char timetemp[GAME_TIME_MAXLENcxx . . $ GAME_TIME_MAXLEN.]; |
| 998 | |
| 999 | if (!(gametime = stdcxx . . $ std/::localtimecxx . . $ std/localtime(7d91c9e5f6bb884b).(&game->create_timecxx . . $ pvpgn/bnetd/game#create_time.))) |
| 1000 | stdcxx . . $ std/::strcpy(timetemp, "?"); |
| 1001 | else |
| 1002 | stdcxx . . $ std/::strftimecxx . . $ std/strftime(689617e6f2fd1a9a).(timetemp, sizeof(timetemp), GAME_TIME_FORMATcxx . . $ `src/common/setup_before.h:107:9`!, gametime); |
| 1003 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "created=\"%s\" ", timetemp); |
| 1004 | |
| 1005 | if (!(gametime = stdcxx . . $ std/::localtimecxx . . $ std/localtime(7d91c9e5f6bb884b).(&game->start_timecxx . . $ pvpgn/bnetd/game#start_time.))) |
| 1006 | stdcxx . . $ std/::strcpy(timetemp, "?"); |
| 1007 | else |
| 1008 | stdcxx . . $ std/::strftimecxx . . $ std/strftime(689617e6f2fd1a9a).(timetemp, sizeof(timetemp), GAME_TIME_FORMATcxx . . $ `src/common/setup_before.h:107:9`!, gametime); |
| 1009 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "started=\"%s\" ", timetemp); |
| 1010 | |
| 1011 | if (!(gametime = stdcxx . . $ std/::localtimecxx . . $ std/localtime(7d91c9e5f6bb884b).(&nowcxx . . $ pvpgn/bnetd/now.))) |
| 1012 | stdcxx . . $ std/::strcpy(timetemp, "?"); |
| 1013 | else |
| 1014 | stdcxx . . $ std/::strftimecxx . . $ std/strftime(689617e6f2fd1a9a).(timetemp, sizeof(timetemp), GAME_TIME_FORMATcxx . . $ `src/common/setup_before.h:107:9`!, gametime); |
| 1015 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "ended=\"%s\"\n", timetemp); |
| 1016 | } |
| 1017 | { |
| 1018 | char const * mapname; |
| 1019 | |
| 1020 | if (!(mapname = game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(game))) |
| 1021 | mapname = "?"; |
| 1022 | |
| 1023 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "mapfile=\"%s\" mapauth=\"%s\" mapsize=%ux%u tileset=\"%s\"\n", |
| 1024 | mapname, |
| 1025 | game_maptype_get_strcxx . . $ pvpgn/bnetd/game_maptype_get_str(1e9597ee27ef5802).(game_get_maptypecxx . . $ pvpgn/bnetd/game_get_maptype(8b14781ac714f1ed).(game)), |
| 1026 | game_get_mapsize_xcxx . . $ pvpgn/bnetd/game_get_mapsize_x(d7b85b5cd2056731).(game), game_get_mapsize_ycxx . . $ pvpgn/bnetd/game_get_mapsize_y(d7b85b5cd2056731).(game), |
| 1027 | game_tileset_get_strcxx . . $ pvpgn/bnetd/game_tileset_get_str(ad8e0289366c942d).(game_get_tilesetcxx . . $ pvpgn/bnetd/game_get_tileset(7bb4e32b969fbea2).(game))); |
| 1028 | } |
| 1029 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "joins=%u maxplayers=%u\n", |
| 1030 | game_get_countcxx . . $ pvpgn/bnetd/game_get_count(d7b85b5cd2056731).(game), |
| 1031 | game_get_maxplayerscxx . . $ pvpgn/bnetd/game_get_maxplayers(d7b85b5cd2056731).(game)); |
| 1032 | |
| 1033 | if (!prefs_get_hide_addrcxx . . $ pvpgn/bnetd/prefs_get_hide_addr(db52760e79bf9054).()) |
| 1034 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "host=%s\n", addr_num_to_addr_strcxx . . $ pvpgn/addr_num_to_addr_str(9313bf3c546cb16).(game_get_addrcxx . . $ pvpgn/bnetd/game_get_addr(d7b85b5cd2056731).(game), game_get_portcxx . . $ pvpgn/bnetd/game_get_port(5675c6bb4f2bafa6).(game))); |
| 1035 | |
| 1036 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "\n\n"); |
| 1037 | |
| 1038 | if (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_DIABLORTL_UINTcxx . . $ `src/common/tag.h:93:9`!) |
| 1039 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 1040 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%-16s JOINED\n", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i])); |
| 1041 | else |
| 1042 | if (ladder_info) |
| 1043 | for (i = 0; i < realcount; i++) |
| 1044 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%-16s %-8s rating=%u [#%05u] prob=%4.1f%% K=%2u adj=%+d\n", |
| 1045 | account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i]), |
| 1046 | game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game->resultscxx . . $ pvpgn/bnetd/game#results.[i]), |
| 1047 | ladder_info[i].oldratingcxx . . $ pvpgn/bnetd/$anonymous_type_45ff37c90d47142d_0#oldrating., |
| 1048 | ladder_info[i].oldrankcxx . . $ pvpgn/bnetd/$anonymous_type_45ff37c90d47142d_0#oldrank., |
| 1049 | ladder_info[i].probcxx . . $ pvpgn/bnetd/$anonymous_type_45ff37c90d47142d_0#prob.*100.0, |
| 1050 | ladder_info[i].kcxx . . $ pvpgn/bnetd/$anonymous_type_45ff37c90d47142d_0#k., |
| 1051 | ladder_info[i].adjcxx . . $ pvpgn/bnetd/$anonymous_type_45ff37c90d47142d_0#adj.); |
| 1052 | else |
| 1053 | for (i = 0; i < realcount; i++) |
| 1054 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%-16s %-8s\n", |
| 1055 | account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i]), |
| 1056 | game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(game->resultscxx . . $ pvpgn/bnetd/game#results.[i])); |
| 1057 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "\n\n"); |
| 1058 | |
| 1059 | if (ladder_info) |
| 1060 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(ladder_info); |
| 1061 | |
| 1062 | for (i = 0; i < realcount; i++) |
| 1063 | { |
| 1064 | if (game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[i]) |
| 1065 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%s\n", game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[i]); |
| 1066 | else |
| 1067 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "[ game report header not available for player %u (\"%s\") ]\n", i + 1, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i])); |
| 1068 | if (game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[i]) |
| 1069 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%s\n", game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[i]); |
| 1070 | else |
| 1071 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "[ game report body not available for player %u (\"%s\") ]\n\n", i + 1, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i])); |
| 1072 | } |
| 1073 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "\n\n"); |
| 1074 | |
| 1075 | if (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_STARCRAFT_UINTcxx . . $ `src/common/tag.h:87:9`! || |
| 1076 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_SHAREWARE_UINTcxx . . $ `src/common/tag.h:91:9`! || |
| 1077 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_BROODWARS_UINTcxx . . $ `src/common/tag.h:89:9`! || |
| 1078 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_WARCIIBNE_UINTcxx . . $ `src/common/tag.h:97:9`!) |
| 1079 | { |
| 1080 | for (i = 0; i < realcount; i++) |
| 1081 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%s's normal record is now %u/%u/%u (%u draws)\n", |
| 1082 | account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i]), |
| 1083 | account_get_normal_winscxx . . $ pvpgn/bnetd/account_get_normal_wins(93d29eefa17aed6d).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.), |
| 1084 | account_get_normal_lossescxx . . $ pvpgn/bnetd/account_get_normal_losses(93d29eefa17aed6d).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.), |
| 1085 | account_get_normal_disconnectscxx . . $ pvpgn/bnetd/account_get_normal_disconnects(93d29eefa17aed6d).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.), |
| 1086 | account_get_normal_drawscxx . . $ pvpgn/bnetd/account_get_normal_draws(93d29eefa17aed6d).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.)); |
| 1087 | } |
| 1088 | if (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_STARCRAFT_UINTcxx . . $ `src/common/tag.h:87:9`! || |
| 1089 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_BROODWARS_UINTcxx . . $ `src/common/tag.h:89:9`! || |
| 1090 | game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_WARCIIBNE_UINTcxx . . $ `src/common/tag.h:97:9`!) |
| 1091 | { |
| 1092 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "\n"); |
| 1093 | for (i = 0; i < realcount; i++) |
| 1094 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%s's standard ladder record is now %u/%u/%u (rating %u [#%05d]) (%u draws)\n", |
| 1095 | account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i]), |
| 1096 | account_get_ladder_winscxx . . $ pvpgn/bnetd/account_get_ladder_wins(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.), |
| 1097 | account_get_ladder_lossescxx . . $ pvpgn/bnetd/account_get_ladder_losses(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.), |
| 1098 | account_get_ladder_disconnectscxx . . $ pvpgn/bnetd/account_get_ladder_disconnects(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.), |
| 1099 | account_get_ladder_ratingcxx . . $ pvpgn/bnetd/account_get_ladder_rating(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.), |
| 1100 | account_get_ladder_rankcxx . . $ pvpgn/bnetd/account_get_ladder_rank(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.), |
| 1101 | account_get_ladder_drawscxx . . $ pvpgn/bnetd/account_get_ladder_draws(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.)); |
| 1102 | } |
| 1103 | if (game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. == CLIENTTAG_WARCIIBNE_UINTcxx . . $ `src/common/tag.h:97:9`!) |
| 1104 | { |
| 1105 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "\n"); |
| 1106 | for (i = 0; i < realcount; i++) |
| 1107 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "%s's ironman ladder record is now %u/%u/%u (rating %u [#%05d]) (%u draws)\n", |
| 1108 | account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[i]), |
| 1109 | account_get_ladder_winscxx . . $ pvpgn/bnetd/account_get_ladder_wins(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.), |
| 1110 | account_get_ladder_lossescxx . . $ pvpgn/bnetd/account_get_ladder_losses(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.), |
| 1111 | account_get_ladder_disconnectscxx . . $ pvpgn/bnetd/account_get_ladder_disconnects(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.), |
| 1112 | account_get_ladder_ratingcxx . . $ pvpgn/bnetd/account_get_ladder_rating(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.), |
| 1113 | account_get_ladder_rankcxx . . $ pvpgn/bnetd/account_get_ladder_rank(829aa05f631ee398).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.), |
| 1114 | account_get_ladder_drawscxx . . $ pvpgn/bnetd/account_get_ladder_draws(44091a2c7ac3910).(game->playerscxx . . $ pvpgn/bnetd/game#players.[i], game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag., ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.)); |
| 1115 | } |
| 1116 | |
| 1117 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(fp, "\nThis game lasted %lu minutes (elapsed).\n", ((unsigned long int)stdcxx . . $ std/::difftimecxx . . $ std/difftime(f630275aa3e30a1e).(nowcxx . . $ pvpgn/bnetd/now., game->start_timecxx . . $ pvpgn/bnetd/game#start_time.)) / 60); |
| 1118 | |
| 1119 | #ifdef WITH_LUA |
| 1120 | lua_handle_game(game, NULL, luaevent_game_report); |
| 1121 | #endif |
| 1122 | |
| 1123 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) |
| 1124 | { |
| 1125 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not close report file \"{}\" after writing (std::fclose: {})", tempname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 1126 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(realname); |
| 1127 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(tempname); |
| 1128 | return -1; |
| 1129 | } |
| 1130 | |
| 1131 | if (p_renamecxx . . $ pvpgn/p_rename(5ae29d726ae57f88).(tempname, realname) < 0) |
| 1132 | { |
| 1133 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not std::rename report file to \"{}\" (std::rename: {})", realname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 1134 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(realname); |
| 1135 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(tempname); |
| 1136 | return -1; |
| 1137 | } |
| 1138 | |
| 1139 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "game report saved as \"{}\"", realname); |
| 1140 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(realname); |
| 1141 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(tempname); |
| 1142 | return 0; |
| 1143 | } |
| 1144 | |
| 1145 | |
| 1146 | extern unsigned int game_get_idcxx . . $ pvpgn/bnetd/game_get_id(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1147 | { |
| 1148 | if (!game) |
| 1149 | { |
| 1150 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1151 | return 0; |
| 1152 | } |
| 1153 | return game->idcxx . . $ pvpgn/bnetd/game#id.; |
| 1154 | } |
| 1155 | |
| 1156 | |
| 1157 | extern char const * game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1158 | { |
| 1159 | if (!game) |
| 1160 | { |
| 1161 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1162 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1163 | } |
| 1164 | return game->namecxx . . $ pvpgn/bnetd/game#name. ? game->namecxx . . $ pvpgn/bnetd/game#name. : "BNet"; |
| 1165 | } |
| 1166 | |
| 1167 | |
| 1168 | extern t_game_typecxx . . $ pvpgn/bnetd/t_game_type# game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1169 | { |
| 1170 | if (!game) |
| 1171 | { |
| 1172 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1173 | return game_type_nonecxx . . $ pvpgn/bnetd/game_type_none.; |
| 1174 | } |
| 1175 | return game->typecxx . . $ pvpgn/bnetd/game#type.; |
| 1176 | } |
| 1177 | |
| 1178 | |
| 1179 | extern t_game_maptypecxx . . $ pvpgn/bnetd/t_game_maptype# game_get_maptypecxx . . $ pvpgn/bnetd/game_get_maptype(8b14781ac714f1ed).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1180 | { |
| 1181 | if (!game) |
| 1182 | { |
| 1183 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1184 | return game_maptype_nonecxx . . $ pvpgn/bnetd/game_maptype_none.; |
| 1185 | } |
| 1186 | return game->maptypecxx . . $ pvpgn/bnetd/game#maptype.; |
| 1187 | } |
| 1188 | |
| 1189 | |
| 1190 | extern int game_set_maptypecxx . . $ pvpgn/bnetd/game_set_maptype(86556e9d61246f35).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_game_maptypecxx . . $ pvpgn/bnetd/t_game_maptype# maptype) |
| 1191 | { |
| 1192 | if (!game) |
| 1193 | { |
| 1194 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1195 | return -1; |
| 1196 | } |
| 1197 | game->maptypecxx . . $ pvpgn/bnetd/game#maptype. = maptype; |
| 1198 | return 0; |
| 1199 | } |
| 1200 | |
| 1201 | |
| 1202 | extern t_game_tilesetcxx . . $ pvpgn/bnetd/t_game_tileset# game_get_tilesetcxx . . $ pvpgn/bnetd/game_get_tileset(7bb4e32b969fbea2).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1203 | { |
| 1204 | if (!game) |
| 1205 | { |
| 1206 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1207 | return game_tileset_nonecxx . . $ pvpgn/bnetd/game_tileset_none.; |
| 1208 | } |
| 1209 | return game->tilesetcxx . . $ pvpgn/bnetd/game#tileset.; |
| 1210 | } |
| 1211 | |
| 1212 | |
| 1213 | extern int game_set_tilesetcxx . . $ pvpgn/bnetd/game_set_tileset(1f827d4ca92e1d0a).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_game_tilesetcxx . . $ pvpgn/bnetd/t_game_tileset# tileset) |
| 1214 | { |
| 1215 | if (!game) |
| 1216 | { |
| 1217 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1218 | return -1; |
| 1219 | } |
| 1220 | game->tilesetcxx . . $ pvpgn/bnetd/game#tileset. = tileset; |
| 1221 | return 0; |
| 1222 | } |
| 1223 | |
| 1224 | |
| 1225 | extern t_game_speedcxx . . $ pvpgn/bnetd/t_game_speed# game_get_speedcxx . . $ pvpgn/bnetd/game_get_speed(a65d0a6992b2b41).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1226 | { |
| 1227 | if (!game) |
| 1228 | { |
| 1229 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1230 | return game_speed_nonecxx . . $ pvpgn/bnetd/game_speed_none.; |
| 1231 | } |
| 1232 | return game->speedcxx . . $ pvpgn/bnetd/game#speed.; |
| 1233 | } |
| 1234 | |
| 1235 | |
| 1236 | extern int game_set_speedcxx . . $ pvpgn/bnetd/game_set_speed(44398f37e1e67e30).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_game_speedcxx . . $ pvpgn/bnetd/t_game_speed# speed) |
| 1237 | { |
| 1238 | if (!game) |
| 1239 | { |
| 1240 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1241 | return -1; |
| 1242 | } |
| 1243 | game->speedcxx . . $ pvpgn/bnetd/game#speed. = speed; |
| 1244 | return 0; |
| 1245 | } |
| 1246 | |
| 1247 | |
| 1248 | extern unsigned int game_get_mapsize_xcxx . . $ pvpgn/bnetd/game_get_mapsize_x(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1249 | { |
| 1250 | if (!game) |
| 1251 | { |
| 1252 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1253 | return 0; |
| 1254 | } |
| 1255 | return game->mapsize_xcxx . . $ pvpgn/bnetd/game#mapsize_x.; |
| 1256 | } |
| 1257 | |
| 1258 | |
| 1259 | extern int game_set_mapsize_xcxx . . $ pvpgn/bnetd/game_set_mapsize_x(9a59f4516a0d09ce).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, unsigned int x) |
| 1260 | { |
| 1261 | if (!game) |
| 1262 | { |
| 1263 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1264 | return -1; |
| 1265 | } |
| 1266 | game->mapsize_xcxx . . $ pvpgn/bnetd/game#mapsize_x. = x; |
| 1267 | return 0; |
| 1268 | } |
| 1269 | |
| 1270 | |
| 1271 | extern unsigned int game_get_mapsize_ycxx . . $ pvpgn/bnetd/game_get_mapsize_y(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1272 | { |
| 1273 | if (!game) |
| 1274 | { |
| 1275 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1276 | return 0; |
| 1277 | } |
| 1278 | return game->mapsize_ycxx . . $ pvpgn/bnetd/game#mapsize_y.; |
| 1279 | } |
| 1280 | |
| 1281 | |
| 1282 | extern int game_set_mapsize_ycxx . . $ pvpgn/bnetd/game_set_mapsize_y(9a59f4516a0d09ce).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, unsigned int y) |
| 1283 | { |
| 1284 | if (!game) |
| 1285 | { |
| 1286 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1287 | return -1; |
| 1288 | } |
| 1289 | game->mapsize_ycxx . . $ pvpgn/bnetd/game#mapsize_y. = y; |
| 1290 | return 0; |
| 1291 | } |
| 1292 | |
| 1293 | |
| 1294 | extern unsigned int game_get_maxplayerscxx . . $ pvpgn/bnetd/game_get_maxplayers(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1295 | { |
| 1296 | if (!game) |
| 1297 | { |
| 1298 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1299 | return 0; |
| 1300 | } |
| 1301 | return game->maxplayerscxx . . $ pvpgn/bnetd/game#maxplayers.; |
| 1302 | } |
| 1303 | |
| 1304 | |
| 1305 | extern int game_set_maxplayerscxx . . $ pvpgn/bnetd/game_set_maxplayers(9a59f4516a0d09ce).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, unsigned int maxplayers) |
| 1306 | { |
| 1307 | if (!game) |
| 1308 | { |
| 1309 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1310 | return -1; |
| 1311 | } |
| 1312 | game->maxplayerscxx . . $ pvpgn/bnetd/game#maxplayers. = maxplayers; |
| 1313 | return 0; |
| 1314 | } |
| 1315 | |
| 1316 | |
| 1317 | extern unsigned int game_get_difficultycxx . . $ pvpgn/bnetd/game_get_difficulty(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1318 | { |
| 1319 | if (!game) |
| 1320 | { |
| 1321 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1322 | return 0; |
| 1323 | } |
| 1324 | return game->difficultycxx . . $ pvpgn/bnetd/game#difficulty.; |
| 1325 | } |
| 1326 | |
| 1327 | |
| 1328 | extern int game_set_difficultycxx . . $ pvpgn/bnetd/game_set_difficulty(9a59f4516a0d09ce).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, unsigned int difficulty) |
| 1329 | { |
| 1330 | if (!game) |
| 1331 | { |
| 1332 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1333 | return -1; |
| 1334 | } |
| 1335 | game->difficultycxx . . $ pvpgn/bnetd/game#difficulty. = difficulty; |
| 1336 | return 0; |
| 1337 | } |
| 1338 | |
| 1339 | |
| 1340 | extern char const * game_get_descriptioncxx . . $ pvpgn/bnetd/game_get_description(743fb6d1aa411c4e).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1341 | { |
| 1342 | if (!game) |
| 1343 | { |
| 1344 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1345 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1346 | } |
| 1347 | return game->descriptioncxx . . $ pvpgn/bnetd/game#description.; |
| 1348 | } |
| 1349 | |
| 1350 | |
| 1351 | extern int game_set_descriptioncxx . . $ pvpgn/bnetd/game_set_description(bfbe5c8efad5152b).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, char const * description) |
| 1352 | { |
| 1353 | if (!game) |
| 1354 | { |
| 1355 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1356 | return -1; |
| 1357 | } |
| 1358 | if (!description) |
| 1359 | { |
| 1360 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL description"); |
| 1361 | return -1; |
| 1362 | } |
| 1363 | |
| 1364 | if (game->descriptioncxx . . $ pvpgn/bnetd/game#description. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->description); |
| 1365 | game->descriptioncxx . . $ pvpgn/bnetd/game#description. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(description); |
| 1366 | |
| 1367 | return 0; |
| 1368 | } |
| 1369 | |
| 1370 | |
| 1371 | extern char const * game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1372 | { |
| 1373 | if (!game) |
| 1374 | { |
| 1375 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1376 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1377 | } |
| 1378 | return game->passcxx . . $ pvpgn/bnetd/game#pass.; |
| 1379 | } |
| 1380 | |
| 1381 | |
| 1382 | extern char const * game_get_infocxx . . $ pvpgn/bnetd/game_get_info(743fb6d1aa411c4e).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1383 | { |
| 1384 | if (!game) |
| 1385 | { |
| 1386 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1387 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1388 | } |
| 1389 | return game->infocxx . . $ pvpgn/bnetd/game#info.; |
| 1390 | } |
| 1391 | |
| 1392 | |
| 1393 | extern int game_get_startvercxx . . $ pvpgn/bnetd/game_get_startver(c7bb0711c87bd298).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1394 | { |
| 1395 | if (!game) |
| 1396 | { |
| 1397 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1398 | return 0; |
| 1399 | } |
| 1400 | return game->startvercxx . . $ pvpgn/bnetd/game#startver.; |
| 1401 | } |
| 1402 | |
| 1403 | |
| 1404 | extern unsigned long game_get_versioncxx . . $ pvpgn/bnetd/game_get_version(c15ff7a60fe5ed41).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1405 | { |
| 1406 | if (!game) |
| 1407 | { |
| 1408 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1409 | return 0; |
| 1410 | } |
| 1411 | return game->versioncxx . . $ pvpgn/bnetd/game#version.; |
| 1412 | } |
| 1413 | |
| 1414 | |
| 1415 | extern unsigned int game_get_refcxx . . $ pvpgn/bnetd/game_get_ref(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1416 | { |
| 1417 | if (!game) |
| 1418 | { |
| 1419 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1420 | return 0; |
| 1421 | } |
| 1422 | return game->refcxx . . $ pvpgn/bnetd/game#ref.; |
| 1423 | } |
| 1424 | |
| 1425 | |
| 1426 | extern unsigned int game_get_countcxx . . $ pvpgn/bnetd/game_get_count(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1427 | { |
| 1428 | if (!game) |
| 1429 | { |
| 1430 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1431 | return 0; |
| 1432 | } |
| 1433 | return game->countcxx . . $ pvpgn/bnetd/game#count.; |
| 1434 | } |
| 1435 | |
| 1436 | |
| 1437 | extern void game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_game_statuscxx . . $ pvpgn/bnetd/t_game_status# status) |
| 1438 | { |
| 1439 | if (!game) { |
| 1440 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1441 | return; |
| 1442 | } |
| 1443 | // [quetzal] 20020829 - this should prevent invalid status changes |
| 1444 | // its like started game cant become open and so on |
| 1445 | if (game->statuscxx . . $ pvpgn/bnetd/game#status. == game_status_startedcxx . . $ pvpgn/bnetd/game_status_started. && |
| 1446 | (status == game_status_opencxx . . $ pvpgn/bnetd/game_status_open. || status == game_status_fullcxx . . $ pvpgn/bnetd/game_status_full. || status == game_status_loadedcxx . . $ pvpgn/bnetd/game_status_loaded.)) { |
| 1447 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., "game_set_status", |
| 1448 | "attempting to set status '{}' ({}) to started game", game_status_get_strcxx . . $ pvpgn/bnetd/game_status_get_str(919d871ac64ee540).(status), status); |
| 1449 | return; |
| 1450 | } |
| 1451 | |
| 1452 | if (game->statuscxx . . $ pvpgn/bnetd/game#status. == game_status_donecxx . . $ pvpgn/bnetd/game_status_done. && status != game_status_donecxx . . $ pvpgn/bnetd/game_status_done.) { |
| 1453 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., "game_set_status", |
| 1454 | "attempting to set status '{}' ({}) to done game", game_status_get_strcxx . . $ pvpgn/bnetd/game_status_get_str(919d871ac64ee540).(status), status); |
| 1455 | return; |
| 1456 | } |
| 1457 | |
| 1458 | if (status == game_status_startedcxx . . $ pvpgn/bnetd/game_status_started. && game->start_timecxx . . $ pvpgn/bnetd/game#start_time. == (stdcxx . . $ std/::time_tcxx . . $ std/time_t#)0) |
| 1459 | game->start_timecxx . . $ pvpgn/bnetd/game#start_time. = nowcxx . . $ pvpgn/bnetd/now.; |
| 1460 | game->statuscxx . . $ pvpgn/bnetd/game#status. = status; |
| 1461 | |
| 1462 | #ifdef WITH_LUA |
| 1463 | lua_handle_game(game, NULL, luaevent_game_changestatus); |
| 1464 | #endif |
| 1465 | } |
| 1466 | |
| 1467 | |
| 1468 | extern t_game_statuscxx . . $ pvpgn/bnetd/t_game_status# game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1469 | { |
| 1470 | if (!game) |
| 1471 | { |
| 1472 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1473 | return game_status_startedcxx . . $ pvpgn/bnetd/game_status_started.; |
| 1474 | } |
| 1475 | return game->statuscxx . . $ pvpgn/bnetd/game#status.; |
| 1476 | } |
| 1477 | |
| 1478 | |
| 1479 | extern unsigned int game_get_addrcxx . . $ pvpgn/bnetd/game_get_addr(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1480 | { |
| 1481 | if (!game) |
| 1482 | { |
| 1483 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1484 | return 0; |
| 1485 | } |
| 1486 | |
| 1487 | return game->addrcxx . . $ pvpgn/bnetd/game#addr.; /* host byte order */ |
| 1488 | } |
| 1489 | |
| 1490 | |
| 1491 | extern unsigned short game_get_portcxx . . $ pvpgn/bnetd/game_get_port(5675c6bb4f2bafa6).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1492 | { |
| 1493 | if (!game) |
| 1494 | { |
| 1495 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1496 | return 0; |
| 1497 | } |
| 1498 | |
| 1499 | return game->portcxx . . $ pvpgn/bnetd/game#port.; /* host byte order */ |
| 1500 | } |
| 1501 | |
| 1502 | |
| 1503 | extern unsigned int game_get_latencycxx . . $ pvpgn/bnetd/game_get_latency(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1504 | { |
| 1505 | if (!game) |
| 1506 | { |
| 1507 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1508 | return 0; |
| 1509 | } |
| 1510 | if (game->refcxx . . $ pvpgn/bnetd/game#ref. < 1) |
| 1511 | { |
| 1512 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game \"{}\" has no players", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game)); |
| 1513 | return 0; |
| 1514 | } |
| 1515 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 1516 | { |
| 1517 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game \"{}\" has NULL players array (ref={})", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->refcxx . . $ pvpgn/bnetd/game#ref.); |
| 1518 | return 0; |
| 1519 | } |
| 1520 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.[0]) |
| 1521 | { |
| 1522 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game \"{}\" has NULL players[0] entry (ref={})", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->refcxx . . $ pvpgn/bnetd/game#ref.); |
| 1523 | return 0; |
| 1524 | } |
| 1525 | |
| 1526 | return 0; /* conn_get_latency(game->players[0]); */ |
| 1527 | } |
| 1528 | |
| 1529 | extern t_connection * game_get_player_conncxx . . $ pvpgn/bnetd/game_get_player_conn(da5fb43dd1d11f74).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game, unsigned int i) |
| 1530 | { |
| 1531 | if (!game) |
| 1532 | { |
| 1533 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1534 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1535 | } |
| 1536 | if (game->refcxx . . $ pvpgn/bnetd/game#ref. < 1) |
| 1537 | { |
| 1538 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game \"{}\" has no players", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game)); |
| 1539 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1540 | } |
| 1541 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 1542 | { |
| 1543 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game \"{}\" has NULL player array (ref={})", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->refcxx . . $ pvpgn/bnetd/game#ref.); |
| 1544 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1545 | } |
| 1546 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.[i]) |
| 1547 | { |
| 1548 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "game \"{}\" has NULL players[i] entry (ref={})", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->refcxx . . $ pvpgn/bnetd/game#ref.); |
| 1549 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1550 | } |
| 1551 | return game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i]; |
| 1552 | } |
| 1553 | |
| 1554 | extern t_clienttagcxx . . $ pvpgn/t_clienttag# game_get_clienttagcxx . . $ pvpgn/bnetd/game_get_clienttag(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 1555 | { |
| 1556 | if (!game) |
| 1557 | { |
| 1558 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1559 | return 0; |
| 1560 | } |
| 1561 | return game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.; |
| 1562 | } |
| 1563 | |
| 1564 | |
| 1565 | extern int game_add_playercxx . . $ pvpgn/bnetd/game_add_player(e78f07273e1755ea).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, char const * pass, int startver, t_connection * c) |
| 1566 | { |
| 1567 | t_connection * * tempc; |
| 1568 | t_accountcxx . . $ pvpgn/bnetd/t_account# * * tempp; |
| 1569 | t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# * tempr; |
| 1570 | t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# ** temprr; |
| 1571 | char const * * temprh; |
| 1572 | char const * * temprb; |
| 1573 | unsigned int i = 0; |
| 1574 | |
| 1575 | if (!game) |
| 1576 | { |
| 1577 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1578 | return -1; |
| 1579 | } |
| 1580 | if (!pass) |
| 1581 | { |
| 1582 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL password"); |
| 1583 | return -1; |
| 1584 | } |
| 1585 | if (startver != STARTVER_UNKNOWNcxx . . $ `src/bnetd/game.h:251:9`! && startver != STARTVER_GW1cxx . . $ `src/bnetd/game.h:252:9`! && startver != STARTVER_GW3cxx . . $ `src/bnetd/game.h:253:9`! && startver != STARTVER_GW4cxx . . $ `src/bnetd/game.h:254:9`! && startver != STARTVER_REALM1cxx . . $ `src/bnetd/game.h:255:9`!) |
| 1586 | { |
| 1587 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad game startver {}", startver); |
| 1588 | return -1; |
| 1589 | } |
| 1590 | if (!c) |
| 1591 | { |
| 1592 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 1593 | return -1; |
| 1594 | } |
| 1595 | if (game->typecxx . . $ pvpgn/bnetd/game#type. == game_type_laddercxx . . $ pvpgn/bnetd/game_type_ladder. && (account_get_normal_winscxx . . $ pvpgn/bnetd/account_get_normal_wins(93d29eefa17aed6d).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c)) < 10 && conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(c) == 0)) |
| 1596 | /* if () ... */ |
| 1597 | { |
| 1598 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "can not join ladder game without 10 normal wins"); |
| 1599 | return -1; |
| 1600 | } |
| 1601 | |
| 1602 | { |
| 1603 | t_clienttagcxx . . $ pvpgn/t_clienttag# gt; |
| 1604 | |
| 1605 | if (!(gt = game_get_clienttagcxx . . $ pvpgn/bnetd/game_get_clienttag(d7b85b5cd2056731).(game))) |
| 1606 | { |
| 1607 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not get clienttag for game"); |
| 1608 | return -1; |
| 1609 | } |
| 1610 | } |
| 1611 | |
| 1612 | if (game->passcxx . . $ pvpgn/bnetd/game#pass.[0] != '\0' && strcasecmp(game->passcxx . . $ pvpgn/bnetd/game#pass., pass) != 0) |
| 1613 | { |
| 1614 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "game \"{}\" password mismatch \"{}\"!=\"{}\"", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->passcxx . . $ pvpgn/bnetd/game#pass., pass); |
| 1615 | return -1; |
| 1616 | } |
| 1617 | |
| 1618 | if (game->connectionscxx . . $ pvpgn/bnetd/game#connections. && (game->countcxx . . $ pvpgn/bnetd/game#count. > 0)) |
| 1619 | { |
| 1620 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 1621 | { |
| 1622 | if (game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1623 | { |
| 1624 | game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i] = c; |
| 1625 | game->playerscxx . . $ pvpgn/bnetd/game#players.[i] = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c); |
| 1626 | game->resultscxx . . $ pvpgn/bnetd/game#results.[i] = game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.; |
| 1627 | game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1628 | game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1629 | game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1630 | |
| 1631 | game->refcxx . . $ pvpgn/bnetd/game#ref.++; |
| 1632 | game->lastaccess_timecxx . . $ pvpgn/bnetd/game#lastaccess_time. = nowcxx . . $ pvpgn/bnetd/now.; |
| 1633 | break; |
| 1634 | } |
| 1635 | } |
| 1636 | |
| 1637 | } |
| 1638 | |
| 1639 | // first player will be added here |
| 1640 | if ((i == game->countcxx . . $ pvpgn/bnetd/game#count.) || (game->countcxx . . $ pvpgn/bnetd/game#count. == 0)) |
| 1641 | { |
| 1642 | |
| 1643 | if (!game->connectionscxx . . $ pvpgn/bnetd/game#connections.) /* some std::realloc()s are broken */ |
| 1644 | tempc = (t_connection**)xmalloccxx . . $ `src/common/xalloc.h:43:9`!((game->count + 1)*sizeof(t_connection *)); |
| 1645 | else |
| 1646 | tempc = (t_connection**)xrealloccxx . . $ `src/common/xalloc.h:47:9`!(game->connections, (game->count + 1)*sizeof(t_connection *)); |
| 1647 | game->connectionscxx . . $ pvpgn/bnetd/game#connections. = tempc; |
| 1648 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) /* some std::realloc()s are broken */ |
| 1649 | tempp = (t_accountcxx . . $ pvpgn/bnetd/t_account#**)xmalloccxx . . $ `src/common/xalloc.h:43:9`!((game->count + 1)*sizeof(t_account *)); |
| 1650 | else |
| 1651 | tempp = (t_accountcxx . . $ pvpgn/bnetd/t_account#**)xrealloccxx . . $ `src/common/xalloc.h:47:9`!(game->players, (game->count + 1)*sizeof(t_account *)); |
| 1652 | game->playerscxx . . $ pvpgn/bnetd/game#players. = tempp; |
| 1653 | |
| 1654 | if (!game->resultscxx . . $ pvpgn/bnetd/game#results.) /* some std::realloc()s are broken */ |
| 1655 | tempr = (t_game_resultcxx . . $ pvpgn/bnetd/t_game_result#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!((game->count + 1)*sizeof(t_game_result)); |
| 1656 | else |
| 1657 | tempr = (t_game_resultcxx . . $ pvpgn/bnetd/t_game_result#*)xrealloccxx . . $ `src/common/xalloc.h:47:9`!(game->results, (game->count + 1)*sizeof(t_game_result)); |
| 1658 | game->resultscxx . . $ pvpgn/bnetd/game#results. = tempr; |
| 1659 | |
| 1660 | if (!game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.) |
| 1661 | temprr = (t_game_resultcxx . . $ pvpgn/bnetd/t_game_result#**)xmalloccxx . . $ `src/common/xalloc.h:43:9`!((game->count + 1)*sizeof(t_game_result *)); |
| 1662 | else |
| 1663 | temprr = (t_game_resultcxx . . $ pvpgn/bnetd/t_game_result#**)xrealloccxx . . $ `src/common/xalloc.h:47:9`!(game->reported_results, (game->count + 1)*sizeof(t_game_result *)); |
| 1664 | game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results. = temprr; |
| 1665 | |
| 1666 | if (!game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.) /* some xrealloc()s are broken */ |
| 1667 | temprh = (const char**)xmalloccxx . . $ `src/common/xalloc.h:43:9`!((game->count + 1)*sizeof(char const *)); |
| 1668 | else |
| 1669 | temprh = (const char**)xrealloccxx . . $ `src/common/xalloc.h:47:9`!((void *)game->report_heads, (game->count + 1)*sizeof(char const *)); /* avoid compiler warning */ |
| 1670 | game->report_headscxx . . $ pvpgn/bnetd/game#report_heads. = temprh; |
| 1671 | |
| 1672 | if (!game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.) /* some xrealloc()s are broken */ |
| 1673 | temprb = (const char**)xmalloccxx . . $ `src/common/xalloc.h:43:9`!((game->count + 1)*sizeof(char const *)); |
| 1674 | else |
| 1675 | temprb = (const char**)xrealloccxx . . $ `src/common/xalloc.h:47:9`!((void *)game->report_bodies, (game->count + 1)*sizeof(char const *)); /* avoid compiler warning */ |
| 1676 | game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies. = temprb; |
| 1677 | |
| 1678 | game->connectionscxx . . $ pvpgn/bnetd/game#connections.[game->countcxx . . $ pvpgn/bnetd/game#count.] = c; |
| 1679 | game->playerscxx . . $ pvpgn/bnetd/game#players.[game->countcxx . . $ pvpgn/bnetd/game#count.] = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c); |
| 1680 | game->resultscxx . . $ pvpgn/bnetd/game#results.[game->countcxx . . $ pvpgn/bnetd/game#count.] = game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.; |
| 1681 | game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[game->countcxx . . $ pvpgn/bnetd/game#count.] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1682 | game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[game->countcxx . . $ pvpgn/bnetd/game#count.] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1683 | game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[game->countcxx . . $ pvpgn/bnetd/game#count.] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1684 | |
| 1685 | game->countcxx . . $ pvpgn/bnetd/game#count.++; |
| 1686 | game->refcxx . . $ pvpgn/bnetd/game#ref.++; |
| 1687 | game->lastaccess_timecxx . . $ pvpgn/bnetd/game#lastaccess_time. = nowcxx . . $ pvpgn/bnetd/now.; |
| 1688 | |
| 1689 | } // end of "if ((i == game->count) || (game->count == 0))" |
| 1690 | |
| 1691 | if (game->startvercxx . . $ pvpgn/bnetd/game#startver. != startver && startver != STARTVER_UNKNOWNcxx . . $ `src/bnetd/game.h:251:9`!) /* with join startver ALWAYS unknown [KWS] */ |
| 1692 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player \"{}\" client \"{}\" startver {} joining game startver {} (count={} ref={})", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(conn_get_account(c)), clienttag_uint_to_strcxx . . $ pvpgn/clienttag_uint_to_str(81a3ae90da26a711).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c)), startver, game->startvercxx . . $ pvpgn/bnetd/game#startver., game->countcxx . . $ pvpgn/bnetd/game#count., game->refcxx . . $ pvpgn/bnetd/game#ref.); |
| 1693 | |
| 1694 | game_choose_hostcxx . . $ pvpgn/bnetd/game_choose_host(59d2203d3d741d18).(game); |
| 1695 | |
| 1696 | return 0; |
| 1697 | } |
| 1698 | |
| 1699 | extern int game_del_playercxx . . $ pvpgn/bnetd/game_del_player(28b000dc6317d503).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_connection * c) |
| 1700 | { |
| 1701 | char const * tname; |
| 1702 | unsigned int i; |
| 1703 | t_accountcxx . . $ pvpgn/bnetd/t_account# * account; |
| 1704 | |
| 1705 | if (!game) |
| 1706 | { |
| 1707 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1708 | return -1; |
| 1709 | } |
| 1710 | if (!c) |
| 1711 | { |
| 1712 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 1713 | return -1; |
| 1714 | } |
| 1715 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 1716 | { |
| 1717 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player array is NULL"); |
| 1718 | return -1; |
| 1719 | } |
| 1720 | if (!game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.) |
| 1721 | { |
| 1722 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "reported results array is NULL"); |
| 1723 | return -1; |
| 1724 | } |
| 1725 | account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c); |
| 1726 | |
| 1727 | if (conn_get_leavegamewhisper_ackcxx . . $ pvpgn/bnetd/conn_get_leavegamewhisper_ack(c4dfbc2386fe4fc3).(c) == 0) |
| 1728 | { |
| 1729 | watchlistcxx . . $ pvpgn/bnetd/watchlist.->cxx . . $ pvpgn/scoped_ptr#`operator->`(155dc7f103cdb9db).dispatchcxx . . $ pvpgn/bnetd/WatchComponent#dispatch(5f92e2dc3f12ba14).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), Watchcxx . . $ pvpgn/bnetd/Watch#::ET_leavegamecxx . . $ pvpgn/bnetd/Watch#ET_leavegame.); |
| 1730 | conn_set_leavegamewhisper_ackcxx . . $ pvpgn/bnetd/conn_set_leavegamewhisper_ack(c14bb6458e7562a).(c, 1); //1 = already whispered. We reset this each std::time user joins a channel |
| 1731 | } |
| 1732 | |
| 1733 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "game \"{}\" has ref={}, count={}; trying to remove player \"{}\"", game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->refcxx . . $ pvpgn/bnetd/game#ref., game->countcxx . . $ pvpgn/bnetd/game#count., account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)); |
| 1734 | |
| 1735 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 1736 | if (game->playerscxx . . $ pvpgn/bnetd/game#players.[i] == account && game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i]) |
| 1737 | { |
| 1738 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "removing player #{} \"{}\" from \"{}\", {} players left", i, (tname = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)), game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game->refcxx . . $ pvpgn/bnetd/game#ref. - 1); |
| 1739 | game->connectionscxx . . $ pvpgn/bnetd/game#connections.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1740 | if (!(game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[i])) |
| 1741 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "player \"{}\" left without reporting (valid) results", tname); |
| 1742 | |
| 1743 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "player deleted... (ref={})", game->refcxx . . $ pvpgn/bnetd/game#ref.); |
| 1744 | |
| 1745 | if (game->refcxx . . $ pvpgn/bnetd/game#ref. < 2) |
| 1746 | { |
| 1747 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "no more players, reporting game"); |
| 1748 | game_reportcxx . . $ pvpgn/bnetd/game_report(7ab38d5cc74e6b21).(game); |
| 1749 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "no more players, destroying game"); |
| 1750 | game_destroycxx . . $ pvpgn/bnetd/game_destroy(59d2203d3d741d18).(game); |
| 1751 | return 0; |
| 1752 | } |
| 1753 | |
| 1754 | game->refcxx . . $ pvpgn/bnetd/game#ref.--; |
| 1755 | game->lastaccess_timecxx . . $ pvpgn/bnetd/game#lastaccess_time. = nowcxx . . $ pvpgn/bnetd/now.; |
| 1756 | |
| 1757 | game_choose_hostcxx . . $ pvpgn/bnetd/game_choose_host(59d2203d3d741d18).(game); |
| 1758 | |
| 1759 | #ifdef WITH_LUA |
| 1760 | lua_handle_game(game, c, luaevent_game_userleft); |
| 1761 | #endif |
| 1762 | return 0; |
| 1763 | } |
| 1764 | |
| 1765 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player \"{}\" was not in the game", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)); |
| 1766 | return -1; |
| 1767 | } |
| 1768 | |
| 1769 | extern t_accountcxx . . $ pvpgn/bnetd/t_account# * game_get_playercxx . . $ pvpgn/bnetd/game_get_player(c2a575aa55f70f03).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, unsigned int i) |
| 1770 | { |
| 1771 | if (!game) |
| 1772 | { |
| 1773 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1774 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1775 | } |
| 1776 | |
| 1777 | if (!(i < game->countcxx . . $ pvpgn/bnetd/game#count.)) |
| 1778 | { |
| 1779 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "requested illegal player id {}", i); |
| 1780 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1781 | } |
| 1782 | |
| 1783 | return game->playerscxx . . $ pvpgn/bnetd/game#players.[i]; |
| 1784 | } |
| 1785 | |
| 1786 | extern int game_set_reportcxx . . $ pvpgn/bnetd/game_set_report(656ae8b4ac453ef4).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_accountcxx . . $ pvpgn/bnetd/t_account# * account, char const * rephead, char const * repbody) |
| 1787 | { |
| 1788 | unsigned int pos; |
| 1789 | |
| 1790 | if (!game) |
| 1791 | { |
| 1792 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1793 | return -1; |
| 1794 | } |
| 1795 | if (!account) |
| 1796 | { |
| 1797 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 1798 | return -1; |
| 1799 | } |
| 1800 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 1801 | { |
| 1802 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player array is NULL"); |
| 1803 | return -1; |
| 1804 | } |
| 1805 | if (!game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.) |
| 1806 | { |
| 1807 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "report_heads array is NULL"); |
| 1808 | return -1; |
| 1809 | } |
| 1810 | if (!game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.) |
| 1811 | { |
| 1812 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "report_bodies array is NULL"); |
| 1813 | return -1; |
| 1814 | } |
| 1815 | if (!rephead) |
| 1816 | { |
| 1817 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "report head is NULL"); |
| 1818 | return -1; |
| 1819 | } |
| 1820 | if (!repbody) |
| 1821 | { |
| 1822 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "report body is NULL"); |
| 1823 | return -1; |
| 1824 | } |
| 1825 | |
| 1826 | { |
| 1827 | unsigned int i; |
| 1828 | |
| 1829 | pos = game->countcxx . . $ pvpgn/bnetd/game#count.; |
| 1830 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 1831 | if (game->playerscxx . . $ pvpgn/bnetd/game#players.[i] == account) |
| 1832 | pos = i; |
| 1833 | } |
| 1834 | if (pos == game->countcxx . . $ pvpgn/bnetd/game#count.) |
| 1835 | { |
| 1836 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not find player \"{}\" to set result", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)); |
| 1837 | return -1; |
| 1838 | } |
| 1839 | |
| 1840 | game->report_headscxx . . $ pvpgn/bnetd/game#report_heads.[pos] = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(rephead); |
| 1841 | game->report_bodiescxx . . $ pvpgn/bnetd/game#report_bodies.[pos] = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(repbody); |
| 1842 | |
| 1843 | return 0; |
| 1844 | } |
| 1845 | |
| 1846 | extern int game_set_reported_resultscxx . . $ pvpgn/bnetd/game_set_reported_results(144eebf375f9509c).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_accountcxx . . $ pvpgn/bnetd/t_account# * account, t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# * results) |
| 1847 | { |
| 1848 | unsigned int i, j; |
| 1849 | t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# result; |
| 1850 | |
| 1851 | if (!game) |
| 1852 | { |
| 1853 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1854 | return -1; |
| 1855 | } |
| 1856 | |
| 1857 | if (!account) |
| 1858 | { |
| 1859 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 1860 | return -1; |
| 1861 | } |
| 1862 | |
| 1863 | if (!results) |
| 1864 | { |
| 1865 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL results"); |
| 1866 | return -1; |
| 1867 | } |
| 1868 | |
| 1869 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 1870 | { |
| 1871 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player array is NULL"); |
| 1872 | return -1; |
| 1873 | } |
| 1874 | |
| 1875 | if (!game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.) |
| 1876 | { |
| 1877 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "reported_results array is NULL"); |
| 1878 | return -1; |
| 1879 | } |
| 1880 | |
| 1881 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 1882 | { |
| 1883 | if ((game->playerscxx . . $ pvpgn/bnetd/game#players.[i] == account)) break; |
| 1884 | } |
| 1885 | |
| 1886 | if (i == game->countcxx . . $ pvpgn/bnetd/game#count.) |
| 1887 | { |
| 1888 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not find player \"{}\" to set reported results", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)); |
| 1889 | return -1; |
| 1890 | } |
| 1891 | |
| 1892 | if (game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[i]) |
| 1893 | { |
| 1894 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player \"{}\" already reported results - skipping this report", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)); |
| 1895 | return -1; |
| 1896 | } |
| 1897 | |
| 1898 | for (j = 0; j < game->countcxx . . $ pvpgn/bnetd/game#count.; j++) |
| 1899 | { |
| 1900 | result = results[j]; |
| 1901 | switch (result) |
| 1902 | { |
| 1903 | case game_result_wincxx . . $ pvpgn/bnetd/game_result_win.: |
| 1904 | case game_result_losscxx . . $ pvpgn/bnetd/game_result_loss.: |
| 1905 | case game_result_drawcxx . . $ pvpgn/bnetd/game_result_draw.: |
| 1906 | case game_result_observercxx . . $ pvpgn/bnetd/game_result_observer.: |
| 1907 | case game_result_disconnectcxx . . $ pvpgn/bnetd/game_result_disconnect.: |
| 1908 | break; |
| 1909 | case game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.: |
| 1910 | case game_result_playingcxx . . $ pvpgn/bnetd/game_result_playing.: |
| 1911 | if (i != j) break; /* accept none/playing only from "others" */ |
| 1912 | default: /* result is invalid */ |
| 1913 | if (i != j) |
| 1914 | { |
| 1915 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "ignoring bad reported result {} for player \"{}\"", (unsigned int)result, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(game->players[j])); |
| 1916 | results[i] = game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.; |
| 1917 | } |
| 1918 | else { |
| 1919 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad reported result {} for self - skipping results", (unsigned int)result); |
| 1920 | return -1; |
| 1921 | } |
| 1922 | } |
| 1923 | } |
| 1924 | |
| 1925 | game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[i] = results; |
| 1926 | |
| 1927 | return 0; |
| 1928 | } |
| 1929 | |
| 1930 | |
| 1931 | extern int game_set_self_reportcxx . . $ pvpgn/bnetd/game_set_self_report(6888f7d335a1cb84).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_accountcxx . . $ pvpgn/bnetd/t_account# * account, t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# result) |
| 1932 | { |
| 1933 | unsigned int i; |
| 1934 | t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# * results; |
| 1935 | |
| 1936 | if (!game) |
| 1937 | { |
| 1938 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1939 | return -1; |
| 1940 | } |
| 1941 | |
| 1942 | if (!account) |
| 1943 | { |
| 1944 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 1945 | return -1; |
| 1946 | } |
| 1947 | |
| 1948 | if (!game->playerscxx . . $ pvpgn/bnetd/game#players.) |
| 1949 | { |
| 1950 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player array is NULL"); |
| 1951 | return -1; |
| 1952 | } |
| 1953 | |
| 1954 | if (!game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.) |
| 1955 | { |
| 1956 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "reported_results array is NULL"); |
| 1957 | return -1; |
| 1958 | } |
| 1959 | |
| 1960 | results = (t_game_resultcxx . . $ pvpgn/bnetd/t_game_result#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_game_result)*game->count); |
| 1961 | |
| 1962 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 1963 | { |
| 1964 | if ((game->playerscxx . . $ pvpgn/bnetd/game#players.[i] == account)) |
| 1965 | results[i] = result; |
| 1966 | else |
| 1967 | results[i] = game_result_nonecxx . . $ pvpgn/bnetd/game_result_none.; |
| 1968 | } |
| 1969 | |
| 1970 | game_set_reported_resultscxx . . $ pvpgn/bnetd/game_set_reported_results(144eebf375f9509c).(game, account, results); |
| 1971 | |
| 1972 | return 0; |
| 1973 | } |
| 1974 | |
| 1975 | extern t_game_resultcxx . . $ pvpgn/bnetd/t_game_result# * game_get_reported_resultscxx . . $ pvpgn/bnetd/game_get_reported_results(8f31a0f2fafd1702).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 1976 | { |
| 1977 | unsigned int i; |
| 1978 | |
| 1979 | if (!(game)) |
| 1980 | { |
| 1981 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 1982 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1983 | } |
| 1984 | |
| 1985 | if (!(account)) |
| 1986 | { |
| 1987 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 1988 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1989 | } |
| 1990 | |
| 1991 | if (!(game->playerscxx . . $ pvpgn/bnetd/game#players.)) |
| 1992 | { |
| 1993 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player array is NULL"); |
| 1994 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1995 | } |
| 1996 | |
| 1997 | if (!(game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.)) |
| 1998 | { |
| 1999 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "reported_results array is NULL"); |
| 2000 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2001 | } |
| 2002 | |
| 2003 | for (i = 0; i < game->countcxx . . $ pvpgn/bnetd/game#count.; i++) |
| 2004 | { |
| 2005 | if ((game->playerscxx . . $ pvpgn/bnetd/game#players.[i] == account)) break; |
| 2006 | } |
| 2007 | |
| 2008 | if (i == game->countcxx . . $ pvpgn/bnetd/game#count.) |
| 2009 | { |
| 2010 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not find player \"{}\" to set reported results", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)); |
| 2011 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2012 | } |
| 2013 | |
| 2014 | if (!(game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[i])) |
| 2015 | { |
| 2016 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "player \"{}\" has not reported any results", account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)); |
| 2017 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2018 | } |
| 2019 | |
| 2020 | return game->reported_resultscxx . . $ pvpgn/bnetd/game#reported_results.[i]; |
| 2021 | } |
| 2022 | |
| 2023 | |
| 2024 | extern char const * game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2025 | { |
| 2026 | if (!game) |
| 2027 | { |
| 2028 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2029 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2030 | } |
| 2031 | |
| 2032 | return game->mapnamecxx . . $ pvpgn/bnetd/game#mapname.; |
| 2033 | } |
| 2034 | |
| 2035 | |
| 2036 | extern int game_set_mapnamecxx . . $ pvpgn/bnetd/game_set_mapname(bfbe5c8efad5152b).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, char const * mapname) |
| 2037 | { |
| 2038 | if (!game) |
| 2039 | { |
| 2040 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2041 | return -1; |
| 2042 | } |
| 2043 | if (!mapname) |
| 2044 | { |
| 2045 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL mapname"); |
| 2046 | return -1; |
| 2047 | } |
| 2048 | |
| 2049 | if (game->mapnamecxx . . $ pvpgn/bnetd/game#mapname. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->mapname); |
| 2050 | |
| 2051 | game->mapnamecxx . . $ pvpgn/bnetd/game#mapname. = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(mapname); |
| 2052 | |
| 2053 | return 0; |
| 2054 | } |
| 2055 | |
| 2056 | |
| 2057 | extern t_connection * game_get_ownercxx . . $ pvpgn/bnetd/game_get_owner(44263c0cd290cfb5).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2058 | { |
| 2059 | if (!game) |
| 2060 | { |
| 2061 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2062 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2063 | } |
| 2064 | return game->ownercxx . . $ pvpgn/bnetd/game#owner.; |
| 2065 | } |
| 2066 | |
| 2067 | |
| 2068 | extern stdcxx . . $ std/::time_tcxx . . $ std/time_t# game_get_create_timecxx . . $ pvpgn/bnetd/game_get_create_time(57cecc7178e653af).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2069 | { |
| 2070 | if (!game) |
| 2071 | { |
| 2072 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2073 | return (stdcxx . . $ std/::time_tcxx . . $ std/time_t#)0; |
| 2074 | } |
| 2075 | |
| 2076 | return game->create_timecxx . . $ pvpgn/bnetd/game#create_time.; |
| 2077 | } |
| 2078 | |
| 2079 | |
| 2080 | extern stdcxx . . $ std/::time_tcxx . . $ std/time_t# game_get_start_timecxx . . $ pvpgn/bnetd/game_get_start_time(57cecc7178e653af).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2081 | { |
| 2082 | if (!game) |
| 2083 | { |
| 2084 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2085 | return (stdcxx . . $ std/::time_tcxx . . $ std/time_t#)0; |
| 2086 | } |
| 2087 | |
| 2088 | return game->start_timecxx . . $ pvpgn/bnetd/game#start_time.; |
| 2089 | } |
| 2090 | |
| 2091 | |
| 2092 | extern int game_set_optioncxx . . $ pvpgn/bnetd/game_set_option(ab46a331a84c7de1).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_game_optioncxx . . $ pvpgn/bnetd/t_game_option# option) |
| 2093 | { |
| 2094 | if (!game) |
| 2095 | { |
| 2096 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2097 | return -1; |
| 2098 | } |
| 2099 | |
| 2100 | game->optioncxx . . $ pvpgn/bnetd/game#option. = option; |
| 2101 | return 0; |
| 2102 | } |
| 2103 | |
| 2104 | |
| 2105 | extern t_game_optioncxx . . $ pvpgn/bnetd/t_game_option# game_get_optioncxx . . $ pvpgn/bnetd/game_get_option(2988101d1799294b).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2106 | { |
| 2107 | if (!game) |
| 2108 | { |
| 2109 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2110 | return game_option_nonecxx . . $ pvpgn/bnetd/game_option_none.; |
| 2111 | } |
| 2112 | |
| 2113 | return game->optioncxx . . $ pvpgn/bnetd/game#option.; |
| 2114 | } |
| 2115 | |
| 2116 | |
| 2117 | extern int gamelist_createcxx . . $ pvpgn/bnetd/gamelist_create(b126dc7c1de90089).(void) |
| 2118 | { |
| 2119 | elist_initcxx . . $ `src/common/elist.h:193:9`!(&gamelist_head); |
| 2120 | glist_lengthcxx . . $ pvpgn/bnetd/glist_length. = 0; |
| 2121 | return 0; |
| 2122 | } |
| 2123 | |
| 2124 | |
| 2125 | extern int gamelist_destroycxx . . $ pvpgn/bnetd/gamelist_destroy(b126dc7c1de90089).(void) |
| 2126 | { |
| 2127 | /* FIXME: if called with active games, games are not freed */ |
| 2128 | elist_initcxx . . $ `src/common/elist.h:193:9`!(&gamelist_head); |
| 2129 | glist_lengthcxx . . $ pvpgn/bnetd/glist_length. = 0; |
| 2130 | |
| 2131 | return 0; |
| 2132 | } |
| 2133 | |
| 2134 | extern t_elistcxx . . $ pvpgn/t_elist# * gamelistcxx . . $ pvpgn/bnetd/gamelist(c54ebe965c4fa87d).(void) |
| 2135 | { |
| 2136 | return &gamelist_headcxx . . $ pvpgn/bnetd/gamelist_head.; |
| 2137 | } |
| 2138 | |
| 2139 | extern int gamelist_get_lengthcxx . . $ pvpgn/bnetd/gamelist_get_length(b126dc7c1de90089).(void) |
| 2140 | { |
| 2141 | return glist_lengthcxx . . $ pvpgn/bnetd/glist_length.; |
| 2142 | } |
| 2143 | |
| 2144 | |
| 2145 | extern t_gamecxx . . $ pvpgn/bnetd/t_game# * gamelist_find_gamecxx . . $ pvpgn/bnetd/gamelist_find_game(e383c2f40f0b546f).(char const * name, t_clienttagcxx . . $ pvpgn/t_clienttag# ctag, t_game_typecxx . . $ pvpgn/bnetd/t_game_type# type) |
| 2146 | { |
| 2147 | t_elistcxx . . $ pvpgn/t_elist# *curr; |
| 2148 | t_gamecxx . . $ pvpgn/bnetd/t_game# *game; |
| 2149 | |
| 2150 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, &gamelist_head) |
| 2151 | { |
| 2152 | game = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_game, glist_link); |
| 2153 | if ((type == game_type_allcxx . . $ pvpgn/bnetd/game_type_all. || game->typecxx . . $ pvpgn/bnetd/game#type. == type) |
| 2154 | && ctag == game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag. |
| 2155 | && game->namecxx . . $ pvpgn/bnetd/game#name. |
| 2156 | && !strcasecmp(name, game->namecxx . . $ pvpgn/bnetd/game#name.)) return game; |
| 2157 | } |
| 2158 | |
| 2159 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2160 | } |
| 2161 | |
| 2162 | |
| 2163 | extern t_gamecxx . . $ pvpgn/bnetd/t_game# * gamelist_find_game_availablecxx . . $ pvpgn/bnetd/gamelist_find_game_available(e383c2f40f0b546f).(char const * name, t_clienttagcxx . . $ pvpgn/t_clienttag# ctag, t_game_typecxx . . $ pvpgn/bnetd/t_game_type# type) |
| 2164 | { |
| 2165 | t_elistcxx . . $ pvpgn/t_elist# *curr; |
| 2166 | t_gamecxx . . $ pvpgn/bnetd/t_game# *game; |
| 2167 | t_game_statuscxx . . $ pvpgn/bnetd/t_game_status# status; |
| 2168 | |
| 2169 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, &gamelist_head) |
| 2170 | { |
| 2171 | game = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_game, glist_link); |
| 2172 | status = game->statuscxx . . $ pvpgn/bnetd/game#status.; |
| 2173 | |
| 2174 | if ((type == game_type_allcxx . . $ pvpgn/bnetd/game_type_all. || game->typecxx . . $ pvpgn/bnetd/game#type. == type) && (ctag == game->clienttagcxx . . $ pvpgn/bnetd/game#clienttag.) && (game->namecxx . . $ pvpgn/bnetd/game#name.) |
| 2175 | && (!strcasecmp(name, game->namecxx . . $ pvpgn/bnetd/game#name.)) && (game->statuscxx . . $ pvpgn/bnetd/game#status. != game_status_startedcxx . . $ pvpgn/bnetd/game_status_started.) && |
| 2176 | (game->statuscxx . . $ pvpgn/bnetd/game#status. != game_status_donecxx . . $ pvpgn/bnetd/game_status_done.)) |
| 2177 | return game; |
| 2178 | } |
| 2179 | |
| 2180 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2181 | } |
| 2182 | |
| 2183 | extern t_gamecxx . . $ pvpgn/bnetd/t_game# * gamelist_find_game_byidcxx . . $ pvpgn/bnetd/gamelist_find_game_byid(8fdfbde43a4a6523).(unsigned int id) |
| 2184 | { |
| 2185 | t_elistcxx . . $ pvpgn/t_elist# *curr; |
| 2186 | t_gamecxx . . $ pvpgn/bnetd/t_game# *game; |
| 2187 | |
| 2188 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, &gamelist_head) |
| 2189 | { |
| 2190 | game = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_game, glist_link); |
| 2191 | if (game->idcxx . . $ pvpgn/bnetd/game#id. == id) |
| 2192 | return game; |
| 2193 | } |
| 2194 | |
| 2195 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2196 | } |
| 2197 | |
| 2198 | |
| 2199 | extern void gamelist_traversecxx . . $ pvpgn/bnetd/gamelist_traverse(c7b2023d64399da8).(t_glist_funccxx . . $ pvpgn/bnetd/t_glist_func# cb, void *data, t_gamelist_source_typecxx . . $ pvpgn/bnetd/t_gamelist_source_type# gamelist_source) |
| 2200 | { |
| 2201 | t_elistcxx . . $ pvpgn/t_elist# *curr; |
| 2202 | |
| 2203 | #ifdef WITH_LUA |
| 2204 | t_game *game; |
| 2205 | |
| 2206 | if (gamelist_source == gamelist_source_joinbutton) |
| 2207 | { |
| 2208 | struct glist_cbdata *cbdata = (struct glist_cbdata*)data; |
| 2209 | // get gamelist from Lua script: pair(gameid=gamename) |
| 2210 | std::vector<t_game*> gamelist = lua_handle_game_list(cbdata->c); |
| 2211 | if (gamelist.size() > 0) |
| 2212 | { |
| 2213 | // display games to a user according to the given order |
| 2214 | for (std::vector<t_game*>::size_type i = 0; i != gamelist.size(); i++) |
| 2215 | { |
| 2216 | if (game = gamelist_find_game_byid(gamelist[i]->id)) |
| 2217 | { |
| 2218 | if (gamelist[i]->name) |
| 2219 | game->name = xstrdup(gamelist[i]->name); // override game name |
| 2220 | cb(game, data); // display game item |
| 2221 | } |
| 2222 | } |
| 2223 | // break next execution (override of display below gamelist) |
| 2224 | return; |
| 2225 | } |
| 2226 | } |
| 2227 | #endif |
| 2228 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, &gamelist_head) |
| 2229 | { |
| 2230 | if (cb(elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_game, glist_link), data) < 0) return; |
| 2231 | } |
| 2232 | } |
| 2233 | |
| 2234 | |
| 2235 | extern int gamelist_total_gamescxx . . $ pvpgn/bnetd/gamelist_total_games(b126dc7c1de90089).(void) |
| 2236 | { |
| 2237 | return totalcountcxx . . $ pvpgn/bnetd/totalcount.; |
| 2238 | } |
| 2239 | |
| 2240 | extern int game_set_realmcxx . . $ pvpgn/bnetd/game_set_realm(9a59f4516a0d09ce).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, unsigned int realm) |
| 2241 | { |
| 2242 | if (!game) |
| 2243 | { |
| 2244 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2245 | return -1; |
| 2246 | } |
| 2247 | game->realmcxx . . $ pvpgn/bnetd/game#realm. = realm; |
| 2248 | return 0; |
| 2249 | } |
| 2250 | |
| 2251 | extern unsigned int game_get_realmcxx . . $ pvpgn/bnetd/game_get_realm(d7b85b5cd2056731).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2252 | { |
| 2253 | if (!game) |
| 2254 | { |
| 2255 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2256 | return 0; |
| 2257 | } |
| 2258 | return game->realmcxx . . $ pvpgn/bnetd/game#realm.; |
| 2259 | } |
| 2260 | |
| 2261 | extern int game_set_realmnamecxx . . $ pvpgn/bnetd/game_set_realmname(bfbe5c8efad5152b).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, char const * realmname) |
| 2262 | { |
| 2263 | char const * temp; |
| 2264 | |
| 2265 | if (!game) |
| 2266 | { |
| 2267 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2268 | return -1; |
| 2269 | } |
| 2270 | |
| 2271 | if (realmname) |
| 2272 | temp = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(realmname); |
| 2273 | else |
| 2274 | temp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2275 | |
| 2276 | if (game->realmnamecxx . . $ pvpgn/bnetd/game#realmname.) |
| 2277 | xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)game->realmname); /* avoid warning */ |
| 2278 | game->realmnamecxx . . $ pvpgn/bnetd/game#realmname. = temp; |
| 2279 | return 0; |
| 2280 | } |
| 2281 | |
| 2282 | extern char const * game_get_realmnamecxx . . $ pvpgn/bnetd/game_get_realmname(743fb6d1aa411c4e).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2283 | { |
| 2284 | if (!game) |
| 2285 | { |
| 2286 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2287 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2288 | } |
| 2289 | return game->realmnamecxx . . $ pvpgn/bnetd/game#realmname.; |
| 2290 | } |
| 2291 | |
| 2292 | |
| 2293 | extern void gamelist_check_voidgamecxx . . $ pvpgn/bnetd/gamelist_check_voidgame(49f6e7a06ebc5aa8).(void) |
| 2294 | { |
| 2295 | t_elistcxx . . $ pvpgn/t_elist# *curr, *save; |
| 2296 | t_gamecxx . . $ pvpgn/bnetd/t_game# *game; |
| 2297 | |
| 2298 | elist_for_each_safecxx . . $ `src/common/elist.h:238:9`!(curr, &gamelist_head, save) |
| 2299 | { |
| 2300 | game = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_game, glist_link); |
| 2301 | if (!game->realmcxx . . $ pvpgn/bnetd/game#realm.) |
| 2302 | continue; |
| 2303 | if (game->refcxx . . $ pvpgn/bnetd/game#ref. >= 1) |
| 2304 | continue; |
| 2305 | if ((nowcxx . . $ pvpgn/bnetd/now. - game->lastaccess_timecxx . . $ pvpgn/bnetd/game#lastaccess_time.) > MAX_GAME_EMPTY_TIMEcxx . . $ `src/bnetd/game.h:250:9`!) |
| 2306 | game_destroycxx . . $ pvpgn/bnetd/game_destroy(59d2203d3d741d18).(game); |
| 2307 | } |
| 2308 | } |
| 2309 | |
| 2310 | extern void game_set_flagcxx . . $ pvpgn/bnetd/game_set_flag(3b1c59db3f21a39f).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_game_flagcxx . . $ pvpgn/bnetd/t_game_flag# flag) |
| 2311 | { |
| 2312 | if (!game) |
| 2313 | { |
| 2314 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2315 | return; |
| 2316 | } |
| 2317 | game->flagcxx . . $ pvpgn/bnetd/game#flag. = flag; |
| 2318 | } |
| 2319 | |
| 2320 | |
| 2321 | extern t_game_flagcxx . . $ pvpgn/bnetd/t_game_flag# game_get_flagcxx . . $ pvpgn/bnetd/game_get_flag(98b2c43fe55f6682).(t_gamecxx . . $ pvpgn/bnetd/t_game# const * game) |
| 2322 | { |
| 2323 | if (!game) |
| 2324 | { |
| 2325 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2326 | return game_flag_nonecxx . . $ pvpgn/bnetd/game_flag_none.; |
| 2327 | } |
| 2328 | return game->flagcxx . . $ pvpgn/bnetd/game#flag.; |
| 2329 | } |
| 2330 | |
| 2331 | extern int game_get_count_by_clienttagcxx . . $ pvpgn/bnetd/game_get_count_by_clienttag(4c679297bf94b9eb).(t_clienttagcxx . . $ pvpgn/t_clienttag# ct) |
| 2332 | { |
| 2333 | t_gamecxx . . $ pvpgn/bnetd/t_game# *game; |
| 2334 | t_elistcxx . . $ pvpgn/t_elist# *curr; |
| 2335 | int clienttaggames = 0; |
| 2336 | |
| 2337 | if (!ct) { |
| 2338 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got UNKNOWN clienttag"); |
| 2339 | return 0; |
| 2340 | } |
| 2341 | |
| 2342 | /* Get number of games for client tag specific */ |
| 2343 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, &gamelist_head) |
| 2344 | { |
| 2345 | game = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_game, glist_link); |
| 2346 | if (game_get_clienttagcxx . . $ pvpgn/bnetd/game_get_clienttag(d7b85b5cd2056731).(game) == ct) |
| 2347 | clienttaggames++; |
| 2348 | } |
| 2349 | |
| 2350 | return clienttaggames; |
| 2351 | } |
| 2352 | |
| 2353 | static int game_match_namecxx . . $ pvpgn/bnetd/game_match_name(5ae29d726ae57f88).(const char *name, const char *prefix) |
| 2354 | { |
| 2355 | /* the easy cases */ |
| 2356 | if (!name || !*name) return 1; |
| 2357 | if (!prefix || !*prefix) return 1; |
| 2358 | |
| 2359 | if (!stdcxx . . $ std/::strncmp(name, prefix, stdcxx . . $ std/::strlen(prefix))) return 1; |
| 2360 | |
| 2361 | return 0; |
| 2362 | } |
| 2363 | |
| 2364 | extern int game_is_laddercxx . . $ pvpgn/bnetd/game_is_ladder(7ab38d5cc74e6b21).(t_gamecxx . . $ pvpgn/bnetd/t_game# *game) |
| 2365 | { |
| 2366 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(game); |
| 2367 | |
| 2368 | /* all normal ladder games are still counted as ladder games */ |
| 2369 | if (game->typecxx . . $ pvpgn/bnetd/game#type. == game_type_laddercxx . . $ pvpgn/bnetd/game_type_ladder. || |
| 2370 | game->typecxx . . $ pvpgn/bnetd/game#type. == game_type_ironmancxx . . $ pvpgn/bnetd/game_type_ironman.) return 1; |
| 2371 | |
| 2372 | /* addition game types are also checked against gamename prefix if set */ |
| 2373 | if (game_match_typecxx . . $ pvpgn/bnetd/game_match_type(f66f3c9caada6691).(game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game), prefs_get_ladder_gamescxx . . $ pvpgn/bnetd/prefs_get_ladder_games(33a1f659e94feb42).()) && |
| 2374 | game_match_namecxx . . $ pvpgn/bnetd/game_match_name(5ae29d726ae57f88).(game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), prefs_get_ladder_prefixcxx . . $ pvpgn/bnetd/prefs_get_ladder_prefix(33a1f659e94feb42).())) return 1; |
| 2375 | |
| 2376 | return 0; |
| 2377 | } |
| 2378 | |
| 2379 | extern int game_discislosscxx . . $ pvpgn/bnetd/game_discisloss(7ab38d5cc74e6b21).(t_gamecxx . . $ pvpgn/bnetd/t_game# *game) |
| 2380 | { |
| 2381 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(game); |
| 2382 | |
| 2383 | if (prefs_get_discislosscxx . . $ pvpgn/bnetd/prefs_get_discisloss(db52760e79bf9054).()) |
| 2384 | return 1; |
| 2385 | |
| 2386 | /* all normal ladder games provide discisloss option themselves */ |
| 2387 | if (game->typecxx . . $ pvpgn/bnetd/game#type. == game_type_laddercxx . . $ pvpgn/bnetd/game_type_ladder. || |
| 2388 | game->typecxx . . $ pvpgn/bnetd/game#type. == game_type_ironmancxx . . $ pvpgn/bnetd/game_type_ironman.) return game->optioncxx . . $ pvpgn/bnetd/game#option. == game_option_ladder_countaslosscxx . . $ pvpgn/bnetd/game_option_ladder_countasloss.; |
| 2389 | |
| 2390 | /* additional game types that are consideres ladder are always considered discasloss */ |
| 2391 | if (game_match_typecxx . . $ pvpgn/bnetd/game_match_type(f66f3c9caada6691).(game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game), prefs_get_ladder_gamescxx . . $ pvpgn/bnetd/prefs_get_ladder_games(33a1f659e94feb42).()) && |
| 2392 | game_match_namecxx . . $ pvpgn/bnetd/game_match_name(5ae29d726ae57f88).(game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), prefs_get_ladder_prefixcxx . . $ pvpgn/bnetd/prefs_get_ladder_prefix(33a1f659e94feb42).())) return 1; |
| 2393 | |
| 2394 | /* all other games are handled as usual */ |
| 2395 | return game->optioncxx . . $ pvpgn/bnetd/game#option. == game_option_ladder_countaslosscxx . . $ pvpgn/bnetd/game_option_ladder_countasloss.; |
| 2396 | } |
| 2397 | |
| 2398 | extern int game_set_channelcxx . . $ pvpgn/bnetd/game_set_channel(d0d97163e3994052).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game, t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel) |
| 2399 | { |
| 2400 | if (!game) { |
| 2401 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2402 | return -1; |
| 2403 | } |
| 2404 | |
| 2405 | if (!channel) { |
| 2406 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL channel"); |
| 2407 | return -1; |
| 2408 | } |
| 2409 | |
| 2410 | game->channelcxx . . $ pvpgn/bnetd/game#channel. = channel; |
| 2411 | return 0; |
| 2412 | } |
| 2413 | |
| 2414 | extern t_channelcxx . . $ pvpgn/bnetd/t_channel# * game_get_channelcxx . . $ pvpgn/bnetd/game_get_channel(7d1a4b3311a97356).(t_gamecxx . . $ pvpgn/bnetd/t_game# * game) |
| 2415 | { |
| 2416 | if (!game) { |
| 2417 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL game"); |
| 2418 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2419 | } |
| 2420 | |
| 2421 | return game->channelcxx . . $ pvpgn/bnetd/game#channel.; |
| 2422 | |
| 2423 | } |
| 2424 | |
| 2425 | } |
| 2426 | |
| 2427 | } |