| 1 | /* |
| 2 | * Copyright (C) 2008,2009 Pelish ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #include "common/setup_before.h" |
| 20 | #include "handle_wol_gameres.h" |
| 21 | |
| 22 | #include <cinttypes> |
| 23 | #include <cstring> |
| 24 | |
| 25 | #include "common/wol_gameres_protocol.h" |
| 26 | #include "common/packet.h" |
| 27 | #include "common/eventlog.h" |
| 28 | #include "common/tag.h" |
| 29 | #include "common/bn_type.h" |
| 30 | |
| 31 | #include "connection.h" |
| 32 | #include "game.h" |
| 33 | #include "account.h" |
| 34 | #ifdef WIN32_GUI |
| 35 | #include <win32/winmain.h> |
| 36 | #endif |
| 37 | #include "common/setup_after.h" |
| 38 | |
| 39 | namespace pvpgn |
| 40 | { |
| 41 | |
| 42 | namespace bnetd |
| 43 | { |
| 44 | |
| 45 | /* handlers prototypes */ |
| 46 | static int _client_sern(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 47 | static int _client_sdfx(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 48 | static int _client_idno(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 49 | static int _client_gsku(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 50 | static int _client_dcon(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 51 | static int _client_lcon(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 52 | static int _client_type(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 53 | static int _client_trny(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 54 | static int _client_oosy(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 55 | static int _client_fini(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 56 | static int _client_dura(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 57 | static int _client_cred(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 58 | static int _client_shrt(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 59 | static int _client_supr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 60 | static int _client_mode(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 61 | static int _client_bamr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 62 | static int _client_crat(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 63 | static int _client_aipl(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 64 | static int _client_unit(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 65 | static int _client_scen(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 66 | static int _client_cmpl(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 67 | static int _client_pngs(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 68 | static int _client_pngr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 69 | static int _client_plrs(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 70 | static int _client_spid(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 71 | static int _client_time(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 72 | static int _client_afps(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 73 | static int _client_proc(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 74 | static int _client_memo(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 75 | static int _client_vidm(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 76 | static int _client_sped(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 77 | static int _client_vers(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 78 | static int _client_date(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 79 | static int _client_base(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 80 | static int _client_tibr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 81 | static int _client_shad(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 82 | static int _client_flag(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 83 | static int _client_tech(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 84 | static int _client_acco(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 85 | static int _client_brok(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 86 | static int _client_etim(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 87 | static int _client_pspd(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 88 | static int _client_smem(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 89 | static int _client_svid(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 90 | static int _client_snam(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 91 | static int _client_gmap(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 92 | static int _client_dsvr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 93 | |
| 94 | /* Renegade Player related functions */ |
| 95 | static int _client_pnam(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 96 | static int _client_ploc(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 97 | static int _client_team(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 98 | static int _client_pscr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 99 | static int _client_ppts(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 100 | static int _client_ptim(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 101 | static int _client_phlt(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 102 | static int _client_pkil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 103 | static int _client_ekil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 104 | static int _client_akil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 105 | static int _client_shot(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 106 | static int _client_hedf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 107 | static int _client_torf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 108 | static int _client_armf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 109 | static int _client_legf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 110 | static int _client_crtf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 111 | static int _client_pups(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 112 | static int _client_vkil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 113 | static int _client_vtim(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 114 | static int _client_nkfv(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 115 | static int _client_squi(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 116 | static int _client_pcrd(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 117 | static int _client_bkil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 118 | static int _client_hedr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 119 | static int _client_torr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 120 | static int _client_armr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 121 | static int _client_legr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 122 | static int _client_crtr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 123 | static int _client_flgc(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 124 | |
| 125 | /* Player related functions */ |
| 126 | static int _client_nam0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 127 | static int _client_nam1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 128 | static int _client_nam2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 129 | static int _client_nam3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 130 | static int _client_nam4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 131 | static int _client_nam5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 132 | static int _client_nam6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 133 | static int _client_nam7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 134 | |
| 135 | static int _client_ipa0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 136 | static int _client_ipa1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 137 | static int _client_ipa2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 138 | static int _client_ipa3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 139 | static int _client_ipa4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 140 | static int _client_ipa5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 141 | static int _client_ipa6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 142 | static int _client_ipa7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 143 | |
| 144 | static int _client_cid0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 145 | static int _client_cid1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 146 | static int _client_cid2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 147 | static int _client_cid3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 148 | static int _client_cid4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 149 | static int _client_cid5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 150 | static int _client_cid6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 151 | static int _client_cid7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 152 | |
| 153 | static int _client_sid0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 154 | static int _client_sid1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 155 | static int _client_sid2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 156 | static int _client_sid3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 157 | static int _client_sid4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 158 | static int _client_sid5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 159 | static int _client_sid6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 160 | static int _client_sid7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 161 | |
| 162 | static int _client_tid0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 163 | static int _client_tid1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 164 | static int _client_tid2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 165 | static int _client_tid3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 166 | static int _client_tid4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 167 | static int _client_tid5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 168 | static int _client_tid6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 169 | static int _client_tid7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 170 | |
| 171 | static int _client_cmp0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 172 | static int _client_cmp1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 173 | static int _client_cmp2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 174 | static int _client_cmp3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 175 | static int _client_cmp4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 176 | static int _client_cmp5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 177 | static int _client_cmp6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 178 | static int _client_cmp7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 179 | |
| 180 | static int _client_col0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 181 | static int _client_col1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 182 | static int _client_col2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 183 | static int _client_col3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 184 | static int _client_col4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 185 | static int _client_col5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 186 | static int _client_col6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 187 | static int _client_col7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 188 | |
| 189 | static int _client_crd0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 190 | static int _client_crd1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 191 | static int _client_crd2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 192 | static int _client_crd3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 193 | static int _client_crd4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 194 | static int _client_crd5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 195 | static int _client_crd6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 196 | static int _client_crd7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 197 | |
| 198 | static int _client_inb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 199 | static int _client_inb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 200 | static int _client_inb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 201 | static int _client_inb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 202 | static int _client_inb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 203 | static int _client_inb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 204 | static int _client_inb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 205 | static int _client_inb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 206 | |
| 207 | static int _client_unb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 208 | static int _client_unb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 209 | static int _client_unb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 210 | static int _client_unb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 211 | static int _client_unb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 212 | static int _client_unb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 213 | static int _client_unb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 214 | static int _client_unb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 215 | |
| 216 | static int _client_plb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 217 | static int _client_plb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 218 | static int _client_plb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 219 | static int _client_plb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 220 | static int _client_plb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 221 | static int _client_plb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 222 | static int _client_plb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 223 | static int _client_plb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 224 | |
| 225 | static int _client_blb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 226 | static int _client_blb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 227 | static int _client_blb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 228 | static int _client_blb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 229 | static int _client_blb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 230 | static int _client_blb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 231 | static int _client_blb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 232 | static int _client_blb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 233 | |
| 234 | static int _client_inl0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 235 | static int _client_inl1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 236 | static int _client_inl2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 237 | static int _client_inl3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 238 | static int _client_inl4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 239 | static int _client_inl5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 240 | static int _client_inl6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 241 | static int _client_inl7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 242 | |
| 243 | static int _client_unl0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 244 | static int _client_unl1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 245 | static int _client_unl2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 246 | static int _client_unl3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 247 | static int _client_unl4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 248 | static int _client_unl5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 249 | static int _client_unl6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 250 | static int _client_unl7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 251 | |
| 252 | static int _client_pll0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 253 | static int _client_pll1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 254 | static int _client_pll2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 255 | static int _client_pll3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 256 | static int _client_pll4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 257 | static int _client_pll5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 258 | static int _client_pll6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 259 | static int _client_pll7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 260 | |
| 261 | static int _client_bll0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 262 | static int _client_bll1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 263 | static int _client_bll2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 264 | static int _client_bll3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 265 | static int _client_bll4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 266 | static int _client_bll5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 267 | static int _client_bll6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 268 | static int _client_bll7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 269 | |
| 270 | static int _client_ink0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 271 | static int _client_ink1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 272 | static int _client_ink2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 273 | static int _client_ink3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 274 | static int _client_ink4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 275 | static int _client_ink5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 276 | static int _client_ink6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 277 | static int _client_ink7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 278 | |
| 279 | static int _client_unk0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 280 | static int _client_unk1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 281 | static int _client_unk2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 282 | static int _client_unk3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 283 | static int _client_unk4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 284 | static int _client_unk5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 285 | static int _client_unk6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 286 | static int _client_unk7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 287 | |
| 288 | static int _client_plk0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 289 | static int _client_plk1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 290 | static int _client_plk2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 291 | static int _client_plk3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 292 | static int _client_plk4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 293 | static int _client_plk5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 294 | static int _client_plk6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 295 | static int _client_plk7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 296 | |
| 297 | static int _client_blk0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 298 | static int _client_blk1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 299 | static int _client_blk2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 300 | static int _client_blk3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 301 | static int _client_blk4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 302 | static int _client_blk5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 303 | static int _client_blk6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 304 | static int _client_blk7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 305 | |
| 306 | static int _client_blc0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 307 | static int _client_blc1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 308 | static int _client_blc2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 309 | static int _client_blc3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 310 | static int _client_blc4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 311 | static int _client_blc5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 312 | static int _client_blc6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 313 | static int _client_blc7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 314 | |
| 315 | typedef int(*t_wol_gamerestag)(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data); |
| 316 | |
| 317 | typedef struct { |
| 318 | t_tag wol_gamerestag_uint; |
| 319 | t_wol_gamerestag wol_gamerestag_handler; |
| 320 | } t_wol_gamerestag_table_row; |
| 321 | |
| 322 | /* handler table */ |
| 323 | static const t_wol_gamerestag_table_row wol_gamreres_htable[] = { |
| 324 | { CLIENT_SERN_UINT, _client_sern }, |
| 325 | { CLIENT_SDFX_UINT, _client_sdfx }, |
| 326 | { CLIENT_IDNO_UINT, _client_idno }, |
| 327 | { CLIENT_GSKU_UINT, _client_gsku }, |
| 328 | { CLIENT_DCON_UINT, _client_dcon }, |
| 329 | { CLIENT_LCON_UINT, _client_lcon }, |
| 330 | { CLIENT_TYPE_UINT, _client_type }, |
| 331 | { CLIENT_TRNY_UINT, _client_trny }, |
| 332 | { CLIENT_OOSY_UINT, _client_oosy }, |
| 333 | { CLIENT_FINI_UINT, _client_fini }, |
| 334 | { CLIENT_DURA_UINT, _client_dura }, |
| 335 | { CLIENT_CRED_UINT, _client_cred }, |
| 336 | { CLIENT_SHRT_UINT, _client_shrt }, |
| 337 | { CLIENT_SUPR_UINT, _client_supr }, |
| 338 | { CLIENT_MODE_UINT, _client_mode }, |
| 339 | { CLIENT_BAMR_UINT, _client_bamr }, |
| 340 | { CLIENT_CRAT_UINT, _client_crat }, |
| 341 | { CLIENT_AIPL_UINT, _client_aipl }, |
| 342 | { CLIENT_UNIT_UINT, _client_unit }, |
| 343 | { CLIENT_SCEN_UINT, _client_scen }, |
| 344 | { CLIENT_CMPL_UINT, _client_cmpl }, |
| 345 | { CLIENT_PNGS_UINT, _client_pngs }, |
| 346 | { CLIENT_PNGR_UINT, _client_pngr }, |
| 347 | { CLIENT_PLRS_UINT, _client_plrs }, |
| 348 | { CLIENT_SPID_UINT, _client_spid }, |
| 349 | { CLIENT_TIME_UINT, _client_time }, |
| 350 | { CLIENT_AFPS_UINT, _client_afps }, |
| 351 | { CLIENT_PROC_UINT, _client_proc }, |
| 352 | { CLIENT_MEMO_UINT, _client_memo }, |
| 353 | { CLIENT_VIDM_UINT, _client_vidm }, |
| 354 | { CLIENT_SPED_UINT, _client_sped }, |
| 355 | { CLIENT_VERS_UINT, _client_vers }, |
| 356 | { CLIENT_DATE_UINT, _client_date }, |
| 357 | { CLIENT_BASE_UINT, _client_base }, |
| 358 | { CLIENT_TIBR_UINT, _client_tibr }, |
| 359 | { CLIENT_SHAD_UINT, _client_shad }, |
| 360 | { CLIENT_FLAG_UINT, _client_flag }, |
| 361 | { CLIENT_TECH_UINT, _client_tech }, |
| 362 | { CLIENT_BROK_UINT, _client_brok }, |
| 363 | { CLIENT_ACCO_UINT, _client_acco }, |
| 364 | { CLIENT_ETIM_UINT, _client_etim }, |
| 365 | { CLIENT_PSPD_UINT, _client_pspd }, |
| 366 | { CLIENT_SMEM_UINT, _client_smem }, |
| 367 | { CLIENT_SVID_UINT, _client_svid }, |
| 368 | { CLIENT_SNAM_UINT, _client_snam }, |
| 369 | { CLIENT_GMAP_UINT, _client_gmap }, |
| 370 | { CLIENT_DSVR_UINT, _client_dsvr }, |
| 371 | |
| 372 | /* Renegade Player related tags */ |
| 373 | { CLIENT_PNAM_UINT, _client_pnam }, |
| 374 | { CLIENT_PLOC_UINT, _client_ploc }, |
| 375 | { CLIENT_TEAM_UINT, _client_team }, |
| 376 | { CLIENT_PSCR_UINT, _client_pscr }, |
| 377 | { CLIENT_PPTS_UINT, _client_ppts }, |
| 378 | { CLIENT_PTIM_UINT, _client_ptim }, |
| 379 | { CLIENT_PHLT_UINT, _client_phlt }, |
| 380 | { CLIENT_PKIL_UINT, _client_pkil }, |
| 381 | { CLIENT_EKIL_UINT, _client_ekil }, |
| 382 | { CLIENT_AKIL_UINT, _client_akil }, |
| 383 | { CLIENT_SHOT_UINT, _client_shot }, |
| 384 | { CLIENT_HEDF_UINT, _client_hedf }, |
| 385 | { CLIENT_TORF_UINT, _client_torf }, |
| 386 | { CLIENT_ARMF_UINT, _client_armf }, |
| 387 | { CLIENT_LEGF_UINT, _client_legf }, |
| 388 | { CLIENT_CRTF_UINT, _client_crtf }, |
| 389 | { CLIENT_PUPS_UINT, _client_pups }, |
| 390 | { CLIENT_VKIL_UINT, _client_vkil }, |
| 391 | { CLIENT_VTIM_UINT, _client_vtim }, |
| 392 | { CLIENT_NKFV_UINT, _client_nkfv }, |
| 393 | { CLIENT_SQUI_UINT, _client_squi }, |
| 394 | { CLIENT_PCRD_UINT, _client_pcrd }, |
| 395 | { CLIENT_BKIL_UINT, _client_bkil }, |
| 396 | { CLIENT_HEDR_UINT, _client_hedr }, |
| 397 | { CLIENT_TORR_UINT, _client_torr }, |
| 398 | { CLIENT_ARMR_UINT, _client_armr }, |
| 399 | { CLIENT_LEGR_UINT, _client_legr }, |
| 400 | { CLIENT_CRTR_UINT, _client_crtr }, |
| 401 | { CLIENT_FLGC_UINT, _client_flgc }, |
| 402 | |
| 403 | /* Player related tags */ |
| 404 | { CLIENT_NAM0_UINT, _client_nam0 }, |
| 405 | { CLIENT_NAM1_UINT, _client_nam1 }, |
| 406 | { CLIENT_NAM2_UINT, _client_nam2 }, |
| 407 | { CLIENT_NAM3_UINT, _client_nam3 }, |
| 408 | { CLIENT_NAM4_UINT, _client_nam4 }, |
| 409 | { CLIENT_NAM5_UINT, _client_nam5 }, |
| 410 | { CLIENT_NAM6_UINT, _client_nam6 }, |
| 411 | { CLIENT_NAM7_UINT, _client_nam7 }, |
| 412 | |
| 413 | { CLIENT_IPA0_UINT, _client_ipa0 }, |
| 414 | { CLIENT_IPA1_UINT, _client_ipa1 }, |
| 415 | { CLIENT_IPA2_UINT, _client_ipa2 }, |
| 416 | { CLIENT_IPA3_UINT, _client_ipa3 }, |
| 417 | { CLIENT_IPA4_UINT, _client_ipa4 }, |
| 418 | { CLIENT_IPA5_UINT, _client_ipa5 }, |
| 419 | { CLIENT_IPA6_UINT, _client_ipa6 }, |
| 420 | { CLIENT_IPA7_UINT, _client_ipa7 }, |
| 421 | |
| 422 | { CLIENT_CID0_UINT, _client_cid0 }, |
| 423 | { CLIENT_CID1_UINT, _client_cid1 }, |
| 424 | { CLIENT_CID2_UINT, _client_cid2 }, |
| 425 | { CLIENT_CID3_UINT, _client_cid3 }, |
| 426 | { CLIENT_CID4_UINT, _client_cid4 }, |
| 427 | { CLIENT_CID5_UINT, _client_cid5 }, |
| 428 | { CLIENT_CID6_UINT, _client_cid6 }, |
| 429 | { CLIENT_CID7_UINT, _client_cid7 }, |
| 430 | |
| 431 | { CLIENT_SID0_UINT, _client_sid0 }, |
| 432 | { CLIENT_SID1_UINT, _client_sid1 }, |
| 433 | { CLIENT_SID2_UINT, _client_sid2 }, |
| 434 | { CLIENT_SID3_UINT, _client_sid3 }, |
| 435 | { CLIENT_SID4_UINT, _client_sid4 }, |
| 436 | { CLIENT_SID5_UINT, _client_sid5 }, |
| 437 | { CLIENT_SID6_UINT, _client_sid6 }, |
| 438 | { CLIENT_SID7_UINT, _client_sid7 }, |
| 439 | |
| 440 | { CLIENT_TID0_UINT, _client_tid0 }, |
| 441 | { CLIENT_TID1_UINT, _client_tid1 }, |
| 442 | { CLIENT_TID2_UINT, _client_tid2 }, |
| 443 | { CLIENT_TID3_UINT, _client_tid3 }, |
| 444 | { CLIENT_TID4_UINT, _client_tid4 }, |
| 445 | { CLIENT_TID5_UINT, _client_tid5 }, |
| 446 | { CLIENT_TID6_UINT, _client_tid6 }, |
| 447 | { CLIENT_TID7_UINT, _client_tid7 }, |
| 448 | |
| 449 | { CLIENT_CMP0_UINT, _client_cmp0 }, |
| 450 | { CLIENT_CMP1_UINT, _client_cmp1 }, |
| 451 | { CLIENT_CMP2_UINT, _client_cmp2 }, |
| 452 | { CLIENT_CMP3_UINT, _client_cmp3 }, |
| 453 | { CLIENT_CMP4_UINT, _client_cmp4 }, |
| 454 | { CLIENT_CMP5_UINT, _client_cmp5 }, |
| 455 | { CLIENT_CMP6_UINT, _client_cmp6 }, |
| 456 | { CLIENT_CMP7_UINT, _client_cmp7 }, |
| 457 | |
| 458 | { CLIENT_COL0_UINT, _client_col0 }, |
| 459 | { CLIENT_COL1_UINT, _client_col1 }, |
| 460 | { CLIENT_COL2_UINT, _client_col2 }, |
| 461 | { CLIENT_COL3_UINT, _client_col3 }, |
| 462 | { CLIENT_COL4_UINT, _client_col4 }, |
| 463 | { CLIENT_COL5_UINT, _client_col5 }, |
| 464 | { CLIENT_COL6_UINT, _client_col6 }, |
| 465 | { CLIENT_COL7_UINT, _client_col7 }, |
| 466 | |
| 467 | { CLIENT_CRD0_UINT, _client_crd0 }, |
| 468 | { CLIENT_CRD1_UINT, _client_crd1 }, |
| 469 | { CLIENT_CRD2_UINT, _client_crd2 }, |
| 470 | { CLIENT_CRD3_UINT, _client_crd3 }, |
| 471 | { CLIENT_CRD4_UINT, _client_crd4 }, |
| 472 | { CLIENT_CRD5_UINT, _client_crd5 }, |
| 473 | { CLIENT_CRD6_UINT, _client_crd6 }, |
| 474 | { CLIENT_CRD7_UINT, _client_crd7 }, |
| 475 | |
| 476 | { CLIENT_INB0_UINT, _client_inb0 }, |
| 477 | { CLIENT_INB1_UINT, _client_inb1 }, |
| 478 | { CLIENT_INB2_UINT, _client_inb2 }, |
| 479 | { CLIENT_INB3_UINT, _client_inb3 }, |
| 480 | { CLIENT_INB4_UINT, _client_inb4 }, |
| 481 | { CLIENT_INB5_UINT, _client_inb5 }, |
| 482 | { CLIENT_INB6_UINT, _client_inb6 }, |
| 483 | { CLIENT_INB7_UINT, _client_inb7 }, |
| 484 | |
| 485 | { CLIENT_UNB0_UINT, _client_unb0 }, |
| 486 | { CLIENT_UNB1_UINT, _client_unb1 }, |
| 487 | { CLIENT_UNB2_UINT, _client_unb2 }, |
| 488 | { CLIENT_UNB3_UINT, _client_unb3 }, |
| 489 | { CLIENT_UNB4_UINT, _client_unb4 }, |
| 490 | { CLIENT_UNB5_UINT, _client_unb5 }, |
| 491 | { CLIENT_UNB6_UINT, _client_unb6 }, |
| 492 | { CLIENT_UNB7_UINT, _client_unb7 }, |
| 493 | |
| 494 | { CLIENT_PLB0_UINT, _client_plb0 }, |
| 495 | { CLIENT_PLB1_UINT, _client_plb1 }, |
| 496 | { CLIENT_PLB2_UINT, _client_plb2 }, |
| 497 | { CLIENT_PLB3_UINT, _client_plb3 }, |
| 498 | { CLIENT_PLB4_UINT, _client_plb4 }, |
| 499 | { CLIENT_PLB5_UINT, _client_plb5 }, |
| 500 | { CLIENT_PLB6_UINT, _client_plb6 }, |
| 501 | { CLIENT_PLB7_UINT, _client_plb7 }, |
| 502 | |
| 503 | { CLIENT_BLB0_UINT, _client_blb0 }, |
| 504 | { CLIENT_BLB1_UINT, _client_blb1 }, |
| 505 | { CLIENT_BLB2_UINT, _client_blb2 }, |
| 506 | { CLIENT_BLB3_UINT, _client_blb3 }, |
| 507 | { CLIENT_BLB4_UINT, _client_blb4 }, |
| 508 | { CLIENT_BLB5_UINT, _client_blb5 }, |
| 509 | { CLIENT_BLB6_UINT, _client_blb6 }, |
| 510 | { CLIENT_BLB7_UINT, _client_blb7 }, |
| 511 | |
| 512 | { CLIENT_INL0_UINT, _client_inl0 }, |
| 513 | { CLIENT_INL1_UINT, _client_inl1 }, |
| 514 | { CLIENT_INL2_UINT, _client_inl2 }, |
| 515 | { CLIENT_INL3_UINT, _client_inl3 }, |
| 516 | { CLIENT_INL4_UINT, _client_inl4 }, |
| 517 | { CLIENT_INL5_UINT, _client_inl5 }, |
| 518 | { CLIENT_INL6_UINT, _client_inl6 }, |
| 519 | { CLIENT_INL7_UINT, _client_inl7 }, |
| 520 | |
| 521 | { CLIENT_UNL0_UINT, _client_unl0 }, |
| 522 | { CLIENT_UNL1_UINT, _client_unl1 }, |
| 523 | { CLIENT_UNL2_UINT, _client_unl2 }, |
| 524 | { CLIENT_UNL3_UINT, _client_unl3 }, |
| 525 | { CLIENT_UNL4_UINT, _client_unl4 }, |
| 526 | { CLIENT_UNL5_UINT, _client_unl5 }, |
| 527 | { CLIENT_UNL6_UINT, _client_unl6 }, |
| 528 | { CLIENT_UNL7_UINT, _client_unl7 }, |
| 529 | |
| 530 | { CLIENT_PLL0_UINT, _client_pll0 }, |
| 531 | { CLIENT_PLL1_UINT, _client_pll1 }, |
| 532 | { CLIENT_PLL2_UINT, _client_pll2 }, |
| 533 | { CLIENT_PLL3_UINT, _client_pll3 }, |
| 534 | { CLIENT_PLL4_UINT, _client_pll4 }, |
| 535 | { CLIENT_PLL5_UINT, _client_pll5 }, |
| 536 | { CLIENT_PLL6_UINT, _client_pll6 }, |
| 537 | { CLIENT_PLL7_UINT, _client_pll7 }, |
| 538 | |
| 539 | { CLIENT_BLL0_UINT, _client_bll0 }, |
| 540 | { CLIENT_BLL1_UINT, _client_bll1 }, |
| 541 | { CLIENT_BLL2_UINT, _client_bll2 }, |
| 542 | { CLIENT_BLL3_UINT, _client_bll3 }, |
| 543 | { CLIENT_BLL4_UINT, _client_bll4 }, |
| 544 | { CLIENT_BLL5_UINT, _client_bll5 }, |
| 545 | { CLIENT_BLL6_UINT, _client_bll6 }, |
| 546 | { CLIENT_BLL7_UINT, _client_bll7 }, |
| 547 | |
| 548 | { CLIENT_INK0_UINT, _client_ink0 }, |
| 549 | { CLIENT_INK1_UINT, _client_ink1 }, |
| 550 | { CLIENT_INK2_UINT, _client_ink2 }, |
| 551 | { CLIENT_INK3_UINT, _client_ink3 }, |
| 552 | { CLIENT_INK4_UINT, _client_ink4 }, |
| 553 | { CLIENT_INK5_UINT, _client_ink5 }, |
| 554 | { CLIENT_INK6_UINT, _client_ink6 }, |
| 555 | { CLIENT_INK7_UINT, _client_ink7 }, |
| 556 | |
| 557 | { CLIENT_UNK0_UINT, _client_unk0 }, |
| 558 | { CLIENT_UNK1_UINT, _client_unk1 }, |
| 559 | { CLIENT_UNK2_UINT, _client_unk2 }, |
| 560 | { CLIENT_UNK3_UINT, _client_unk3 }, |
| 561 | { CLIENT_UNK4_UINT, _client_unk4 }, |
| 562 | { CLIENT_UNK5_UINT, _client_unk5 }, |
| 563 | { CLIENT_UNK6_UINT, _client_unk6 }, |
| 564 | { CLIENT_UNK7_UINT, _client_unk7 }, |
| 565 | |
| 566 | { CLIENT_PLK0_UINT, _client_plk0 }, |
| 567 | { CLIENT_PLK1_UINT, _client_plk1 }, |
| 568 | { CLIENT_PLK2_UINT, _client_plk2 }, |
| 569 | { CLIENT_PLK3_UINT, _client_plk3 }, |
| 570 | { CLIENT_PLK4_UINT, _client_plk4 }, |
| 571 | { CLIENT_PLK5_UINT, _client_plk5 }, |
| 572 | { CLIENT_PLK6_UINT, _client_plk6 }, |
| 573 | { CLIENT_PLK7_UINT, _client_plk7 }, |
| 574 | |
| 575 | { CLIENT_BLK0_UINT, _client_blk0 }, |
| 576 | { CLIENT_BLK1_UINT, _client_blk1 }, |
| 577 | { CLIENT_BLK2_UINT, _client_blk2 }, |
| 578 | { CLIENT_BLK3_UINT, _client_blk3 }, |
| 579 | { CLIENT_BLK4_UINT, _client_blk4 }, |
| 580 | { CLIENT_BLK5_UINT, _client_blk5 }, |
| 581 | { CLIENT_BLK6_UINT, _client_blk6 }, |
| 582 | { CLIENT_BLK7_UINT, _client_blk7 }, |
| 583 | |
| 584 | { CLIENT_BLC0_UINT, _client_blc0 }, |
| 585 | { CLIENT_BLC1_UINT, _client_blc1 }, |
| 586 | { CLIENT_BLC2_UINT, _client_blc2 }, |
| 587 | { CLIENT_BLC3_UINT, _client_blc3 }, |
| 588 | { CLIENT_BLC4_UINT, _client_blc4 }, |
| 589 | { CLIENT_BLC5_UINT, _client_blc5 }, |
| 590 | { CLIENT_BLC6_UINT, _client_blc6 }, |
| 591 | { CLIENT_BLC7_UINT, _client_blc7 }, |
| 592 | |
| 593 | { 1, NULL } |
| 594 | }; |
| 595 | |
| 596 | static int handle_wolgameres_tag(t_wol_gameres_result * game_result, t_tag gamerestag, wol_gameres_type type, int size, void const * data) |
| 597 | { |
| 598 | t_wol_gamerestag_table_row const *p; |
| 599 | |
| 600 | for (p = wol_gamreres_htable; p->wol_gamerestag_uint != 1; p++) { |
| 601 | if (gamerestag == p->wol_gamerestag_uint) { |
| 602 | if (p->wol_gamerestag_handler != NULL) |
| 603 | return ((p->wol_gamerestag_handler)(game_result, type, size, data)); |
| 604 | } |
| 605 | } |
| 606 | return -1; |
| 607 | } |
| 608 | |
| 609 | static wol_gameres_type wol_gameres_type_from_int(int type) |
| 610 | { |
| 611 | switch (type) { |
| 612 | case DATA_TYPE_BYTE: |
| 613 | return wol_gameres_type_byte; |
| 614 | case DATA_TYPE_BOOL: |
| 615 | return wol_gameres_type_bool; |
| 616 | case DATA_TYPE_TIME: |
| 617 | return wol_gameres_type_time; |
| 618 | case DATA_TYPE_INT: |
| 619 | return wol_gameres_type_int; |
| 620 | case DATA_TYPE_STRING: |
| 621 | return wol_gameres_type_string; |
| 622 | case DATA_TYPE_BIGINT: |
| 623 | return wol_gameres_type_bigint; |
| 624 | default: |
| 625 | WARN1("type {} is not defined", type); |
| 626 | return wol_gameres_type_unknown; |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | static unsigned long wol_gameres_get_long_from_data(int size, const void * data) |
| 631 | { |
| 632 | unsigned int temp = 0; |
| 633 | const char * chdata; |
| 634 | int i = 0; |
| 635 | |
| 636 | if (!data) { |
| 637 | ERROR0("got NULL data"); |
| 638 | return 0; |
| 639 | } |
| 640 | |
| 641 | if (size < 4) |
| 642 | return 0; |
| 643 | |
| 644 | chdata = (const char*)data; |
| 645 | |
| 646 | while (i < size) { |
| 647 | temp = temp + (unsigned int)bn_int_nget(*((bn_int *)chdata)); |
| 648 | i += 4; |
| 649 | if (i < size) { |
| 650 | *(chdata++); |
| 651 | *(chdata++); |
| 652 | *(chdata++); |
| 653 | *(chdata++); |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | return temp; |
| 658 | } |
| 659 | |
| 660 | static t_wol_gameres_result * gameres_result_create() |
| 661 | { |
| 662 | t_wol_gameres_result * gameres_result; |
| 663 | |
| 664 | gameres_result = (t_wol_gameres_result*)xmalloc(sizeof(t_wol_gameres_result)); |
| 665 | |
| 666 | gameres_result->game = NULL; |
| 667 | gameres_result->results = NULL; |
| 668 | gameres_result->senderid = -1; |
| 669 | gameres_result->myaccount = NULL; |
| 670 | |
| 671 | return gameres_result; |
| 672 | } |
| 673 | |
| 674 | static int gameres_result_destroy(t_wol_gameres_result * gameres_result) |
| 675 | { |
| 676 | if (!gameres_result) { |
| 677 | eventlog(eventlog_level_error, __FUNCTION__, "got NULL gameres_result"); |
| 678 | return -1; |
| 679 | } |
| 680 | |
| 681 | eventlog(eventlog_level_info, __FUNCTION__, "destroying gameres_result"); |
| 682 | |
| 683 | xfree(gameres_result); |
| 684 | |
| 685 | return 0; |
| 686 | } |
| 687 | |
| 688 | extern int handle_wol_gameres_packet(t_connection * c, t_packet const * const packet) |
| 689 | { |
| 690 | unsigned offset; |
| 691 | t_tag wgtag; |
| 692 | char wgtag_str[5]; |
| 693 | unsigned datatype; |
| 694 | unsigned datalen; |
| 695 | void const * data; |
| 696 | wol_gameres_type type; |
| 697 | t_wol_gameres_result * gameres_result; |
| 698 | |
| 699 | DEBUG2("[{}] got WOL Gameres packet length {}", conn_get_socket(c), packet_get_size(packet)); |
| 700 | offset = sizeof(t_wolgameres_header); |
| 701 | |
| 702 | if ((unsigned int)bn_int_nget(*((bn_int *)packet_get_data_const(packet, offset, 4))) == 0) |
| 703 | offset += 4; /* Just trying to get RNGD working */ |
| 704 | |
| 705 | gameres_result = gameres_result_create(); |
| 706 | |
| 707 | while (offset < packet_get_size(packet)) { |
| 708 | if (packet_get_size(packet) < offset + 4) { |
| 709 | eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad WOL Gameres packet (missing tag)", conn_get_socket(c)); |
| 710 | return -1; |
| 711 | } |
| 712 | wgtag = (unsigned int)bn_int_nget(*((bn_int *)packet_get_data_const(packet, offset, 4))); |
| 713 | offset += 4; |
| 714 | |
| 715 | if (packet_get_size(packet) < offset + 2) { |
| 716 | eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad WOL Gameres packet (missing datatype)", conn_get_socket(c)); |
| 717 | return -1; |
| 718 | } |
| 719 | datatype = (unsigned int)bn_short_nget(*((bn_short *)packet_get_data_const(packet, offset, 2))); |
| 720 | offset += 2; |
| 721 | |
| 722 | if (packet_get_size(packet) < offset + 2) { |
| 723 | eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad WOL Gameres packet (missing datalen)", conn_get_socket(c)); |
| 724 | return -1; |
| 725 | } |
| 726 | datalen = (unsigned int)bn_short_nget(*((bn_short *)packet_get_data_const(packet, offset, 2))); |
| 727 | offset += 2; |
| 728 | |
| 729 | if (packet_get_size(packet) < offset + 1) { |
| 730 | eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad WOL Gameres packet (missing data)", conn_get_socket(c)); |
| 731 | return -1; |
| 732 | } |
| 733 | data = packet_get_data_const(packet, offset, 1); |
| 734 | |
| 735 | type = wol_gameres_type_from_int(datatype); |
| 736 | |
| 737 | if (handle_wolgameres_tag(gameres_result, wgtag, type, datalen, data) != 0) { |
| 738 | char ch_data[255]; /* FIXME: this is not so good */ |
| 739 | tag_uint_to_str(wgtag_str, wgtag); |
| 740 | |
| 741 | switch (type) { |
| 742 | case wol_gameres_type_bool: |
| 743 | case wol_gameres_type_byte: |
| 744 | std::snprintf(ch_data, sizeof(ch_data), "%" PRIu8, bn_byte_get(*((bn_byte *)data))); |
| 745 | break; |
| 746 | case wol_gameres_type_int: |
| 747 | case wol_gameres_type_time: |
| 748 | std::snprintf(ch_data, sizeof(ch_data), "%" PRIu32, bn_int_nget(*((bn_int *)data))); |
| 749 | break; |
| 750 | case wol_gameres_type_string: |
| 751 | std::snprintf(ch_data, sizeof(ch_data), "%s", (char*)data); |
| 752 | break; |
| 753 | case wol_gameres_type_bigint: |
| 754 | std::snprintf(ch_data, sizeof(ch_data), "%lu", wol_gameres_get_long_from_data(datalen, data)); |
| 755 | break; |
| 756 | default: |
| 757 | std::snprintf(ch_data, sizeof(ch_data), "UNKNOWN"); |
| 758 | break; |
| 759 | } |
| 760 | eventlog(eventlog_level_warn, __FUNCTION__, "[{}] got unknown WOL Gameres tag: {}, data type {}, data lent {}, data {}", conn_get_socket(c), wgtag_str, datatype, datalen, ch_data); |
| 761 | |
| 762 | } |
| 763 | |
| 764 | datalen = 4 * ((datalen + 3) / 4); |
| 765 | offset += datalen; |
| 766 | } |
| 767 | |
| 768 | if (!(gameres_result->game)) { |
| 769 | ERROR0("game not found (game == NULL)"); |
| 770 | return -1; |
| 771 | } |
| 772 | if (!(gameres_result->myaccount)) { |
| 773 | ERROR0("have not account of sender"); |
| 774 | return -1; |
| 775 | } |
| 776 | if (!(gameres_result->results)) { |
| 777 | ERROR0("have not results of game"); |
| 778 | return -1; |
| 779 | } |
| 780 | |
| 781 | game_set_report(gameres_result->game, gameres_result->myaccount, "head", "body"); |
| 782 | |
| 783 | if (game_set_reported_results(gameres_result->game, gameres_result->myaccount, gameres_result->results) < 0) |
| 784 | xfree((void *)gameres_result->results); |
| 785 | |
| 786 | conn_set_game(account_get_conn(gameres_result->myaccount), NULL, NULL, NULL, game_type_none, 0); |
| 787 | |
| 788 | gameres_result_destroy(gameres_result); |
| 789 | |
| 790 | return 0; |
| 791 | } |
| 792 | |
| 793 | /** |
| 794 | * WOL Gamreres tag handlers |
| 795 | */ |
| 796 | |
| 797 | static int _client_sern(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 798 | { |
| 799 | /* SER# */ |
| 800 | return 0; |
| 801 | } |
| 802 | |
| 803 | static int _client_sdfx(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 804 | { |
| 805 | int sdfx; |
| 806 | |
| 807 | switch (type) { |
| 808 | case wol_gameres_type_bool: |
| 809 | sdfx = (unsigned int)bn_byte_get(*((bn_byte *)data)); |
| 810 | break; |
| 811 | default: |
| 812 | WARN1("got unknown gameres type {} for SDFX", static_cast<int>(type)); |
| 813 | return -1; |
| 814 | } |
| 815 | |
| 816 | if (sdfx) |
| 817 | DEBUG0("SDFX == true"); |
| 818 | else |
| 819 | DEBUG0("SDFX == false"); |
| 820 | |
| 821 | return 0; |
| 822 | } |
| 823 | |
| 824 | static int _client_idno(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 825 | { |
| 826 | unsigned int gameidnumber = 0; |
| 827 | t_game * game; |
| 828 | |
| 829 | switch (type) { |
| 830 | case wol_gameres_type_int: |
| 831 | case wol_gameres_type_time: |
| 832 | gameidnumber = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 833 | break; |
| 834 | default: |
| 835 | WARN1("got unknown gameres type {} for IDNO", static_cast<int>(type)); |
| 836 | break; |
| 837 | } |
| 838 | |
| 839 | if ((gameidnumber) && (game = gamelist_find_game_byid(gameidnumber))) { //&& (game_get_status(game) & game_status_started)) { |
| 840 | DEBUG2("found started game \"{}\" for gameid {}", game_get_name(game), gameidnumber); |
| 841 | game_result->game = game; |
| 842 | game_result->results = (t_game_result*)xmalloc(sizeof(t_game_result)* game_get_count(game)); |
| 843 | } |
| 844 | |
| 845 | return 0; |
| 846 | } |
| 847 | |
| 848 | static int _client_gsku(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 849 | { |
| 850 | unsigned int sku; |
| 851 | const t_game * game = game_result->game; |
| 852 | |
| 853 | switch (type) { |
| 854 | case wol_gameres_type_int: |
| 855 | sku = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 856 | break; |
| 857 | default: |
| 858 | WARN1("got unknown gameres type {} for GSKU", static_cast<int>(type)); |
| 859 | return -1; |
| 860 | } |
| 861 | |
| 862 | if ((sku) && (game) && (game_get_clienttag(game) == tag_sku_to_uint(sku))) { |
| 863 | DEBUG1("got proper WOL game resolution of {}", clienttag_get_title(tag_sku_to_uint(sku))); |
| 864 | } |
| 865 | |
| 866 | |
| 867 | return 0; |
| 868 | } |
| 869 | |
| 870 | static int _client_dcon(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 871 | { |
| 872 | unsigned int dcon; |
| 873 | |
| 874 | switch (type) { |
| 875 | case wol_gameres_type_int: |
| 876 | dcon = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 877 | DEBUG1("DCON is: {}", dcon); |
| 878 | break; |
| 879 | default: |
| 880 | WARN1("got unknown gameres type {} for DCON", static_cast<int>(type)); |
| 881 | break; |
| 882 | } |
| 883 | |
| 884 | return 0; |
| 885 | } |
| 886 | |
| 887 | static int _client_lcon(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 888 | { |
| 889 | unsigned int lcon; |
| 890 | |
| 891 | switch (type) { |
| 892 | case wol_gameres_type_int: |
| 893 | lcon = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 894 | DEBUG1("LCON is: {}", lcon); |
| 895 | break; |
| 896 | default: |
| 897 | WARN1("got unknown gameres type {} for LCON", static_cast<int>(type)); |
| 898 | break; |
| 899 | } |
| 900 | |
| 901 | return 0; |
| 902 | } |
| 903 | |
| 904 | static int _client_type(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 905 | { |
| 906 | int gametype; |
| 907 | |
| 908 | switch (type) { |
| 909 | case wol_gameres_type_bool: |
| 910 | gametype = (unsigned int)bn_byte_get(*((bn_byte *)data)); |
| 911 | DEBUG1("TYPE is: {}", gametype); |
| 912 | break; |
| 913 | default: |
| 914 | WARN1("got unknown gameres type {} for TYPE", static_cast<int>(type)); |
| 915 | break; |
| 916 | } |
| 917 | |
| 918 | return 0; |
| 919 | } |
| 920 | |
| 921 | static int _client_trny(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 922 | { |
| 923 | bool tournament; |
| 924 | |
| 925 | switch (type) { |
| 926 | case wol_gameres_type_bool: |
| 927 | tournament = (bool)bn_byte_get(*((bn_byte *)data)); |
| 928 | break; |
| 929 | case wol_gameres_type_int: |
| 930 | tournament = (bool)bn_int_nget(*((bn_int *)data)); |
| 931 | break; |
| 932 | case wol_gameres_type_string: |
| 933 | if (std::strcmp("TY ", (const char *)data) == 0) /* for RNGD */ |
| 934 | tournament = true; |
| 935 | else if (std::strcmp("TN ", (const char *)data) == 0) /* for RNGD */ |
| 936 | tournament = false; |
| 937 | else { |
| 938 | WARN1("got unknown string for TRNY: {}", (char *)data); |
| 939 | tournament = false; |
| 940 | } |
| 941 | break; |
| 942 | default: |
| 943 | WARN1("got unknown gameres type {} for TRNY", static_cast<int>(type)); |
| 944 | break; |
| 945 | } |
| 946 | |
| 947 | if (tournament) |
| 948 | DEBUG0("game was tournament"); |
| 949 | else |
| 950 | DEBUG0("game was not tournament"); |
| 951 | |
| 952 | return 0; |
| 953 | } |
| 954 | |
| 955 | static int _client_oosy(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 956 | { |
| 957 | bool outofsync; |
| 958 | |
| 959 | switch (type) { |
| 960 | case wol_gameres_type_bool: |
| 961 | outofsync = (bool)bn_byte_get(*((bn_byte *)data)); |
| 962 | break; |
| 963 | default: |
| 964 | WARN1("got unknown gameres type {} for OOSY", static_cast<int>(type)); |
| 965 | break; |
| 966 | } |
| 967 | |
| 968 | if (outofsync) |
| 969 | DEBUG0("Game has Out of Sync YES"); |
| 970 | else |
| 971 | DEBUG0("Game has Out of Sync NO"); |
| 972 | |
| 973 | return 0; |
| 974 | } |
| 975 | |
| 976 | static int _client_fini(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 977 | { |
| 978 | /* Not implemented yet */ |
| 979 | return 0; |
| 980 | } |
| 981 | |
| 982 | static int _client_dura(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 983 | { |
| 984 | unsigned int duration; |
| 985 | |
| 986 | /* Game dureation in seconds??? */ |
| 987 | // DURA : Game Duration |
| 988 | // DURA 00 06 00 04 [00 00 01 F4] |
| 989 | // DURA 00 06 00 04 [00 00 00 06] |
| 990 | |
| 991 | switch (type) { |
| 992 | case wol_gameres_type_int: |
| 993 | case wol_gameres_type_time: |
| 994 | duration = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 995 | DEBUG1("Game duration {} seconds", duration); |
| 996 | break; |
| 997 | default: |
| 998 | WARN1("got unknown gameres type {} for DURA", static_cast<int>(type)); |
| 999 | break; |
| 1000 | } |
| 1001 | |
| 1002 | return 0; |
| 1003 | } |
| 1004 | |
| 1005 | static int _client_cred(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1006 | { |
| 1007 | unsigned int credits; |
| 1008 | |
| 1009 | switch (type) { |
| 1010 | case wol_gameres_type_int: |
| 1011 | credits = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1012 | DEBUG1("Game was start with {} credits", credits); |
| 1013 | break; |
| 1014 | default: |
| 1015 | WARN1("got unknown gameres type {} for CRED", static_cast<int>(type)); |
| 1016 | break; |
| 1017 | } |
| 1018 | |
| 1019 | return 0; |
| 1020 | } |
| 1021 | |
| 1022 | static int _client_shrt(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1023 | { |
| 1024 | bool shortgame; |
| 1025 | |
| 1026 | switch (type) { |
| 1027 | case wol_gameres_type_bool: |
| 1028 | shortgame = (bool)bn_byte_get(*((bn_byte *)data)); |
| 1029 | break; |
| 1030 | case wol_gameres_type_int: |
| 1031 | shortgame = (bool)bn_int_nget(*((bn_int *)data)); |
| 1032 | break; |
| 1033 | default: |
| 1034 | WARN1("got unknown gameres type {} for SHRT", static_cast<int>(type)); |
| 1035 | return -1; |
| 1036 | } |
| 1037 | |
| 1038 | if (shortgame) |
| 1039 | DEBUG0("Game has shortgame ON"); |
| 1040 | else |
| 1041 | DEBUG0("Game has shortgame OFF"); |
| 1042 | |
| 1043 | return 0; |
| 1044 | } |
| 1045 | |
| 1046 | static int _client_supr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1047 | { |
| 1048 | bool superweapons; |
| 1049 | |
| 1050 | switch (type) { |
| 1051 | case wol_gameres_type_bool: |
| 1052 | superweapons = (bool)bn_byte_get(*((bn_byte *)data)); |
| 1053 | break; |
| 1054 | case wol_gameres_type_int: |
| 1055 | superweapons = (bool)bn_int_nget(*((bn_int *)data)); |
| 1056 | break; |
| 1057 | default: |
| 1058 | WARN1("got unknown gameres type {} for SUPR", static_cast<int>(type)); |
| 1059 | return -1; |
| 1060 | } |
| 1061 | |
| 1062 | if (superweapons) |
| 1063 | DEBUG0("Game has superweapons ON"); |
| 1064 | else |
| 1065 | DEBUG0("Game has superweapons OFF"); |
| 1066 | |
| 1067 | return 0; |
| 1068 | } |
| 1069 | |
| 1070 | static int _client_mode(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1071 | { |
| 1072 | /* This tag sends RNGD only */ |
| 1073 | |
| 1074 | switch (type) { |
| 1075 | case wol_gameres_type_string: |
| 1076 | DEBUG1("Game mode: {}", (char *)data); /* For RNGD */ |
| 1077 | break; |
| 1078 | default: |
| 1079 | WARN1("got unknown gameres type {} for MODE", static_cast<int>(type)); |
| 1080 | break; |
| 1081 | } |
| 1082 | |
| 1083 | return 0; |
| 1084 | } |
| 1085 | |
| 1086 | static int _client_bamr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1087 | { |
| 1088 | /* Not implemented yet */ |
| 1089 | return 0; |
| 1090 | } |
| 1091 | |
| 1092 | static int _client_crat(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1093 | { |
| 1094 | bool crates; |
| 1095 | |
| 1096 | switch (type) { |
| 1097 | case wol_gameres_type_bool: |
| 1098 | crates = (bool)bn_byte_get(*((bn_byte *)data)); |
| 1099 | break; |
| 1100 | case wol_gameres_type_int: |
| 1101 | crates = (bool)bn_int_nget(*((bn_int *)data)); |
| 1102 | break; |
| 1103 | case wol_gameres_type_string: |
| 1104 | if (std::strcmp("ON", (const char *)data) == 0) |
| 1105 | crates = true; |
| 1106 | else if (std::strcmp("OFF", (const char *)data) == 0) |
| 1107 | crates = false; |
| 1108 | else { |
| 1109 | WARN1("got unknown string for CRAT: {}", (char *)data); |
| 1110 | crates = false; |
| 1111 | } |
| 1112 | break; |
| 1113 | default: |
| 1114 | WARN1("got unknown gameres type {} for CRAT", static_cast<int>(type)); |
| 1115 | return -1; |
| 1116 | } |
| 1117 | |
| 1118 | if (crates) |
| 1119 | DEBUG0("Game has crates ON"); |
| 1120 | else |
| 1121 | DEBUG0("Game has crates OFF"); |
| 1122 | |
| 1123 | return 0; |
| 1124 | } |
| 1125 | |
| 1126 | static int _client_aipl(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1127 | { |
| 1128 | unsigned int aicount; |
| 1129 | |
| 1130 | if (type == wol_gameres_type_int) { |
| 1131 | aicount = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1132 | DEBUG1("Game has {} AI players", aicount); |
| 1133 | } |
| 1134 | else { |
| 1135 | WARN1("got unknown gameres type {} for AIPL", static_cast<int>(type)); |
| 1136 | return 0; |
| 1137 | } |
| 1138 | |
| 1139 | return 0; |
| 1140 | } |
| 1141 | |
| 1142 | static int _client_unit(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1143 | { |
| 1144 | unsigned int units; |
| 1145 | |
| 1146 | switch (type) { |
| 1147 | case wol_gameres_type_int: |
| 1148 | units = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1149 | DEBUG1("Game was started with {} units", units); |
| 1150 | break; |
| 1151 | default: |
| 1152 | WARN1("got unknown gameres type {} for UNIT", static_cast<int>(type)); |
| 1153 | break; |
| 1154 | } |
| 1155 | |
| 1156 | return 0; |
| 1157 | } |
| 1158 | |
| 1159 | static int _client_scen(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1160 | { |
| 1161 | switch (type) { |
| 1162 | case wol_gameres_type_string: |
| 1163 | DEBUG1("Secnario {}", (char *)data); |
| 1164 | break; |
| 1165 | case wol_gameres_type_int: |
| 1166 | DEBUG1("Secnario num {}", (unsigned int)bn_int_nget(*((bn_int *)data))); |
| 1167 | break; |
| 1168 | default: |
| 1169 | WARN1("got unknown gameres type {} for SCEN", static_cast<int>(type)); |
| 1170 | break; |
| 1171 | } |
| 1172 | |
| 1173 | return 0; |
| 1174 | } |
| 1175 | |
| 1176 | static int _client_cmpl(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1177 | { |
| 1178 | int cmpl; |
| 1179 | |
| 1180 | switch (type) { |
| 1181 | case wol_gameres_type_byte: |
| 1182 | cmpl = (unsigned int)bn_byte_get(*((bn_byte *)data)); |
| 1183 | DEBUG1("CMPL is: {}", cmpl); |
| 1184 | break; |
| 1185 | default: |
| 1186 | WARN1("got unknown gameres type {} for CMPL", static_cast<int>(type)); |
| 1187 | break; |
| 1188 | } |
| 1189 | |
| 1190 | return 0; |
| 1191 | } |
| 1192 | |
| 1193 | static int _client_pngs(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1194 | { |
| 1195 | unsigned int pngs; |
| 1196 | |
| 1197 | switch (type) { |
| 1198 | case wol_gameres_type_int: |
| 1199 | pngs = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1200 | DEBUG1("PNGS {} ", pngs); |
| 1201 | break; |
| 1202 | default: |
| 1203 | WARN1("got unknown gameres type {} for PNGS", static_cast<int>(type)); |
| 1204 | break; |
| 1205 | } |
| 1206 | return 0; |
| 1207 | } |
| 1208 | |
| 1209 | static int _client_pngr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1210 | { |
| 1211 | unsigned int pngr; |
| 1212 | |
| 1213 | switch (type) { |
| 1214 | case wol_gameres_type_int: |
| 1215 | pngr = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1216 | DEBUG1("PNGR {} ", pngr); |
| 1217 | break; |
| 1218 | default: |
| 1219 | WARN1("got unknown gameres type {} for PNGR", static_cast<int>(type)); |
| 1220 | break; |
| 1221 | } |
| 1222 | return 0; |
| 1223 | } |
| 1224 | |
| 1225 | static int _client_plrs(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1226 | { |
| 1227 | unsigned int playercount = 0; |
| 1228 | |
| 1229 | switch (type) { |
| 1230 | case wol_gameres_type_int: |
| 1231 | case wol_gameres_type_time: |
| 1232 | playercount = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1233 | DEBUG1("Player count {} ", playercount); |
| 1234 | break; |
| 1235 | default: |
| 1236 | WARN1("got unknown gameres type {} for PLRS", static_cast<int>(type)); |
| 1237 | break; |
| 1238 | } |
| 1239 | return 0; |
| 1240 | } |
| 1241 | |
| 1242 | static int _client_spid(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1243 | { |
| 1244 | int spid = -1; |
| 1245 | |
| 1246 | switch (type) { |
| 1247 | case wol_gameres_type_int: |
| 1248 | spid = (int)bn_int_nget(*((bn_int *)data)); |
| 1249 | break; |
| 1250 | default: |
| 1251 | WARN1("got unknown gameres type {} for SPID", static_cast<int>(type)); |
| 1252 | break; |
| 1253 | } |
| 1254 | |
| 1255 | if (spid != -1) { |
| 1256 | DEBUG1("Setting sender ID to {}", spid); |
| 1257 | game_result->senderid = spid; |
| 1258 | } |
| 1259 | |
| 1260 | return 0; |
| 1261 | } |
| 1262 | |
| 1263 | static int _client_time(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1264 | { |
| 1265 | /* PELISH: Time when was game started. This time is WOL STARTG packet time +-2 sec */ |
| 1266 | std::time_t time; |
| 1267 | |
| 1268 | switch (type) { |
| 1269 | case wol_gameres_type_string: |
| 1270 | DEBUG1("Game was start at {} ", (char *)data); |
| 1271 | break; |
| 1272 | case wol_gameres_type_time: |
| 1273 | time = (std::time_t) bn_int_nget(*((bn_int *)data)); |
| 1274 | DEBUG1("Game was start at {} ", ctime(&time)); |
| 1275 | break; |
| 1276 | default: |
| 1277 | WARN1("got unknown gameres type {} for TIME", static_cast<int>(type)); |
| 1278 | break; |
| 1279 | } |
| 1280 | return 0; |
| 1281 | } |
| 1282 | |
| 1283 | static int _client_afps(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1284 | { |
| 1285 | unsigned int afps; |
| 1286 | |
| 1287 | switch (type) { |
| 1288 | case wol_gameres_type_int: |
| 1289 | afps = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1290 | DEBUG1("Average Frames per Second {} ", afps); |
| 1291 | break; |
| 1292 | default: |
| 1293 | WARN1("got unknown gameres type {} for AFPS", static_cast<int>(type)); |
| 1294 | break; |
| 1295 | } |
| 1296 | return 0; |
| 1297 | } |
| 1298 | |
| 1299 | static int _client_proc(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1300 | { |
| 1301 | switch (type) { |
| 1302 | case wol_gameres_type_string: |
| 1303 | DEBUG1("Procesor {}", (char *)data); |
| 1304 | break; |
| 1305 | default: |
| 1306 | WARN1("got unknown gameres type {} for PROC", static_cast<int>(type)); |
| 1307 | break; |
| 1308 | } |
| 1309 | return 0; |
| 1310 | } |
| 1311 | |
| 1312 | static int _client_memo(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1313 | { |
| 1314 | /* Not implemented yet */ |
| 1315 | return 0; |
| 1316 | } |
| 1317 | |
| 1318 | static int _client_vidm(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1319 | { |
| 1320 | /* Not implemented yet */ |
| 1321 | return 0; |
| 1322 | } |
| 1323 | |
| 1324 | static int _client_sped(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1325 | { |
| 1326 | unsigned int speed; |
| 1327 | |
| 1328 | //SPED 00 01 00 01 [00 00 00 00] |
| 1329 | |
| 1330 | if (type == wol_gameres_type_byte) { |
| 1331 | speed = (unsigned int)bn_byte_get(*((bn_byte *)data)); |
| 1332 | } |
| 1333 | else if (type == wol_gameres_type_int) { |
| 1334 | speed = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1335 | } |
| 1336 | else { |
| 1337 | WARN1("got unknown gameres type {} for SPED", static_cast<int>(type)); |
| 1338 | return 0; |
| 1339 | } |
| 1340 | |
| 1341 | DEBUG1("Game speed {}", speed); |
| 1342 | return 0; |
| 1343 | } |
| 1344 | |
| 1345 | static int _client_vers(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1346 | { |
| 1347 | unsigned int version; |
| 1348 | |
| 1349 | if (type == wol_gameres_type_string) { |
| 1350 | DEBUG1("Version of client {}", (char *)data); |
| 1351 | } |
| 1352 | else if (type == wol_gameres_type_int) { |
| 1353 | version = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1354 | DEBUG1("Version of client {}", version); |
| 1355 | } |
| 1356 | else |
| 1357 | WARN1("got unknown gameres type {} for VERS", static_cast<int>(type)); |
| 1358 | |
| 1359 | return 0; |
| 1360 | } |
| 1361 | |
| 1362 | static int _client_date(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1363 | { |
| 1364 | //WOLv1: DATE 00 14 00 08 52 11 ea 00 01 c5 cd a9 |
| 1365 | |
| 1366 | switch (type) { |
| 1367 | case wol_gameres_type_string: |
| 1368 | DEBUG1("Date {}", (char *)data); |
| 1369 | break; |
| 1370 | default: |
| 1371 | WARN1("got unknown gameres type {} for DATE", static_cast<int>(type)); |
| 1372 | break; |
| 1373 | } |
| 1374 | return 0; |
| 1375 | } |
| 1376 | |
| 1377 | static int _client_base(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1378 | { |
| 1379 | bool bases; |
| 1380 | |
| 1381 | //WOLv1 BASE 00 07 00 03 ON |
| 1382 | |
| 1383 | switch (type) { |
| 1384 | case wol_gameres_type_bool: |
| 1385 | bases = (bool)bn_byte_get(*((bn_byte *)data)); |
| 1386 | break; |
| 1387 | case wol_gameres_type_string: |
| 1388 | if (std::strcmp("ON", (const char *)data) == 0) |
| 1389 | bases = true; |
| 1390 | else if (std::strcmp("OFF", (const char *)data) == 0) |
| 1391 | bases = false; |
| 1392 | else { |
| 1393 | WARN1("got unknown string for BASE: {}", (char *)data); |
| 1394 | bases = false; |
| 1395 | } |
| 1396 | break; |
| 1397 | default: |
| 1398 | WARN1("got unknown gameres type {} for BASE", static_cast<int>(type)); |
| 1399 | break; |
| 1400 | } |
| 1401 | |
| 1402 | if (bases) |
| 1403 | DEBUG0("Game has bases ON"); |
| 1404 | else |
| 1405 | DEBUG0("Game has bases OFF"); |
| 1406 | |
| 1407 | return 0; |
| 1408 | } |
| 1409 | |
| 1410 | static int _client_tibr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1411 | { |
| 1412 | bool tiberium; |
| 1413 | |
| 1414 | if (type == wol_gameres_type_bool) { |
| 1415 | tiberium = (bool)bn_byte_get(*((bn_byte *)data)); |
| 1416 | if (tiberium) |
| 1417 | DEBUG0("Game has tiberium ON"); |
| 1418 | else |
| 1419 | DEBUG0("Game has tiberium OFF"); |
| 1420 | } |
| 1421 | else if (type == wol_gameres_type_string) { |
| 1422 | DEBUG1("Game has tiberium {}", (char *)data); |
| 1423 | } |
| 1424 | else |
| 1425 | WARN1("got unknown gameres type {} for TIBR", static_cast<int>(type)); |
| 1426 | |
| 1427 | return 0; |
| 1428 | } |
| 1429 | |
| 1430 | static int _client_shad(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1431 | { |
| 1432 | bool shadows; |
| 1433 | |
| 1434 | switch (type) { |
| 1435 | case wol_gameres_type_bool: |
| 1436 | shadows = (bool)bn_byte_get(*((bn_byte *)data)); |
| 1437 | break; |
| 1438 | case wol_gameres_type_string: |
| 1439 | if (std::strcmp("ON", (const char *)data) == 0) |
| 1440 | shadows = true; |
| 1441 | else if (std::strcmp("OFF", (const char *)data) == 0) |
| 1442 | shadows = false; |
| 1443 | else { |
| 1444 | WARN1("got unknown string for SHAD: {}", (char *)data); |
| 1445 | shadows = false; |
| 1446 | } |
| 1447 | break; |
| 1448 | default: |
| 1449 | WARN1("got unknown gameres type {} for SHAD", static_cast<int>(type)); |
| 1450 | break; |
| 1451 | } |
| 1452 | |
| 1453 | if (shadows) |
| 1454 | DEBUG0("Game has shadows ON"); |
| 1455 | else |
| 1456 | DEBUG0("Game has shadows OFF"); |
| 1457 | |
| 1458 | return 0; |
| 1459 | } |
| 1460 | |
| 1461 | static int _client_flag(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1462 | { |
| 1463 | bool captureflag; |
| 1464 | |
| 1465 | switch (type) { |
| 1466 | case wol_gameres_type_bool: |
| 1467 | captureflag = (bool)bn_byte_get(*((bn_byte *)data)); |
| 1468 | break; |
| 1469 | case wol_gameres_type_string: |
| 1470 | if (std::strcmp("ON", (const char *)data) == 0) |
| 1471 | captureflag = true; |
| 1472 | else if (std::strcmp("OFF", (const char *)data) == 0) |
| 1473 | captureflag = false; |
| 1474 | else { |
| 1475 | WARN1("got unknown string for FLAG: {}", (char *)data); |
| 1476 | captureflag = false; |
| 1477 | } |
| 1478 | break; |
| 1479 | default: |
| 1480 | WARN1("got unknown gameres type {} for FLAG", static_cast<int>(type)); |
| 1481 | return -1; |
| 1482 | } |
| 1483 | |
| 1484 | if (captureflag) |
| 1485 | DEBUG0("Game has capture the flag ON"); |
| 1486 | else |
| 1487 | DEBUG0("Game has capture the flag OFF"); |
| 1488 | |
| 1489 | return 0; |
| 1490 | |
| 1491 | } |
| 1492 | |
| 1493 | static int _client_tech(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1494 | { |
| 1495 | unsigned int techlevel; |
| 1496 | |
| 1497 | if (type == wol_gameres_type_int) { |
| 1498 | techlevel = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1499 | DEBUG1("Game has techlevel {}", techlevel); |
| 1500 | } |
| 1501 | else |
| 1502 | WARN1("got unknown gameres type {} for TECH", static_cast<int>(type)); |
| 1503 | |
| 1504 | return 0; |
| 1505 | } |
| 1506 | |
| 1507 | static int _client_brok(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1508 | { |
| 1509 | unsigned int brok; |
| 1510 | |
| 1511 | /* This tag sends YURI */ |
| 1512 | //BROK 00 06 00 04 00 00 00 02 |
| 1513 | |
| 1514 | if (type == wol_gameres_type_int) { |
| 1515 | brok = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1516 | DEBUG1("Game has BROK {}", brok); |
| 1517 | } |
| 1518 | else |
| 1519 | WARN1("got unknown gameres type {} for BROK", static_cast<int>(type)); |
| 1520 | |
| 1521 | return 0; |
| 1522 | } |
| 1523 | |
| 1524 | static int _client_acco(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1525 | { |
| 1526 | unsigned int acco; |
| 1527 | |
| 1528 | /* This tag sends YURI */ |
| 1529 | |
| 1530 | switch (type) { |
| 1531 | case wol_gameres_type_int: |
| 1532 | acco = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1533 | DEBUG1("Game has ACCO {}", acco); |
| 1534 | break; |
| 1535 | default: |
| 1536 | WARN1("got unknown gameres type {} for ACCO", static_cast<int>(type)); |
| 1537 | break; |
| 1538 | } |
| 1539 | |
| 1540 | return 0; |
| 1541 | } |
| 1542 | |
| 1543 | static int _client_etim(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1544 | { |
| 1545 | /* This tag sends RNGD only */ |
| 1546 | |
| 1547 | /* Elapsed time??? this tag got unknown data type 0x0014 */ |
| 1548 | |
| 1549 | return 0; |
| 1550 | } |
| 1551 | |
| 1552 | static int _client_pspd(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1553 | { |
| 1554 | /* This tag sends RNGD only */ |
| 1555 | unsigned int procesorspeed; |
| 1556 | |
| 1557 | switch (type) { |
| 1558 | case wol_gameres_type_int: |
| 1559 | procesorspeed = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1560 | DEBUG1("Server have processor speed: {} MHz", procesorspeed); |
| 1561 | break; |
| 1562 | default: |
| 1563 | WARN1("got unknown gameres type {} for PSPD", static_cast<int>(type)); |
| 1564 | break; |
| 1565 | } |
| 1566 | return 0; |
| 1567 | } |
| 1568 | |
| 1569 | static int _client_smem(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1570 | { |
| 1571 | /* This tag sends RNGD only */ |
| 1572 | unsigned int servermemory; |
| 1573 | |
| 1574 | switch (type) { |
| 1575 | case wol_gameres_type_int: |
| 1576 | servermemory = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1577 | DEBUG1("Server have {} memory", servermemory); |
| 1578 | break; |
| 1579 | default: |
| 1580 | WARN1("got unknown gameres type {} for SMEM", static_cast<int>(type)); |
| 1581 | break; |
| 1582 | } |
| 1583 | return 0; |
| 1584 | } |
| 1585 | |
| 1586 | static int _client_svid(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1587 | { |
| 1588 | /* This tag sends RNGD only */ |
| 1589 | |
| 1590 | /* Server ID ??? this tag got unknown data type 0x0014 */ |
| 1591 | |
| 1592 | return 0; |
| 1593 | } |
| 1594 | |
| 1595 | static int _client_snam(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1596 | { |
| 1597 | /* This tag sends RNGD only */ |
| 1598 | |
| 1599 | switch (type) { |
| 1600 | case wol_gameres_type_string: |
| 1601 | DEBUG1("Server name: {}", (char *)data); |
| 1602 | break; |
| 1603 | default: |
| 1604 | WARN1("got unknown gameres type {} for SNAM", static_cast<int>(type)); |
| 1605 | break; |
| 1606 | } |
| 1607 | return 0; |
| 1608 | } |
| 1609 | |
| 1610 | static int _client_gmap(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1611 | { |
| 1612 | /* This tag sends RNGD only */ |
| 1613 | |
| 1614 | switch (type) { |
| 1615 | case wol_gameres_type_string: |
| 1616 | DEBUG1("Game map: {}", (char *)data); |
| 1617 | break; |
| 1618 | default: |
| 1619 | WARN1("got unknown gameres type {} for GMAP", static_cast<int>(type)); |
| 1620 | break; |
| 1621 | } |
| 1622 | return 0; |
| 1623 | } |
| 1624 | |
| 1625 | static int _client_dsvr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1626 | { |
| 1627 | /* This tag sends RNGD only */ |
| 1628 | unsigned int dsvr; |
| 1629 | |
| 1630 | switch (type) { |
| 1631 | case wol_gameres_type_byte: |
| 1632 | dsvr = (unsigned int)bn_byte_get(*((bn_byte *)data)); |
| 1633 | DEBUG1("DSVR: {}", dsvr); |
| 1634 | break; |
| 1635 | default: |
| 1636 | WARN1("got unknown gameres type {} for SCEN", static_cast<int>(type)); |
| 1637 | break; |
| 1638 | } |
| 1639 | return 0; |
| 1640 | } |
| 1641 | |
| 1642 | |
| 1643 | /* Renegade player tag handlers */ |
| 1644 | static int _client_pnam(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1645 | { |
| 1646 | switch (type) { |
| 1647 | case wol_gameres_type_string: |
| 1648 | DEBUG1("Player name: {}", (char *)data); |
| 1649 | break; |
| 1650 | default: |
| 1651 | WARN1("got unknown gameres type {} for PNAM", static_cast<int>(type)); |
| 1652 | break; |
| 1653 | } |
| 1654 | return 0; |
| 1655 | } |
| 1656 | |
| 1657 | static int _client_ploc(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1658 | { |
| 1659 | unsigned int playerloc; |
| 1660 | |
| 1661 | switch (type) { |
| 1662 | case wol_gameres_type_int: |
| 1663 | playerloc = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1664 | DEBUG1("Player locale: {}", playerloc); |
| 1665 | break; |
| 1666 | default: |
| 1667 | WARN1("got unknown gameres type {} for PLOC", static_cast<int>(type)); |
| 1668 | break; |
| 1669 | } |
| 1670 | return 0; |
| 1671 | } |
| 1672 | |
| 1673 | static int _client_team(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1674 | { |
| 1675 | unsigned int team; |
| 1676 | |
| 1677 | switch (type) { |
| 1678 | case wol_gameres_type_int: |
| 1679 | team = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1680 | DEBUG1("Team: {}", team); |
| 1681 | break; |
| 1682 | default: |
| 1683 | WARN1("got unknown gameres type {} for TEAM", static_cast<int>(type)); |
| 1684 | break; |
| 1685 | } |
| 1686 | return 0; |
| 1687 | } |
| 1688 | |
| 1689 | static int _client_pscr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1690 | { |
| 1691 | unsigned int score; |
| 1692 | |
| 1693 | switch (type) { |
| 1694 | case wol_gameres_type_int: |
| 1695 | score = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1696 | DEBUG1("Players score: {}", score); |
| 1697 | break; |
| 1698 | default: |
| 1699 | WARN1("got unknown gameres type {} for PSCR", static_cast<int>(type)); |
| 1700 | break; |
| 1701 | } |
| 1702 | return 0; |
| 1703 | } |
| 1704 | |
| 1705 | static int _client_ppts(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1706 | { |
| 1707 | unsigned int points; |
| 1708 | |
| 1709 | switch (type) { |
| 1710 | case wol_gameres_type_time: /* PELISH: THIS is not a BUG! This is Renegade developers bug */ |
| 1711 | points = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1712 | DEBUG1("Points {}", points); |
| 1713 | break; |
| 1714 | default: |
| 1715 | WARN1("got unknown gameres type {} for PPTS", static_cast<int>(type)); |
| 1716 | break; |
| 1717 | } |
| 1718 | return 0; |
| 1719 | } |
| 1720 | |
| 1721 | static int _client_ptim(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1722 | { |
| 1723 | unsigned int playertime; |
| 1724 | |
| 1725 | switch (type) { |
| 1726 | case wol_gameres_type_int: |
| 1727 | playertime = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1728 | DEBUG1("Player game time {}", playertime); |
| 1729 | break; |
| 1730 | default: |
| 1731 | WARN1("got unknown gameres type {} for PTIM", static_cast<int>(type)); |
| 1732 | break; |
| 1733 | } |
| 1734 | return 0; |
| 1735 | } |
| 1736 | |
| 1737 | static int _client_phlt(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1738 | { |
| 1739 | unsigned int health; |
| 1740 | |
| 1741 | switch (type) { |
| 1742 | case wol_gameres_type_int: |
| 1743 | health = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1744 | DEBUG1("Health: {}", health); |
| 1745 | break; |
| 1746 | default: |
| 1747 | WARN1("got unknown gameres type {} for PHLT", static_cast<int>(type)); |
| 1748 | break; |
| 1749 | } |
| 1750 | return 0; |
| 1751 | } |
| 1752 | |
| 1753 | static int _client_pkil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1754 | { |
| 1755 | unsigned int kills; |
| 1756 | |
| 1757 | switch (type) { |
| 1758 | case wol_gameres_type_int: |
| 1759 | kills = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1760 | DEBUG1("Kills: {}", kills); |
| 1761 | break; |
| 1762 | default: |
| 1763 | WARN1("got unknown gameres type {} for PKIL", static_cast<int>(type)); |
| 1764 | break; |
| 1765 | } |
| 1766 | return 0; |
| 1767 | } |
| 1768 | |
| 1769 | static int _client_ekil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1770 | { |
| 1771 | unsigned int enemy_kills; |
| 1772 | |
| 1773 | switch (type) { |
| 1774 | case wol_gameres_type_int: |
| 1775 | enemy_kills = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1776 | DEBUG1("Enemy kills: {}", enemy_kills); |
| 1777 | break; |
| 1778 | default: |
| 1779 | WARN1("got unknown gameres type {} for EKIL", static_cast<int>(type)); |
| 1780 | break; |
| 1781 | } |
| 1782 | return 0; |
| 1783 | } |
| 1784 | |
| 1785 | static int _client_akil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1786 | { |
| 1787 | unsigned int ally_kills; |
| 1788 | |
| 1789 | switch (type) { |
| 1790 | case wol_gameres_type_int: |
| 1791 | ally_kills = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1792 | DEBUG1("Ally kills {}", ally_kills); |
| 1793 | break; |
| 1794 | default: |
| 1795 | WARN1("got unknown gameres type {} for AKIL", static_cast<int>(type)); |
| 1796 | break; |
| 1797 | } |
| 1798 | return 0; |
| 1799 | } |
| 1800 | |
| 1801 | static int _client_shot(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1802 | { |
| 1803 | unsigned int shots; |
| 1804 | |
| 1805 | switch (type) { |
| 1806 | case wol_gameres_type_int: |
| 1807 | shots = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1808 | DEBUG1("Shots {}", shots); |
| 1809 | break; |
| 1810 | default: |
| 1811 | WARN1("got unknown gameres type {} for SHOT", static_cast<int>(type)); |
| 1812 | break; |
| 1813 | } |
| 1814 | return 0; |
| 1815 | } |
| 1816 | |
| 1817 | static int _client_hedf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1818 | { |
| 1819 | unsigned int hedf; |
| 1820 | |
| 1821 | switch (type) { |
| 1822 | case wol_gameres_type_int: |
| 1823 | hedf = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1824 | DEBUG1("hedf {}", hedf); |
| 1825 | break; |
| 1826 | default: |
| 1827 | WARN1("got unknown gameres type {} for HEDF", static_cast<int>(type)); |
| 1828 | break; |
| 1829 | } |
| 1830 | return 0; |
| 1831 | } |
| 1832 | |
| 1833 | static int _client_torf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1834 | { |
| 1835 | unsigned int torf; |
| 1836 | |
| 1837 | switch (type) { |
| 1838 | case wol_gameres_type_int: |
| 1839 | torf = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1840 | DEBUG1("torf {}", torf); |
| 1841 | break; |
| 1842 | default: |
| 1843 | WARN1("got unknown gameres type {} for TORF", static_cast<int>(type)); |
| 1844 | break; |
| 1845 | } |
| 1846 | return 0; |
| 1847 | } |
| 1848 | |
| 1849 | static int _client_armf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1850 | { |
| 1851 | unsigned int armf; |
| 1852 | |
| 1853 | switch (type) { |
| 1854 | case wol_gameres_type_int: |
| 1855 | armf = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1856 | DEBUG1("armf {}", armf); |
| 1857 | break; |
| 1858 | default: |
| 1859 | WARN1("got unknown gameres type {} for ARMF", static_cast<int>(type)); |
| 1860 | break; |
| 1861 | } |
| 1862 | return 0; |
| 1863 | } |
| 1864 | |
| 1865 | static int _client_legf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1866 | { |
| 1867 | unsigned int legf; |
| 1868 | |
| 1869 | switch (type) { |
| 1870 | case wol_gameres_type_int: |
| 1871 | legf = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1872 | DEBUG1("legf {}", legf); |
| 1873 | break; |
| 1874 | default: |
| 1875 | WARN1("got unknown gameres type {} for LEGF", static_cast<int>(type)); |
| 1876 | break; |
| 1877 | } |
| 1878 | return 0; |
| 1879 | } |
| 1880 | |
| 1881 | static int _client_crtf(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1882 | { |
| 1883 | unsigned int crtf; |
| 1884 | |
| 1885 | switch (type) { |
| 1886 | case wol_gameres_type_int: |
| 1887 | crtf = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1888 | DEBUG1("crtf {}", crtf); |
| 1889 | break; |
| 1890 | default: |
| 1891 | WARN1("got unknown gameres type {} for CRTF", static_cast<int>(type)); |
| 1892 | break; |
| 1893 | } |
| 1894 | return 0; |
| 1895 | } |
| 1896 | |
| 1897 | static int _client_pups(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1898 | { |
| 1899 | unsigned int pups; |
| 1900 | |
| 1901 | switch (type) { |
| 1902 | case wol_gameres_type_int: |
| 1903 | pups = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1904 | DEBUG1("pups {}", pups); |
| 1905 | break; |
| 1906 | default: |
| 1907 | WARN1("got unknown gameres type {} for PUPS", static_cast<int>(type)); |
| 1908 | break; |
| 1909 | } |
| 1910 | return 0; |
| 1911 | } |
| 1912 | |
| 1913 | static int _client_vkil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1914 | { |
| 1915 | unsigned int victory_kills; |
| 1916 | |
| 1917 | switch (type) { |
| 1918 | case wol_gameres_type_int: |
| 1919 | victory_kills = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1920 | DEBUG1("Victory kills {}", victory_kills); |
| 1921 | break; |
| 1922 | default: |
| 1923 | WARN1("got unknown gameres type {} for VKIL", static_cast<int>(type)); |
| 1924 | break; |
| 1925 | } |
| 1926 | return 0; |
| 1927 | } |
| 1928 | |
| 1929 | static int _client_vtim(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1930 | { |
| 1931 | unsigned int victory_time; |
| 1932 | |
| 1933 | switch (type) { |
| 1934 | case wol_gameres_type_int: |
| 1935 | victory_time = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1936 | DEBUG1("Victory time {}", victory_time); |
| 1937 | break; |
| 1938 | default: |
| 1939 | WARN1("got unknown gameres type {} for VTIM", static_cast<int>(type)); |
| 1940 | break; |
| 1941 | } |
| 1942 | return 0; |
| 1943 | } |
| 1944 | |
| 1945 | static int _client_nkfv(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1946 | { |
| 1947 | unsigned int nkfv; |
| 1948 | |
| 1949 | switch (type) { |
| 1950 | case wol_gameres_type_int: |
| 1951 | nkfv = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1952 | DEBUG1("nkfv {}", nkfv); |
| 1953 | break; |
| 1954 | default: |
| 1955 | WARN1("got unknown gameres type {} for NKFV", static_cast<int>(type)); |
| 1956 | break; |
| 1957 | } |
| 1958 | return 0; |
| 1959 | } |
| 1960 | |
| 1961 | static int _client_squi(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1962 | { |
| 1963 | unsigned int squi; |
| 1964 | |
| 1965 | switch (type) { |
| 1966 | case wol_gameres_type_int: |
| 1967 | squi = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1968 | DEBUG1("squi {}", squi); |
| 1969 | break; |
| 1970 | default: |
| 1971 | WARN1("got unknown gameres type {} for SQUI", static_cast<int>(type)); |
| 1972 | break; |
| 1973 | } |
| 1974 | return 0; |
| 1975 | } |
| 1976 | |
| 1977 | static int _client_pcrd(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1978 | { |
| 1979 | unsigned int pcrd; |
| 1980 | |
| 1981 | switch (type) { |
| 1982 | case wol_gameres_type_int: |
| 1983 | pcrd = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 1984 | DEBUG1("pcrd {}", pcrd); |
| 1985 | break; |
| 1986 | default: |
| 1987 | WARN1("got unknown gameres type {} for PCRD", static_cast<int>(type)); |
| 1988 | break; |
| 1989 | } |
| 1990 | return 0; |
| 1991 | } |
| 1992 | |
| 1993 | static int _client_bkil(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 1994 | { |
| 1995 | unsigned int bkil; |
| 1996 | |
| 1997 | switch (type) { |
| 1998 | case wol_gameres_type_int: |
| 1999 | bkil = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2000 | DEBUG1("bkil {}", bkil); |
| 2001 | break; |
| 2002 | default: |
| 2003 | WARN1("got unknown gameres type {} for BKIL", static_cast<int>(type)); |
| 2004 | break; |
| 2005 | } |
| 2006 | return 0; |
| 2007 | } |
| 2008 | |
| 2009 | static int _client_hedr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2010 | { |
| 2011 | unsigned int hedr; |
| 2012 | |
| 2013 | switch (type) { |
| 2014 | case wol_gameres_type_int: |
| 2015 | hedr = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2016 | DEBUG1("hedr {}", hedr); |
| 2017 | break; |
| 2018 | default: |
| 2019 | WARN1("got unknown gameres type {} for HEDR", static_cast<int>(type)); |
| 2020 | break; |
| 2021 | } |
| 2022 | return 0; |
| 2023 | } |
| 2024 | |
| 2025 | static int _client_torr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2026 | { |
| 2027 | unsigned int torr; |
| 2028 | |
| 2029 | switch (type) { |
| 2030 | case wol_gameres_type_int: |
| 2031 | torr = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2032 | DEBUG1("torr {}", torr); |
| 2033 | break; |
| 2034 | default: |
| 2035 | WARN1("got unknown gameres type {} for TORR", static_cast<int>(type)); |
| 2036 | break; |
| 2037 | } |
| 2038 | return 0; |
| 2039 | } |
| 2040 | |
| 2041 | static int _client_armr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2042 | { |
| 2043 | unsigned int armr; |
| 2044 | |
| 2045 | switch (type) { |
| 2046 | case wol_gameres_type_int: |
| 2047 | armr = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2048 | DEBUG1("armr {}", armr); |
| 2049 | break; |
| 2050 | default: |
| 2051 | WARN1("got unknown gameres type {} for ARMR", static_cast<int>(type)); |
| 2052 | break; |
| 2053 | } |
| 2054 | return 0; |
| 2055 | } |
| 2056 | |
| 2057 | static int _client_legr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2058 | { |
| 2059 | unsigned int legr; |
| 2060 | |
| 2061 | switch (type) { |
| 2062 | case wol_gameres_type_int: |
| 2063 | legr = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2064 | DEBUG1("legr {}", legr); |
| 2065 | break; |
| 2066 | default: |
| 2067 | WARN1("got unknown gameres type {} for LEGR", static_cast<int>(type)); |
| 2068 | break; |
| 2069 | } |
| 2070 | return 0; |
| 2071 | } |
| 2072 | |
| 2073 | static int _client_crtr(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2074 | { |
| 2075 | unsigned int crtr; |
| 2076 | |
| 2077 | switch (type) { |
| 2078 | case wol_gameres_type_int: |
| 2079 | crtr = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2080 | DEBUG1("crtr {}", crtr); |
| 2081 | break; |
| 2082 | default: |
| 2083 | WARN1("got unknown gameres type {} for CRTR", static_cast<int>(type)); |
| 2084 | break; |
| 2085 | } |
| 2086 | return 0; |
| 2087 | } |
| 2088 | |
| 2089 | static int _client_flgc(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2090 | { |
| 2091 | unsigned int flgc; |
| 2092 | |
| 2093 | switch (type) { |
| 2094 | case wol_gameres_type_int: |
| 2095 | flgc = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2096 | DEBUG1("flgc {}", flgc); |
| 2097 | break; |
| 2098 | default: |
| 2099 | WARN1("got unknown gameres type {} for FLGC", static_cast<int>(type)); |
| 2100 | break; |
| 2101 | } |
| 2102 | return 0; |
| 2103 | } |
| 2104 | |
| 2105 | |
| 2106 | |
| 2107 | /* player related tag handlers */ |
| 2108 | |
| 2109 | static int _cl_nam_general(t_wol_gameres_result * game_result, int num, wol_gameres_type type, int size, void const * data) |
| 2110 | { |
| 2111 | int senderid = game_result->senderid; |
| 2112 | t_account * account = accountlist_find_account((char const *)data); |
| 2113 | |
| 2114 | DEBUG2("Name of player {}: {}", num, static_cast<const char*>(data)); |
| 2115 | |
| 2116 | game_result->otheraccount = account; |
| 2117 | |
| 2118 | if (senderid == num) { |
| 2119 | DEBUG1("Packet was sent by {}", (char *)data); |
| 2120 | game_result->myaccount = account; |
| 2121 | } |
| 2122 | |
| 2123 | return 0; |
| 2124 | } |
| 2125 | |
| 2126 | static int _client_nam0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2127 | { |
| 2128 | return _cl_nam_general(game_result, 0, type, size, data); |
| 2129 | } |
| 2130 | |
| 2131 | static int _client_nam1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2132 | { |
| 2133 | return _cl_nam_general(game_result, 1, type, size, data); |
| 2134 | } |
| 2135 | |
| 2136 | static int _client_nam2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2137 | { |
| 2138 | return _cl_nam_general(game_result, 2, type, size, data); |
| 2139 | } |
| 2140 | |
| 2141 | static int _client_nam3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2142 | { |
| 2143 | return _cl_nam_general(game_result, 3, type, size, data); |
| 2144 | } |
| 2145 | |
| 2146 | static int _client_nam4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2147 | { |
| 2148 | return _cl_nam_general(game_result, 4, type, size, data); |
| 2149 | } |
| 2150 | |
| 2151 | static int _client_nam5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2152 | { |
| 2153 | return _cl_nam_general(game_result, 5, type, size, data); |
| 2154 | } |
| 2155 | |
| 2156 | static int _client_nam6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2157 | { |
| 2158 | return _cl_nam_general(game_result, 6, type, size, data); |
| 2159 | } |
| 2160 | |
| 2161 | static int _client_nam7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2162 | { |
| 2163 | return _cl_nam_general(game_result, 7, type, size, data); |
| 2164 | } |
| 2165 | |
| 2166 | static int _cl_ipa_general(t_wol_gameres_result * game_result, int num, wol_gameres_type type, int size, void const * data) |
| 2167 | { |
| 2168 | unsigned int ipaddress; |
| 2169 | |
| 2170 | switch (type) { |
| 2171 | case wol_gameres_type_int: |
| 2172 | ipaddress = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2173 | DEBUG2("IP address of player{}: {}", num, ipaddress); |
| 2174 | break; |
| 2175 | default: |
| 2176 | WARN2("got unknown gameres type {} for IPA{}", static_cast<int>(type), num); |
| 2177 | break; |
| 2178 | } |
| 2179 | return 0; |
| 2180 | } |
| 2181 | |
| 2182 | static int _client_ipa0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2183 | { |
| 2184 | return _cl_ipa_general(game_result, 0, type, size, data); |
| 2185 | } |
| 2186 | |
| 2187 | static int _client_ipa1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2188 | { |
| 2189 | return _cl_ipa_general(game_result, 1, type, size, data); |
| 2190 | } |
| 2191 | |
| 2192 | static int _client_ipa2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2193 | { |
| 2194 | return _cl_ipa_general(game_result, 2, type, size, data); |
| 2195 | } |
| 2196 | |
| 2197 | static int _client_ipa3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2198 | { |
| 2199 | return _cl_ipa_general(game_result, 3, type, size, data); |
| 2200 | } |
| 2201 | |
| 2202 | static int _client_ipa4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2203 | { |
| 2204 | return _cl_ipa_general(game_result, 4, type, size, data); |
| 2205 | } |
| 2206 | |
| 2207 | static int _client_ipa5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2208 | { |
| 2209 | return _cl_ipa_general(game_result, 5, type, size, data); |
| 2210 | } |
| 2211 | |
| 2212 | static int _client_ipa6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2213 | { |
| 2214 | return _cl_ipa_general(game_result, 6, type, size, data); |
| 2215 | } |
| 2216 | |
| 2217 | static int _client_ipa7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2218 | { |
| 2219 | return _cl_ipa_general(game_result, 7, type, size, data); |
| 2220 | } |
| 2221 | |
| 2222 | static int _cl_cid_general(t_wol_gameres_result * game_result, int num, wol_gameres_type type, int size, void const * data) |
| 2223 | { |
| 2224 | unsigned int clanid; |
| 2225 | |
| 2226 | switch (type) { |
| 2227 | case wol_gameres_type_int: |
| 2228 | clanid = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2229 | DEBUG2("Clan ID of player{}: {}", num, clanid); |
| 2230 | break; |
| 2231 | default: |
| 2232 | WARN2("got unknown gameres type {} for CID{}", static_cast<int>(type), num); |
| 2233 | break; |
| 2234 | } |
| 2235 | return 0; |
| 2236 | } |
| 2237 | |
| 2238 | static int _client_cid0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2239 | { |
| 2240 | return _cl_cid_general(game_result, 0, type, size, data); |
| 2241 | } |
| 2242 | |
| 2243 | static int _client_cid1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2244 | { |
| 2245 | return _cl_cid_general(game_result, 1, type, size, data); |
| 2246 | } |
| 2247 | |
| 2248 | static int _client_cid2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2249 | { |
| 2250 | return _cl_cid_general(game_result, 2, type, size, data); |
| 2251 | } |
| 2252 | |
| 2253 | static int _client_cid3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2254 | { |
| 2255 | return _cl_cid_general(game_result, 3, type, size, data); |
| 2256 | } |
| 2257 | |
| 2258 | static int _client_cid4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2259 | { |
| 2260 | return _cl_cid_general(game_result, 4, type, size, data); |
| 2261 | } |
| 2262 | |
| 2263 | static int _client_cid5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2264 | { |
| 2265 | return _cl_cid_general(game_result, 5, type, size, data); |
| 2266 | } |
| 2267 | |
| 2268 | static int _client_cid6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2269 | { |
| 2270 | return _cl_cid_general(game_result, 6, type, size, data); |
| 2271 | } |
| 2272 | |
| 2273 | static int _client_cid7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2274 | { |
| 2275 | return _cl_cid_general(game_result, 7, type, size, data); |
| 2276 | } |
| 2277 | |
| 2278 | static int _cl_sid_general(t_wol_gameres_result * game_result, int num, wol_gameres_type type, int size, void const * data) |
| 2279 | { |
| 2280 | unsigned int sideid; |
| 2281 | |
| 2282 | switch (type) { |
| 2283 | case wol_gameres_type_int: |
| 2284 | sideid = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2285 | DEBUG2("Side ID of player{}: {}", num, sideid); |
| 2286 | break; |
| 2287 | default: |
| 2288 | WARN2("got unknown gameres type {} for SID{}", static_cast<int>(type), num); |
| 2289 | break; |
| 2290 | } |
| 2291 | return 0; |
| 2292 | } |
| 2293 | |
| 2294 | static int _client_sid0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2295 | { |
| 2296 | return _cl_sid_general(game_result, 0, type, size, data); |
| 2297 | } |
| 2298 | |
| 2299 | static int _client_sid1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2300 | { |
| 2301 | return _cl_sid_general(game_result, 1, type, size, data); |
| 2302 | } |
| 2303 | |
| 2304 | static int _client_sid2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2305 | { |
| 2306 | return _cl_sid_general(game_result, 2, type, size, data); |
| 2307 | } |
| 2308 | |
| 2309 | static int _client_sid3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2310 | { |
| 2311 | return _cl_sid_general(game_result, 3, type, size, data); |
| 2312 | } |
| 2313 | |
| 2314 | static int _client_sid4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2315 | { |
| 2316 | return _cl_sid_general(game_result, 4, type, size, data); |
| 2317 | } |
| 2318 | |
| 2319 | static int _client_sid5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2320 | { |
| 2321 | return _cl_sid_general(game_result, 5, type, size, data); |
| 2322 | } |
| 2323 | |
| 2324 | static int _client_sid6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2325 | { |
| 2326 | return _cl_sid_general(game_result, 6, type, size, data); |
| 2327 | } |
| 2328 | |
| 2329 | static int _client_sid7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2330 | { |
| 2331 | return _cl_sid_general(game_result, 7, type, size, data); |
| 2332 | } |
| 2333 | |
| 2334 | static int _cl_tid_general(t_wol_gameres_result * game_result, int num, wol_gameres_type type, int size, void const * data) |
| 2335 | { |
| 2336 | unsigned int teamid; |
| 2337 | |
| 2338 | switch (type) { |
| 2339 | case wol_gameres_type_int: |
| 2340 | teamid = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2341 | DEBUG2("Team ID of player{}: {}", num, teamid); |
| 2342 | break; |
| 2343 | default: |
| 2344 | WARN2("got unknown gameres type {} for TID{}", static_cast<int>(type), num); |
| 2345 | break; |
| 2346 | } |
| 2347 | return 0; |
| 2348 | } |
| 2349 | |
| 2350 | static int _client_tid0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2351 | { |
| 2352 | return _cl_tid_general(game_result, 0, type, size, data); |
| 2353 | } |
| 2354 | |
| 2355 | static int _client_tid1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2356 | { |
| 2357 | return _cl_tid_general(game_result, 1, type, size, data); |
| 2358 | } |
| 2359 | |
| 2360 | static int _client_tid2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2361 | { |
| 2362 | return _cl_tid_general(game_result, 2, type, size, data); |
| 2363 | } |
| 2364 | |
| 2365 | static int _client_tid3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2366 | { |
| 2367 | return _cl_tid_general(game_result, 3, type, size, data); |
| 2368 | } |
| 2369 | |
| 2370 | static int _client_tid4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2371 | { |
| 2372 | return _cl_tid_general(game_result, 4, type, size, data); |
| 2373 | } |
| 2374 | |
| 2375 | static int _client_tid5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2376 | { |
| 2377 | return _cl_tid_general(game_result, 5, type, size, data); |
| 2378 | } |
| 2379 | |
| 2380 | static int _client_tid6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2381 | { |
| 2382 | return _cl_tid_general(game_result, 6, type, size, data); |
| 2383 | } |
| 2384 | |
| 2385 | static int _client_tid7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2386 | { |
| 2387 | return _cl_tid_general(game_result, 7, type, size, data); |
| 2388 | } |
| 2389 | |
| 2390 | |
| 2391 | static int _cl_cmp_general(t_wol_gameres_result * game_result, int num, wol_gameres_type type, int size, void const * data) |
| 2392 | { |
| 2393 | //CMPx 00 06 00 04 00 00 02 00 |
| 2394 | //0x0100=WIN 0x0200(0x0210)=LOSE 0x0300=DISCONECT |
| 2395 | |
| 2396 | t_account * other_account = game_result->otheraccount; |
| 2397 | t_game * game = game_result->game; |
| 2398 | t_game_result result; |
| 2399 | t_game_result * results = game_result->results; |
| 2400 | int resultnum; |
| 2401 | |
| 2402 | switch (type) { |
| 2403 | case wol_gameres_type_int: |
| 2404 | resultnum = (unsigned int)bn_int_nget(*((bn_int *)data)); |
| 2405 | break; |
| 2406 | default: |
| 2407 | WARN2("got unknown gameres type {} for CMP{}", static_cast<int>(type), num); |
| 2408 | return 0; |
| 2409 | } |
| 2410 | |
| 2411 | DEBUG2("Got {} player resultnum {}", num, resultnum); |
| 2412 | |
| 2413 | resultnum &= 0x0000FF00; |
| 2414 | resultnum = resultnum >> 8; |
| 2415 | |
| 2416 | if ((!game) || (!other_account)) { |
| 2417 | ERROR0("got corrupt gameres packet - game == NULL || other_account == NULL"); |
| 2418 | return 0; |
| 2419 | } |
| 2420 | |
| 2421 | unsigned int i = 0; |
| 2422 | for (; i < game_get_count(game); i++) { |
| 2423 | if (game_get_player(game, i) == other_account) break; |
| 2424 | } |
| 2425 | |
| 2426 | switch (resultnum) { |
| 2427 | case 1: |
| 2428 | DEBUG0("WIN"); |
| 2429 | result = game_result_win; |
| 2430 | break; |
| 2431 | case 2: |
| 2432 | DEBUG0("LOSS"); |
| 2433 | result = game_result_loss; |
| 2434 | break; |
| 2435 | case 3: |
| 2436 | DEBUG0("DISCONECT"); |
| 2437 | result = game_result_disconnect; |
| 2438 | break; |
| 2439 | default: |
| 2440 | DEBUG2("Got wrong {} player resultnum {}", num, resultnum); |
| 2441 | result = game_result_disconnect; |
| 2442 | break; |
| 2443 | } |
| 2444 | |
| 2445 | if (results) { |
| 2446 | results[i] = result; |
| 2447 | game_result->results = results; |
| 2448 | DEBUG0("game result was set"); |
| 2449 | } |
| 2450 | |
| 2451 | return 0; |
| 2452 | } |
| 2453 | |
| 2454 | static int _client_cmp0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2455 | { |
| 2456 | return _cl_cmp_general(game_result, 0, type, size, data); |
| 2457 | } |
| 2458 | |
| 2459 | static int _client_cmp1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2460 | { |
| 2461 | return _cl_cmp_general(game_result, 1, type, size, data); |
| 2462 | } |
| 2463 | |
| 2464 | static int _client_cmp2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2465 | { |
| 2466 | return _cl_cmp_general(game_result, 2, type, size, data); |
| 2467 | } |
| 2468 | |
| 2469 | static int _client_cmp3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2470 | { |
| 2471 | return _cl_cmp_general(game_result, 3, type, size, data); |
| 2472 | } |
| 2473 | |
| 2474 | static int _client_cmp4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2475 | { |
| 2476 | return _cl_cmp_general(game_result, 4, type, size, data); |
| 2477 | } |
| 2478 | |
| 2479 | static int _client_cmp5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2480 | { |
| 2481 | return _cl_cmp_general(game_result, 5, type, size, data); |
| 2482 | } |
| 2483 | |
| 2484 | static int _client_cmp6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2485 | { |
| 2486 | return _cl_cmp_general(game_result, 6, type, size, data); |
| 2487 | } |
| 2488 | |
| 2489 | static int _client_cmp7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2490 | { |
| 2491 | return _cl_cmp_general(game_result, 7, type, size, data); |
| 2492 | } |
| 2493 | |
| 2494 | static int _cl_col_general(int num, wol_gameres_type type, int size, void const * data) |
| 2495 | { |
| 2496 | switch (type) { |
| 2497 | case wol_gameres_type_int: |
| 2498 | DEBUG2("Player {} colour num: {}", num, (unsigned int)bn_int_nget(*((bn_int *)data))); |
| 2499 | break; |
| 2500 | default: |
| 2501 | WARN2("got unknown gameres type {} for COL{}", static_cast<int>(type), num); |
| 2502 | break; |
| 2503 | } |
| 2504 | return 0; |
| 2505 | } |
| 2506 | |
| 2507 | static int _client_col0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2508 | { |
| 2509 | return _cl_col_general(0, type, size, data); |
| 2510 | } |
| 2511 | |
| 2512 | static int _client_col1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2513 | { |
| 2514 | return _cl_col_general(1, type, size, data); |
| 2515 | } |
| 2516 | |
| 2517 | static int _client_col2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2518 | { |
| 2519 | return _cl_col_general(2, type, size, data); |
| 2520 | } |
| 2521 | |
| 2522 | static int _client_col3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2523 | { |
| 2524 | return _cl_col_general(3, type, size, data); |
| 2525 | } |
| 2526 | |
| 2527 | static int _client_col4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2528 | { |
| 2529 | return _cl_col_general(4, type, size, data); |
| 2530 | } |
| 2531 | |
| 2532 | static int _client_col5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2533 | { |
| 2534 | return _cl_col_general(5, type, size, data); |
| 2535 | } |
| 2536 | |
| 2537 | static int _client_col6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2538 | { |
| 2539 | return _cl_col_general(6, type, size, data); |
| 2540 | } |
| 2541 | |
| 2542 | static int _client_col7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2543 | { |
| 2544 | return _cl_col_general(7, type, size, data); |
| 2545 | } |
| 2546 | |
| 2547 | static int _cl_crd_general(int num, wol_gameres_type type, int size, void const * data) |
| 2548 | { |
| 2549 | switch (type) { |
| 2550 | case wol_gameres_type_time: |
| 2551 | DEBUG2("Player {} had {} credits on end of game", num, (unsigned int)bn_int_nget(*((bn_int *)data))); |
| 2552 | break; |
| 2553 | default: |
| 2554 | WARN2("got unknown gameres type {} for CRD{}", static_cast<int>(type), num); |
| 2555 | break; |
| 2556 | } |
| 2557 | return 0; |
| 2558 | } |
| 2559 | |
| 2560 | static int _client_crd0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2561 | { |
| 2562 | return _cl_crd_general(0, type, size, data); |
| 2563 | } |
| 2564 | |
| 2565 | static int _client_crd1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2566 | { |
| 2567 | return _cl_crd_general(1, type, size, data); |
| 2568 | } |
| 2569 | |
| 2570 | static int _client_crd2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2571 | { |
| 2572 | return _cl_crd_general(2, type, size, data); |
| 2573 | } |
| 2574 | |
| 2575 | static int _client_crd3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2576 | { |
| 2577 | return _cl_crd_general(3, type, size, data); |
| 2578 | } |
| 2579 | |
| 2580 | static int _client_crd4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2581 | { |
| 2582 | return _cl_crd_general(4, type, size, data); |
| 2583 | } |
| 2584 | |
| 2585 | static int _client_crd5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2586 | { |
| 2587 | return _cl_crd_general(5, type, size, data); |
| 2588 | } |
| 2589 | |
| 2590 | static int _client_crd6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2591 | { |
| 2592 | return _cl_crd_general(6, type, size, data); |
| 2593 | } |
| 2594 | |
| 2595 | static int _client_crd7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2596 | { |
| 2597 | return _cl_crd_general(7, type, size, data); |
| 2598 | } |
| 2599 | |
| 2600 | static int _cl_inb_general(int num, wol_gameres_type type, int size, void const * data) |
| 2601 | { |
| 2602 | switch (type) { |
| 2603 | case wol_gameres_type_time: |
| 2604 | DEBUG2("Player {} build {} infantry", num, bn_int_nget(*((bn_int *)data))); |
| 2605 | break; |
| 2606 | case wol_gameres_type_bigint: |
| 2607 | DEBUG2("Player {} build {} infantry", num, wol_gameres_get_long_from_data(size, data)); |
| 2608 | break; |
| 2609 | default: |
| 2610 | WARN2("got unknown gameres type {} for INB{}", static_cast<int>(type), num); |
| 2611 | break; |
| 2612 | } |
| 2613 | return 0; |
| 2614 | } |
| 2615 | |
| 2616 | static int _client_inb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2617 | { |
| 2618 | return _cl_inb_general(0, type, size, data); |
| 2619 | } |
| 2620 | |
| 2621 | static int _client_inb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2622 | { |
| 2623 | return _cl_inb_general(1, type, size, data); |
| 2624 | } |
| 2625 | |
| 2626 | |
| 2627 | static int _client_inb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2628 | { |
| 2629 | return _cl_inb_general(2, type, size, data); |
| 2630 | } |
| 2631 | |
| 2632 | |
| 2633 | static int _client_inb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2634 | { |
| 2635 | return _cl_inb_general(3, type, size, data); |
| 2636 | } |
| 2637 | |
| 2638 | |
| 2639 | static int _client_inb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2640 | { |
| 2641 | return _cl_inb_general(4, type, size, data); |
| 2642 | } |
| 2643 | |
| 2644 | |
| 2645 | static int _client_inb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2646 | { |
| 2647 | return _cl_inb_general(5, type, size, data); |
| 2648 | } |
| 2649 | |
| 2650 | |
| 2651 | static int _client_inb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2652 | { |
| 2653 | return _cl_inb_general(6, type, size, data); |
| 2654 | } |
| 2655 | |
| 2656 | |
| 2657 | static int _client_inb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2658 | { |
| 2659 | return _cl_inb_general(7, type, size, data); |
| 2660 | } |
| 2661 | |
| 2662 | static int _cl_unb_general(int num, wol_gameres_type type, int size, void const * data) |
| 2663 | { |
| 2664 | switch (type) { |
| 2665 | case wol_gameres_type_time: |
| 2666 | DEBUG2("Player {} build {} units", num, bn_int_nget(*((bn_int *)data))); |
| 2667 | break; |
| 2668 | case wol_gameres_type_bigint: |
| 2669 | DEBUG2("Player {} build {} units", num, wol_gameres_get_long_from_data(size, data)); |
| 2670 | break; |
| 2671 | default: |
| 2672 | WARN2("got unknown gameres type {} for UNB{}", static_cast<int>(type), num); |
| 2673 | break; |
| 2674 | } |
| 2675 | return 0; |
| 2676 | } |
| 2677 | |
| 2678 | static int _client_unb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2679 | { |
| 2680 | return _cl_unb_general(0, type, size, data); |
| 2681 | } |
| 2682 | |
| 2683 | |
| 2684 | static int _client_unb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2685 | { |
| 2686 | return _cl_unb_general(1, type, size, data); |
| 2687 | } |
| 2688 | |
| 2689 | static int _client_unb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2690 | { |
| 2691 | return _cl_unb_general(2, type, size, data); |
| 2692 | } |
| 2693 | |
| 2694 | static int _client_unb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2695 | { |
| 2696 | return _cl_unb_general(3, type, size, data); |
| 2697 | } |
| 2698 | |
| 2699 | static int _client_unb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2700 | { |
| 2701 | return _cl_unb_general(4, type, size, data); |
| 2702 | } |
| 2703 | |
| 2704 | static int _client_unb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2705 | { |
| 2706 | return _cl_unb_general(5, type, size, data); |
| 2707 | } |
| 2708 | |
| 2709 | static int _client_unb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2710 | { |
| 2711 | return _cl_unb_general(6, type, size, data); |
| 2712 | } |
| 2713 | |
| 2714 | static int _client_unb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2715 | { |
| 2716 | return _cl_unb_general(7, type, size, data); |
| 2717 | } |
| 2718 | |
| 2719 | static int _cl_plb_general(int num, wol_gameres_type type, int size, void const * data) |
| 2720 | { |
| 2721 | switch (type) { |
| 2722 | case wol_gameres_type_time: |
| 2723 | DEBUG2("Player {} build {} planes", num, bn_int_nget(*((bn_int *)data))); |
| 2724 | break; |
| 2725 | case wol_gameres_type_bigint: |
| 2726 | DEBUG2("Player {} build {} planes", num, wol_gameres_get_long_from_data(size, data)); |
| 2727 | break; |
| 2728 | default: |
| 2729 | WARN2("got unknown gameres type {} for PLB{}", static_cast<int>(type), num); |
| 2730 | break; |
| 2731 | } |
| 2732 | return 0; |
| 2733 | } |
| 2734 | |
| 2735 | static int _client_plb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2736 | { |
| 2737 | return _cl_plb_general(0, type, size, data); |
| 2738 | } |
| 2739 | |
| 2740 | static int _client_plb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2741 | { |
| 2742 | return _cl_plb_general(1, type, size, data); |
| 2743 | } |
| 2744 | |
| 2745 | static int _client_plb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2746 | { |
| 2747 | return _cl_plb_general(2, type, size, data); |
| 2748 | } |
| 2749 | |
| 2750 | static int _client_plb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2751 | { |
| 2752 | return _cl_plb_general(3, type, size, data); |
| 2753 | } |
| 2754 | |
| 2755 | static int _client_plb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2756 | { |
| 2757 | return _cl_plb_general(4, type, size, data); |
| 2758 | } |
| 2759 | |
| 2760 | static int _client_plb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2761 | { |
| 2762 | return _cl_plb_general(5, type, size, data); |
| 2763 | } |
| 2764 | |
| 2765 | static int _client_plb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2766 | { |
| 2767 | return _cl_plb_general(6, type, size, data); |
| 2768 | } |
| 2769 | |
| 2770 | static int _client_plb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2771 | { |
| 2772 | return _cl_plb_general(7, type, size, data); |
| 2773 | } |
| 2774 | |
| 2775 | static int _cl_blb_general(int num, wol_gameres_type type, int size, void const * data) |
| 2776 | { |
| 2777 | switch (type) { |
| 2778 | case wol_gameres_type_time: |
| 2779 | DEBUG2("Player {} build {} buildings", num, bn_int_nget(*((bn_int *)data))); |
| 2780 | break; |
| 2781 | case wol_gameres_type_bigint: |
| 2782 | DEBUG2("Player {} build {} buildings", num, wol_gameres_get_long_from_data(size, data)); |
| 2783 | break; |
| 2784 | default: |
| 2785 | WARN2("got unknown gameres type {} for BLB{}", static_cast<int>(type), num); |
| 2786 | break; |
| 2787 | } |
| 2788 | return 0; |
| 2789 | } |
| 2790 | |
| 2791 | static int _client_blb0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2792 | { |
| 2793 | return _cl_blb_general(0, type, size, data); |
| 2794 | } |
| 2795 | |
| 2796 | static int _client_blb1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2797 | { |
| 2798 | return _cl_blb_general(1, type, size, data); |
| 2799 | } |
| 2800 | |
| 2801 | static int _client_blb2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2802 | { |
| 2803 | return _cl_blb_general(2, type, size, data); |
| 2804 | } |
| 2805 | |
| 2806 | static int _client_blb3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2807 | { |
| 2808 | return _cl_blb_general(3, type, size, data); |
| 2809 | } |
| 2810 | |
| 2811 | static int _client_blb4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2812 | { |
| 2813 | return _cl_blb_general(4, type, size, data); |
| 2814 | } |
| 2815 | |
| 2816 | static int _client_blb5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2817 | { |
| 2818 | return _cl_blb_general(5, type, size, data); |
| 2819 | } |
| 2820 | |
| 2821 | static int _client_blb6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2822 | { |
| 2823 | return _cl_blb_general(6, type, size, data); |
| 2824 | } |
| 2825 | |
| 2826 | static int _client_blb7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2827 | { |
| 2828 | return _cl_blb_general(7, type, size, data); |
| 2829 | } |
| 2830 | |
| 2831 | static int _cl_inl_general(int num, wol_gameres_type type, int size, void const * data) |
| 2832 | { |
| 2833 | switch (type) { |
| 2834 | case wol_gameres_type_time: |
| 2835 | DEBUG2("Player {} lost {} infantry", num, bn_int_nget(*((bn_int *)data))); |
| 2836 | break; |
| 2837 | case wol_gameres_type_bigint: |
| 2838 | DEBUG2("Player {} lost {} infantry", num, wol_gameres_get_long_from_data(size, data)); |
| 2839 | break; |
| 2840 | default: |
| 2841 | WARN2("got unknown gameres type {} for INL{}", static_cast<int>(type), num); |
| 2842 | break; |
| 2843 | } |
| 2844 | return 0; |
| 2845 | } |
| 2846 | |
| 2847 | static int _client_inl0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2848 | { |
| 2849 | return _cl_inl_general(0, type, size, data); |
| 2850 | } |
| 2851 | |
| 2852 | static int _client_inl1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2853 | { |
| 2854 | return _cl_inl_general(1, type, size, data); |
| 2855 | } |
| 2856 | |
| 2857 | static int _client_inl2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2858 | { |
| 2859 | return _cl_inl_general(2, type, size, data); |
| 2860 | } |
| 2861 | |
| 2862 | static int _client_inl3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2863 | { |
| 2864 | return _cl_inl_general(3, type, size, data); |
| 2865 | } |
| 2866 | |
| 2867 | static int _client_inl4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2868 | { |
| 2869 | return _cl_inl_general(4, type, size, data); |
| 2870 | } |
| 2871 | |
| 2872 | static int _client_inl5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2873 | { |
| 2874 | return _cl_inl_general(5, type, size, data); |
| 2875 | } |
| 2876 | |
| 2877 | static int _client_inl6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2878 | { |
| 2879 | return _cl_inl_general(6, type, size, data); |
| 2880 | } |
| 2881 | |
| 2882 | static int _client_inl7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2883 | { |
| 2884 | return _cl_inl_general(7, type, size, data); |
| 2885 | } |
| 2886 | |
| 2887 | static int _cl_unl_general(int num, wol_gameres_type type, int size, void const * data) |
| 2888 | { |
| 2889 | switch (type) { |
| 2890 | case wol_gameres_type_time: |
| 2891 | DEBUG2("Player {} lost {} units", num, bn_int_nget(*((bn_int *)data))); |
| 2892 | break; |
| 2893 | case wol_gameres_type_bigint: |
| 2894 | DEBUG2("Player {} lost {} units", num, wol_gameres_get_long_from_data(size, data)); |
| 2895 | break; |
| 2896 | default: |
| 2897 | WARN2("got unknown gameres type {} for UNL{}", static_cast<int>(type), num); |
| 2898 | break; |
| 2899 | } |
| 2900 | return 0; |
| 2901 | } |
| 2902 | |
| 2903 | static int _client_unl0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2904 | { |
| 2905 | return _cl_unl_general(0, type, size, data); |
| 2906 | } |
| 2907 | |
| 2908 | static int _client_unl1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2909 | { |
| 2910 | return _cl_unl_general(1, type, size, data); |
| 2911 | } |
| 2912 | |
| 2913 | static int _client_unl2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2914 | { |
| 2915 | return _cl_unl_general(2, type, size, data); |
| 2916 | } |
| 2917 | |
| 2918 | static int _client_unl3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2919 | { |
| 2920 | return _cl_unl_general(3, type, size, data); |
| 2921 | } |
| 2922 | |
| 2923 | static int _client_unl4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2924 | { |
| 2925 | return _cl_unl_general(4, type, size, data); |
| 2926 | } |
| 2927 | |
| 2928 | static int _client_unl5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2929 | { |
| 2930 | return _cl_unl_general(5, type, size, data); |
| 2931 | } |
| 2932 | |
| 2933 | static int _client_unl6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2934 | { |
| 2935 | return _cl_unl_general(6, type, size, data); |
| 2936 | } |
| 2937 | |
| 2938 | static int _client_unl7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2939 | { |
| 2940 | return _cl_unl_general(7, type, size, data); |
| 2941 | } |
| 2942 | |
| 2943 | static int _cl_pll_general(int num, wol_gameres_type type, int size, void const * data) |
| 2944 | { |
| 2945 | switch (type) { |
| 2946 | case wol_gameres_type_time: |
| 2947 | DEBUG2("Player {} lost {} planes", num, bn_int_nget(*((bn_int *)data))); |
| 2948 | break; |
| 2949 | case wol_gameres_type_bigint: |
| 2950 | DEBUG2("Player {} lost {} planes", num, wol_gameres_get_long_from_data(size, data)); |
| 2951 | break; |
| 2952 | default: |
| 2953 | WARN2("got unknown gameres type {} for PLL{}", static_cast<int>(type), num); |
| 2954 | break; |
| 2955 | } |
| 2956 | return 0; |
| 2957 | } |
| 2958 | |
| 2959 | static int _client_pll0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2960 | { |
| 2961 | return _cl_pll_general(0, type, size, data); |
| 2962 | } |
| 2963 | |
| 2964 | static int _client_pll1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2965 | { |
| 2966 | return _cl_pll_general(1, type, size, data); |
| 2967 | } |
| 2968 | |
| 2969 | static int _client_pll2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2970 | { |
| 2971 | return _cl_pll_general(2, type, size, data); |
| 2972 | } |
| 2973 | |
| 2974 | static int _client_pll3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2975 | { |
| 2976 | return _cl_pll_general(3, type, size, data); |
| 2977 | } |
| 2978 | |
| 2979 | static int _client_pll4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2980 | { |
| 2981 | return _cl_pll_general(4, type, size, data); |
| 2982 | } |
| 2983 | |
| 2984 | static int _client_pll5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2985 | { |
| 2986 | return _cl_pll_general(5, type, size, data); |
| 2987 | } |
| 2988 | |
| 2989 | static int _client_pll6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2990 | { |
| 2991 | return _cl_pll_general(6, type, size, data); |
| 2992 | } |
| 2993 | |
| 2994 | static int _client_pll7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 2995 | { |
| 2996 | return _cl_pll_general(7, type, size, data); |
| 2997 | } |
| 2998 | |
| 2999 | static int _cl_bll_general(int num, wol_gameres_type type, int size, void const * data) |
| 3000 | { |
| 3001 | switch (type) { |
| 3002 | case wol_gameres_type_time: |
| 3003 | DEBUG2("Player {} lost {} buildings", num, bn_int_nget(*((bn_int *)data))); |
| 3004 | break; |
| 3005 | case wol_gameres_type_bigint: |
| 3006 | DEBUG2("Player {} lost {} buildings", num, wol_gameres_get_long_from_data(size, data)); |
| 3007 | break; |
| 3008 | default: |
| 3009 | WARN2("got unknown gameres type {} for BLL{}", static_cast<int>(type), num); |
| 3010 | break; |
| 3011 | } |
| 3012 | return 0; |
| 3013 | } |
| 3014 | |
| 3015 | static int _client_bll0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3016 | { |
| 3017 | return _cl_bll_general(0, type, size, data); |
| 3018 | } |
| 3019 | |
| 3020 | static int _client_bll1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3021 | { |
| 3022 | return _cl_bll_general(1, type, size, data); |
| 3023 | } |
| 3024 | |
| 3025 | static int _client_bll2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3026 | { |
| 3027 | return _cl_bll_general(2, type, size, data); |
| 3028 | } |
| 3029 | |
| 3030 | static int _client_bll3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3031 | { |
| 3032 | return _cl_bll_general(3, type, size, data); |
| 3033 | } |
| 3034 | |
| 3035 | static int _client_bll4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3036 | { |
| 3037 | return _cl_bll_general(4, type, size, data); |
| 3038 | } |
| 3039 | |
| 3040 | static int _client_bll5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3041 | { |
| 3042 | return _cl_bll_general(5, type, size, data); |
| 3043 | } |
| 3044 | |
| 3045 | static int _client_bll6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3046 | { |
| 3047 | return _cl_bll_general(6, type, size, data); |
| 3048 | } |
| 3049 | |
| 3050 | static int _client_bll7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3051 | { |
| 3052 | return _cl_bll_general(7, type, size, data); |
| 3053 | } |
| 3054 | |
| 3055 | static int _cl_ink_general(int num, wol_gameres_type type, int size, void const * data) |
| 3056 | { |
| 3057 | switch (type) { |
| 3058 | case wol_gameres_type_time: |
| 3059 | DEBUG2("Player {} killed {} infantry", num, bn_int_nget(*((bn_int *)data))); |
| 3060 | break; |
| 3061 | case wol_gameres_type_bigint: |
| 3062 | DEBUG2("Player {} killed {} infantry", num, wol_gameres_get_long_from_data(size, data)); |
| 3063 | break; |
| 3064 | default: |
| 3065 | WARN2("got unknown gameres type {} for INK{}", static_cast<int>(type), num); |
| 3066 | break; |
| 3067 | } |
| 3068 | return 0; |
| 3069 | } |
| 3070 | |
| 3071 | static int _client_ink0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3072 | { |
| 3073 | return _cl_ink_general(0, type, size, data); |
| 3074 | } |
| 3075 | |
| 3076 | static int _client_ink1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3077 | { |
| 3078 | return _cl_ink_general(1, type, size, data); |
| 3079 | } |
| 3080 | |
| 3081 | static int _client_ink2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3082 | { |
| 3083 | return _cl_ink_general(2, type, size, data); |
| 3084 | } |
| 3085 | |
| 3086 | static int _client_ink3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3087 | { |
| 3088 | return _cl_ink_general(3, type, size, data); |
| 3089 | } |
| 3090 | |
| 3091 | static int _client_ink4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3092 | { |
| 3093 | return _cl_ink_general(4, type, size, data); |
| 3094 | } |
| 3095 | |
| 3096 | static int _client_ink5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3097 | { |
| 3098 | return _cl_ink_general(5, type, size, data); |
| 3099 | } |
| 3100 | |
| 3101 | static int _client_ink6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3102 | { |
| 3103 | return _cl_ink_general(6, type, size, data); |
| 3104 | } |
| 3105 | |
| 3106 | static int _client_ink7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3107 | { |
| 3108 | return _cl_ink_general(7, type, size, data); |
| 3109 | } |
| 3110 | |
| 3111 | static int _cl_unk_general(int num, wol_gameres_type type, int size, void const * data) |
| 3112 | { |
| 3113 | switch (type) { |
| 3114 | case wol_gameres_type_time: |
| 3115 | DEBUG2("Player {} killed {} units", num, bn_int_nget(*((bn_int *)data))); |
| 3116 | break; |
| 3117 | case wol_gameres_type_bigint: |
| 3118 | DEBUG2("Player {} killed {} units", num, wol_gameres_get_long_from_data(size, data)); |
| 3119 | break; |
| 3120 | default: |
| 3121 | WARN2("got unknown gameres type {} for UNK{}", static_cast<int>(type), num); |
| 3122 | break; |
| 3123 | } |
| 3124 | return 0; |
| 3125 | } |
| 3126 | |
| 3127 | static int _client_unk0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3128 | { |
| 3129 | return _cl_unk_general(0, type, size, data); |
| 3130 | } |
| 3131 | |
| 3132 | static int _client_unk1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3133 | { |
| 3134 | return _cl_unk_general(1, type, size, data); |
| 3135 | } |
| 3136 | |
| 3137 | static int _client_unk2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3138 | { |
| 3139 | return _cl_unk_general(2, type, size, data); |
| 3140 | } |
| 3141 | |
| 3142 | static int _client_unk3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3143 | { |
| 3144 | return _cl_unk_general(3, type, size, data); |
| 3145 | } |
| 3146 | |
| 3147 | static int _client_unk4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3148 | { |
| 3149 | return _cl_unk_general(4, type, size, data); |
| 3150 | } |
| 3151 | |
| 3152 | static int _client_unk5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3153 | { |
| 3154 | return _cl_unk_general(5, type, size, data); |
| 3155 | } |
| 3156 | |
| 3157 | static int _client_unk6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3158 | { |
| 3159 | return _cl_unk_general(6, type, size, data); |
| 3160 | } |
| 3161 | |
| 3162 | static int _client_unk7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3163 | { |
| 3164 | return _cl_unk_general(7, type, size, data); |
| 3165 | } |
| 3166 | |
| 3167 | static int _cl_plk_general(int num, wol_gameres_type type, int size, void const * data) |
| 3168 | { |
| 3169 | switch (type) { |
| 3170 | case wol_gameres_type_time: |
| 3171 | DEBUG2("Player {} killed {} planes", num, bn_int_nget(*((bn_int *)data))); |
| 3172 | break; |
| 3173 | case wol_gameres_type_bigint: |
| 3174 | DEBUG2("Player {} killed {} planes", num, wol_gameres_get_long_from_data(size, data)); |
| 3175 | break; |
| 3176 | default: |
| 3177 | WARN2("got unknown gameres type {} for PLK{}", static_cast<int>(type), num); |
| 3178 | break; |
| 3179 | } |
| 3180 | return 0; |
| 3181 | } |
| 3182 | |
| 3183 | static int _client_plk0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3184 | { |
| 3185 | return _cl_plk_general(0, type, size, data); |
| 3186 | } |
| 3187 | |
| 3188 | static int _client_plk1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3189 | { |
| 3190 | return _cl_plk_general(1, type, size, data); |
| 3191 | } |
| 3192 | |
| 3193 | static int _client_plk2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3194 | { |
| 3195 | return _cl_plk_general(2, type, size, data); |
| 3196 | } |
| 3197 | |
| 3198 | static int _client_plk3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3199 | { |
| 3200 | return _cl_plk_general(3, type, size, data); |
| 3201 | } |
| 3202 | |
| 3203 | static int _client_plk4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3204 | { |
| 3205 | return _cl_plk_general(4, type, size, data); |
| 3206 | } |
| 3207 | |
| 3208 | static int _client_plk5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3209 | { |
| 3210 | return _cl_plk_general(5, type, size, data); |
| 3211 | } |
| 3212 | |
| 3213 | static int _client_plk6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3214 | { |
| 3215 | return _cl_plk_general(6, type, size, data); |
| 3216 | } |
| 3217 | |
| 3218 | static int _client_plk7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3219 | { |
| 3220 | return _cl_plk_general(7, type, size, data); |
| 3221 | } |
| 3222 | |
| 3223 | static int _cl_blk_general(int num, wol_gameres_type type, int size, void const * data) |
| 3224 | { |
| 3225 | switch (type) { |
| 3226 | case wol_gameres_type_time: |
| 3227 | DEBUG2("Player {} killed {} buildings", num, bn_int_nget(*((bn_int *)data))); |
| 3228 | break; |
| 3229 | case wol_gameres_type_bigint: |
| 3230 | DEBUG2("Player {} killed {} buildings", num, wol_gameres_get_long_from_data(size, data)); |
| 3231 | break; |
| 3232 | default: |
| 3233 | WARN2("got unknown gameres type {} for BLK{}", static_cast<int>(type), num); |
| 3234 | break; |
| 3235 | } |
| 3236 | return 0; |
| 3237 | } |
| 3238 | |
| 3239 | static int _client_blk0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3240 | { |
| 3241 | return _cl_blk_general(0, type, size, data); |
| 3242 | } |
| 3243 | |
| 3244 | static int _client_blk1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3245 | { |
| 3246 | return _cl_blk_general(1, type, size, data); |
| 3247 | } |
| 3248 | |
| 3249 | static int _client_blk2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3250 | { |
| 3251 | return _cl_blk_general(2, type, size, data); |
| 3252 | } |
| 3253 | |
| 3254 | static int _client_blk3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3255 | { |
| 3256 | return _cl_blk_general(3, type, size, data); |
| 3257 | } |
| 3258 | |
| 3259 | static int _client_blk4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3260 | { |
| 3261 | return _cl_blk_general(4, type, size, data); |
| 3262 | } |
| 3263 | |
| 3264 | static int _client_blk5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3265 | { |
| 3266 | return _cl_blk_general(5, type, size, data); |
| 3267 | } |
| 3268 | |
| 3269 | static int _client_blk6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3270 | { |
| 3271 | return _cl_blk_general(6, type, size, data); |
| 3272 | } |
| 3273 | |
| 3274 | static int _client_blk7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3275 | { |
| 3276 | return _cl_blk_general(7, type, size, data); |
| 3277 | } |
| 3278 | |
| 3279 | static int _cl_blc_general(int num, wol_gameres_type type, int size, void const * data) |
| 3280 | { |
| 3281 | switch (type) { |
| 3282 | case wol_gameres_type_int: |
| 3283 | DEBUG2("Player {} captured {} buildings", num, bn_int_nget(*((bn_int *)data))); |
| 3284 | break; |
| 3285 | case wol_gameres_type_bigint: |
| 3286 | DEBUG2("Player {} captured {} buildings", num, wol_gameres_get_long_from_data(size, data)); |
| 3287 | break; |
| 3288 | default: |
| 3289 | WARN2("got unknown gameres type {} for BLC{}", static_cast<int>(type), num); |
| 3290 | break; |
| 3291 | } |
| 3292 | return 0; |
| 3293 | } |
| 3294 | |
| 3295 | static int _client_blc0(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3296 | { |
| 3297 | return _cl_blc_general(0, type, size, data); |
| 3298 | } |
| 3299 | |
| 3300 | static int _client_blc1(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3301 | { |
| 3302 | return _cl_blc_general(1, type, size, data); |
| 3303 | } |
| 3304 | |
| 3305 | static int _client_blc2(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3306 | { |
| 3307 | return _cl_blc_general(2, type, size, data); |
| 3308 | } |
| 3309 | |
| 3310 | static int _client_blc3(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3311 | { |
| 3312 | return _cl_blc_general(3, type, size, data); |
| 3313 | } |
| 3314 | |
| 3315 | static int _client_blc4(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3316 | { |
| 3317 | return _cl_blc_general(4, type, size, data); |
| 3318 | } |
| 3319 | |
| 3320 | static int _client_blc5(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3321 | { |
| 3322 | return _cl_blc_general(5, type, size, data); |
| 3323 | } |
| 3324 | |
| 3325 | static int _client_blc6(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3326 | { |
| 3327 | return _cl_blc_general(6, type, size, data); |
| 3328 | } |
| 3329 | |
| 3330 | static int _client_blc7(t_wol_gameres_result * game_result, wol_gameres_type type, int size, void const * data) |
| 3331 | { |
| 3332 | return _cl_blc_general(7, type, size, data); |
| 3333 | } |
| 3334 | |
| 3335 | |
| 3336 | } |
| 3337 | |
| 3338 | } |