| 1 | #include "protocol7.h" |
| 2 | #include <base/system.h> |
| 3 | #include <engine/shared/packer.h> |
| 4 | #include <engine/shared/protocol.h> |
| 5 | #include <engine/shared/snapshot.h> |
| 6 | namespace protocol7 { |
| 7 | CNetObjHandler::CNetObjHandler() |
| 8 | { |
| 9 | m_pMsgFailedOn = "" ; |
| 10 | m_pObjFailedOn = "" ; |
| 11 | m_NumObjFailures = 0; |
| 12 | } |
| 13 | |
| 14 | const char *CNetObjHandler::FailedObjOn() const { return m_pObjFailedOn; } |
| 15 | int CNetObjHandler::NumObjFailures() const { return m_NumObjFailures; } |
| 16 | const char *CNetObjHandler::FailedMsgOn() const { return m_pMsgFailedOn; } |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | static const int max_int = 0x7fffffff; |
| 22 | |
| 23 | bool CNetObjHandler::CheckInt(const char *pErrorMsg, int Value, int Min, int Max) |
| 24 | { |
| 25 | if(Value < Min || Value > Max) { m_pObjFailedOn = pErrorMsg; m_NumObjFailures++; return false; } |
| 26 | return true; |
| 27 | } |
| 28 | |
| 29 | bool CNetObjHandler::CheckFlag(const char *pErrorMsg, int Value, int Mask) |
| 30 | { |
| 31 | if((Value&Mask) != Value) { m_pObjFailedOn = pErrorMsg; m_NumObjFailures++; return false; } |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | const char *CNetObjHandler::ms_apObjNames[] = { |
| 36 | "invalid" , |
| 37 | "PlayerInput" , |
| 38 | "Projectile" , |
| 39 | "Laser" , |
| 40 | "Pickup" , |
| 41 | "Flag" , |
| 42 | "GameData" , |
| 43 | "GameDataTeam" , |
| 44 | "GameDataFlag" , |
| 45 | "CharacterCore" , |
| 46 | "Character" , |
| 47 | "PlayerInfo" , |
| 48 | "SpectatorInfo" , |
| 49 | "De_ClientInfo" , |
| 50 | "De_GameInfo" , |
| 51 | "De_TuneParams" , |
| 52 | "Common" , |
| 53 | "Explosion" , |
| 54 | "Spawn" , |
| 55 | "HammerHit" , |
| 56 | "Death" , |
| 57 | "SoundWorld" , |
| 58 | "Damage" , |
| 59 | "PlayerInfoRace" , |
| 60 | "GameDataRace" , |
| 61 | "" |
| 62 | }; |
| 63 | |
| 64 | int CNetObjHandler::ms_aObjSizes[] = { |
| 65 | 0, |
| 66 | sizeof(CNetObj_PlayerInput), |
| 67 | sizeof(CNetObj_Projectile), |
| 68 | sizeof(CNetObj_Laser), |
| 69 | sizeof(CNetObj_Pickup), |
| 70 | sizeof(CNetObj_Flag), |
| 71 | sizeof(CNetObj_GameData), |
| 72 | sizeof(CNetObj_GameDataTeam), |
| 73 | sizeof(CNetObj_GameDataFlag), |
| 74 | sizeof(CNetObj_CharacterCore), |
| 75 | sizeof(CNetObj_Character), |
| 76 | sizeof(CNetObj_PlayerInfo), |
| 77 | sizeof(CNetObj_SpectatorInfo), |
| 78 | sizeof(CNetObj_De_ClientInfo), |
| 79 | sizeof(CNetObj_De_GameInfo), |
| 80 | sizeof(CNetObj_De_TuneParams), |
| 81 | sizeof(CNetEvent_Common), |
| 82 | sizeof(CNetEvent_Explosion), |
| 83 | sizeof(CNetEvent_Spawn), |
| 84 | sizeof(CNetEvent_HammerHit), |
| 85 | sizeof(CNetEvent_Death), |
| 86 | sizeof(CNetEvent_SoundWorld), |
| 87 | sizeof(CNetEvent_Damage), |
| 88 | sizeof(CNetObj_PlayerInfoRace), |
| 89 | sizeof(CNetObj_GameDataRace), |
| 90 | 0 |
| 91 | }; |
| 92 | |
| 93 | const char *CNetObjHandler::ms_apMsgNames[] = { |
| 94 | "invalid" , |
| 95 | "Sv_Motd" , |
| 96 | "Sv_Broadcast" , |
| 97 | "Sv_Chat" , |
| 98 | "Sv_Team" , |
| 99 | "Sv_KillMsg" , |
| 100 | "Sv_TuneParams" , |
| 101 | "Unused" , |
| 102 | "Sv_ReadyToEnter" , |
| 103 | "Sv_WeaponPickup" , |
| 104 | "Sv_Emoticon" , |
| 105 | "Sv_VoteClearOptions" , |
| 106 | "Sv_VoteOptionListAdd" , |
| 107 | "Sv_VoteOptionAdd" , |
| 108 | "Sv_VoteOptionRemove" , |
| 109 | "Sv_VoteSet" , |
| 110 | "Sv_VoteStatus" , |
| 111 | "Sv_ServerSettings" , |
| 112 | "Sv_ClientInfo" , |
| 113 | "Sv_GameInfo" , |
| 114 | "Sv_ClientDrop" , |
| 115 | "Sv_GameMsg" , |
| 116 | "De_ClientEnter" , |
| 117 | "De_ClientLeave" , |
| 118 | "Cl_Say" , |
| 119 | "Cl_SetTeam" , |
| 120 | "Cl_SetSpectatorMode" , |
| 121 | "Cl_StartInfo" , |
| 122 | "Cl_Kill" , |
| 123 | "Cl_ReadyChange" , |
| 124 | "Cl_Emoticon" , |
| 125 | "Cl_Vote" , |
| 126 | "Cl_CallVote" , |
| 127 | "Sv_SkinChange" , |
| 128 | "Cl_SkinChange" , |
| 129 | "Sv_RaceFinish" , |
| 130 | "Sv_Checkpoint" , |
| 131 | "Sv_CommandInfo" , |
| 132 | "Sv_CommandInfoRemove" , |
| 133 | "Cl_Command" , |
| 134 | "" |
| 135 | }; |
| 136 | |
| 137 | const char *CNetObjHandler::GetObjName(int Type) const |
| 138 | { |
| 139 | if(Type < 0 || Type >= NUM_NETOBJTYPES) return "(out of range)" ; |
| 140 | return ms_apObjNames[Type]; |
| 141 | }; |
| 142 | |
| 143 | int CNetObjHandler::GetObjSize(int Type) const |
| 144 | { |
| 145 | if(Type < 0 || Type >= NUM_NETOBJTYPES) return 0; |
| 146 | return ms_aObjSizes[Type]; |
| 147 | }; |
| 148 | |
| 149 | const char *CNetObjHandler::GetMsgName(int Type) const |
| 150 | { |
| 151 | if(Type < 0 || Type >= NUM_NETMSGTYPES) return "(out of range)" ; |
| 152 | return ms_apMsgNames[Type]; |
| 153 | }; |
| 154 | |
| 155 | int CNetObjHandler::ValidateObj(int Type, const void *pData, int Size) |
| 156 | { |
| 157 | switch(Type) |
| 158 | { |
| 159 | case NETOBJTYPE_PLAYERINPUT: |
| 160 | { |
| 161 | CNetObj_PlayerInput *pObj = (CNetObj_PlayerInput *)pData; |
| 162 | if(sizeof(*pObj) != Size) return -1; |
| 163 | if(!CheckInt(pErrorMsg: "m_Direction" , Value: pObj->m_Direction, Min: -1, Max: 1)) return -1; |
| 164 | if(!CheckInt(pErrorMsg: "m_Jump" , Value: pObj->m_Jump, Min: 0, Max: 1)) return -1; |
| 165 | if(!CheckInt(pErrorMsg: "m_Hook" , Value: pObj->m_Hook, Min: 0, Max: 1)) return -1; |
| 166 | if(!CheckFlag(pErrorMsg: "m_PlayerFlags" , Value: pObj->m_PlayerFlags, Mask: PLAYERFLAG_ADMIN|PLAYERFLAG_CHATTING|PLAYERFLAG_SCOREBOARD|PLAYERFLAG_READY|PLAYERFLAG_DEAD|PLAYERFLAG_WATCHING|PLAYERFLAG_BOT|PLAYERFLAG_AIM)) return -1; |
| 167 | if(!CheckInt(pErrorMsg: "m_WantedWeapon" , Value: pObj->m_WantedWeapon, Min: 0, Max: NUM_WEAPONS-1)) return -1; |
| 168 | return 0; |
| 169 | } |
| 170 | |
| 171 | case NETOBJTYPE_PROJECTILE: |
| 172 | { |
| 173 | CNetObj_Projectile *pObj = (CNetObj_Projectile *)pData; |
| 174 | if(sizeof(*pObj) != Size) return -1; |
| 175 | if(!CheckInt(pErrorMsg: "m_Type" , Value: pObj->m_Type, Min: 0, Max: NUM_WEAPONS-1)) return -1; |
| 176 | if(!CheckInt(pErrorMsg: "m_StartTick" , Value: pObj->m_StartTick, Min: 0, Max: max_int)) return -1; |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | case NETOBJTYPE_LASER: |
| 181 | { |
| 182 | CNetObj_Laser *pObj = (CNetObj_Laser *)pData; |
| 183 | if(sizeof(*pObj) != Size) return -1; |
| 184 | if(!CheckInt(pErrorMsg: "m_StartTick" , Value: pObj->m_StartTick, Min: 0, Max: max_int)) return -1; |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | case NETOBJTYPE_PICKUP: |
| 189 | { |
| 190 | CNetObj_Pickup *pObj = (CNetObj_Pickup *)pData; |
| 191 | if(sizeof(*pObj) != Size) return -1; |
| 192 | if(!CheckInt(pErrorMsg: "m_Type" , Value: pObj->m_Type, Min: 0, Max: 7)) return -1; |
| 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | case NETOBJTYPE_FLAG: |
| 197 | { |
| 198 | CNetObj_Flag *pObj = (CNetObj_Flag *)pData; |
| 199 | if(sizeof(*pObj) != Size) return -1; |
| 200 | if(!CheckInt(pErrorMsg: "m_Team" , Value: pObj->m_Team, Min: TEAM_RED, Max: TEAM_BLUE)) return -1; |
| 201 | return 0; |
| 202 | } |
| 203 | |
| 204 | case NETOBJTYPE_GAMEDATA: |
| 205 | { |
| 206 | CNetObj_GameData *pObj = (CNetObj_GameData *)pData; |
| 207 | if(sizeof(*pObj) != Size) return -1; |
| 208 | if(!CheckInt(pErrorMsg: "m_GameStartTick" , Value: pObj->m_GameStartTick, Min: 0, Max: max_int)) return -1; |
| 209 | if(!CheckFlag(pErrorMsg: "m_GameStateFlags" , Value: pObj->m_GameStateFlags, Mask: GAMESTATEFLAG_WARMUP|GAMESTATEFLAG_SUDDENDEATH|GAMESTATEFLAG_ROUNDOVER|GAMESTATEFLAG_GAMEOVER|GAMESTATEFLAG_PAUSED|GAMESTATEFLAG_STARTCOUNTDOWN)) return -1; |
| 210 | if(!CheckInt(pErrorMsg: "m_GameStateEndTick" , Value: pObj->m_GameStateEndTick, Min: 0, Max: max_int)) return -1; |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | case NETOBJTYPE_GAMEDATATEAM: |
| 215 | { |
| 216 | CNetObj_GameDataTeam *pObj = (CNetObj_GameDataTeam *)pData; |
| 217 | if(sizeof(*pObj) != Size) return -1; |
| 218 | return 0; |
| 219 | } |
| 220 | |
| 221 | case NETOBJTYPE_GAMEDATAFLAG: |
| 222 | { |
| 223 | CNetObj_GameDataFlag *pObj = (CNetObj_GameDataFlag *)pData; |
| 224 | if(sizeof(*pObj) != Size) return -1; |
| 225 | if(!CheckInt(pErrorMsg: "m_FlagCarrierRed" , Value: pObj->m_FlagCarrierRed, Min: FLAG_MISSING, Max: MAX_CLIENTS-1)) return -1; |
| 226 | if(!CheckInt(pErrorMsg: "m_FlagCarrierBlue" , Value: pObj->m_FlagCarrierBlue, Min: FLAG_MISSING, Max: MAX_CLIENTS-1)) return -1; |
| 227 | if(!CheckInt(pErrorMsg: "m_FlagDropTickRed" , Value: pObj->m_FlagDropTickRed, Min: 0, Max: max_int)) return -1; |
| 228 | if(!CheckInt(pErrorMsg: "m_FlagDropTickBlue" , Value: pObj->m_FlagDropTickBlue, Min: 0, Max: max_int)) return -1; |
| 229 | return 0; |
| 230 | } |
| 231 | |
| 232 | case NETOBJTYPE_CHARACTERCORE: |
| 233 | { |
| 234 | CNetObj_CharacterCore *pObj = (CNetObj_CharacterCore *)pData; |
| 235 | if(sizeof(*pObj) != Size) return -1; |
| 236 | if(!CheckInt(pErrorMsg: "m_Tick" , Value: pObj->m_Tick, Min: 0, Max: max_int)) return -1; |
| 237 | if(!CheckInt(pErrorMsg: "m_Direction" , Value: pObj->m_Direction, Min: -1, Max: 1)) return -1; |
| 238 | if(!CheckInt(pErrorMsg: "m_Jumped" , Value: pObj->m_Jumped, Min: 0, Max: 3)) return -1; |
| 239 | if(!CheckInt(pErrorMsg: "m_HookedPlayer" , Value: pObj->m_HookedPlayer, Min: -1, Max: MAX_CLIENTS-1)) return -1; |
| 240 | if(!CheckInt(pErrorMsg: "m_HookState" , Value: pObj->m_HookState, Min: -1, Max: 5)) return -1; |
| 241 | if(!CheckInt(pErrorMsg: "m_HookTick" , Value: pObj->m_HookTick, Min: 0, Max: max_int)) return -1; |
| 242 | return 0; |
| 243 | } |
| 244 | |
| 245 | case NETOBJTYPE_CHARACTER: |
| 246 | { |
| 247 | CNetObj_Character *pObj = (CNetObj_Character *)pData; |
| 248 | if(sizeof(*pObj) != Size) return -1; |
| 249 | if(!CheckInt(pErrorMsg: "m_Tick" , Value: pObj->m_Tick, Min: 0, Max: max_int)) return -1; |
| 250 | if(!CheckInt(pErrorMsg: "m_Direction" , Value: pObj->m_Direction, Min: -1, Max: 1)) return -1; |
| 251 | if(!CheckInt(pErrorMsg: "m_Jumped" , Value: pObj->m_Jumped, Min: 0, Max: 3)) return -1; |
| 252 | if(!CheckInt(pErrorMsg: "m_HookedPlayer" , Value: pObj->m_HookedPlayer, Min: -1, Max: MAX_CLIENTS-1)) return -1; |
| 253 | if(!CheckInt(pErrorMsg: "m_HookState" , Value: pObj->m_HookState, Min: -1, Max: 5)) return -1; |
| 254 | if(!CheckInt(pErrorMsg: "m_HookTick" , Value: pObj->m_HookTick, Min: 0, Max: max_int)) return -1; |
| 255 | if(!CheckInt(pErrorMsg: "m_Health" , Value: pObj->m_Health, Min: 0, Max: 10)) return -1; |
| 256 | if(!CheckInt(pErrorMsg: "m_Armor" , Value: pObj->m_Armor, Min: 0, Max: 10)) return -1; |
| 257 | if(!CheckInt(pErrorMsg: "m_Weapon" , Value: pObj->m_Weapon, Min: -1, Max: NUM_WEAPONS-1)) return -1; |
| 258 | if(!CheckInt(pErrorMsg: "m_Emote" , Value: pObj->m_Emote, Min: 0, Max: 5)) return -1; |
| 259 | if(!CheckInt(pErrorMsg: "m_AttackTick" , Value: pObj->m_AttackTick, Min: 0, Max: max_int)) return -1; |
| 260 | if(!CheckFlag(pErrorMsg: "m_TriggeredEvents" , Value: pObj->m_TriggeredEvents, Mask: COREEVENTFLAG_GROUND_JUMP|COREEVENTFLAG_AIR_JUMP|COREEVENTFLAG_HOOK_ATTACH_PLAYER|COREEVENTFLAG_HOOK_ATTACH_GROUND|COREEVENTFLAG_HOOK_HIT_NOHOOK)) return -1; |
| 261 | return 0; |
| 262 | } |
| 263 | |
| 264 | case NETOBJTYPE_PLAYERINFO: |
| 265 | { |
| 266 | CNetObj_PlayerInfo *pObj = (CNetObj_PlayerInfo *)pData; |
| 267 | if(sizeof(*pObj) != Size) return -1; |
| 268 | if(!CheckFlag(pErrorMsg: "m_PlayerFlags" , Value: pObj->m_PlayerFlags, Mask: PLAYERFLAG_ADMIN|PLAYERFLAG_CHATTING|PLAYERFLAG_SCOREBOARD|PLAYERFLAG_READY|PLAYERFLAG_DEAD|PLAYERFLAG_WATCHING|PLAYERFLAG_BOT|PLAYERFLAG_AIM)) return -1; |
| 269 | return 0; |
| 270 | } |
| 271 | |
| 272 | case NETOBJTYPE_SPECTATORINFO: |
| 273 | { |
| 274 | CNetObj_SpectatorInfo *pObj = (CNetObj_SpectatorInfo *)pData; |
| 275 | if(sizeof(*pObj) != Size) return -1; |
| 276 | if(!CheckInt(pErrorMsg: "m_SpecMode" , Value: pObj->m_SpecMode, Min: 0, Max: NUM_SPECMODES-1)) return -1; |
| 277 | if(!CheckInt(pErrorMsg: "m_SpectatorId" , Value: pObj->m_SpectatorId, Min: -1, Max: MAX_CLIENTS-1)) return -1; |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | case NETOBJTYPE_DE_CLIENTINFO: |
| 282 | { |
| 283 | CNetObj_De_ClientInfo *pObj = (CNetObj_De_ClientInfo *)pData; |
| 284 | if(sizeof(*pObj) != Size) return -1; |
| 285 | if(!CheckInt(pErrorMsg: "m_Local" , Value: pObj->m_Local, Min: 0, Max: 1)) return -1; |
| 286 | if(!CheckInt(pErrorMsg: "m_Team" , Value: pObj->m_Team, Min: TEAM_SPECTATORS, Max: TEAM_BLUE)) return -1; |
| 287 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[0]" , Value: pObj->m_aUseCustomColors[0], Min: 0, Max: 1)) return -1; |
| 288 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[1]" , Value: pObj->m_aUseCustomColors[1], Min: 0, Max: 1)) return -1; |
| 289 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[2]" , Value: pObj->m_aUseCustomColors[2], Min: 0, Max: 1)) return -1; |
| 290 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[3]" , Value: pObj->m_aUseCustomColors[3], Min: 0, Max: 1)) return -1; |
| 291 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[4]" , Value: pObj->m_aUseCustomColors[4], Min: 0, Max: 1)) return -1; |
| 292 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[5]" , Value: pObj->m_aUseCustomColors[5], Min: 0, Max: 1)) return -1; |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | case NETOBJTYPE_DE_GAMEINFO: |
| 297 | { |
| 298 | CNetObj_De_GameInfo *pObj = (CNetObj_De_GameInfo *)pData; |
| 299 | if(sizeof(*pObj) != Size) return -1; |
| 300 | if(!CheckFlag(pErrorMsg: "m_GameFlags" , Value: pObj->m_GameFlags, Mask: GAMEFLAG_TEAMS|GAMEFLAG_FLAGS|GAMEFLAG_SURVIVAL|GAMEFLAG_RACE)) return -1; |
| 301 | if(!CheckInt(pErrorMsg: "m_ScoreLimit" , Value: pObj->m_ScoreLimit, Min: 0, Max: max_int)) return -1; |
| 302 | if(!CheckInt(pErrorMsg: "m_TimeLimit" , Value: pObj->m_TimeLimit, Min: 0, Max: max_int)) return -1; |
| 303 | if(!CheckInt(pErrorMsg: "m_MatchNum" , Value: pObj->m_MatchNum, Min: 0, Max: max_int)) return -1; |
| 304 | if(!CheckInt(pErrorMsg: "m_MatchCurrent" , Value: pObj->m_MatchCurrent, Min: 0, Max: max_int)) return -1; |
| 305 | return 0; |
| 306 | } |
| 307 | |
| 308 | case NETOBJTYPE_DE_TUNEPARAMS: |
| 309 | { |
| 310 | CNetObj_De_TuneParams *pObj = (CNetObj_De_TuneParams *)pData; |
| 311 | if(sizeof(*pObj) != Size) return -1; |
| 312 | return 0; |
| 313 | } |
| 314 | |
| 315 | case NETEVENTTYPE_COMMON: |
| 316 | { |
| 317 | CNetEvent_Common *pObj = (CNetEvent_Common *)pData; |
| 318 | if(sizeof(*pObj) != Size) return -1; |
| 319 | return 0; |
| 320 | } |
| 321 | |
| 322 | case NETEVENTTYPE_EXPLOSION: |
| 323 | { |
| 324 | CNetEvent_Explosion *pObj = (CNetEvent_Explosion *)pData; |
| 325 | if(sizeof(*pObj) != Size) return -1; |
| 326 | return 0; |
| 327 | } |
| 328 | |
| 329 | case NETEVENTTYPE_SPAWN: |
| 330 | { |
| 331 | CNetEvent_Spawn *pObj = (CNetEvent_Spawn *)pData; |
| 332 | if(sizeof(*pObj) != Size) return -1; |
| 333 | return 0; |
| 334 | } |
| 335 | |
| 336 | case NETEVENTTYPE_HAMMERHIT: |
| 337 | { |
| 338 | CNetEvent_HammerHit *pObj = (CNetEvent_HammerHit *)pData; |
| 339 | if(sizeof(*pObj) != Size) return -1; |
| 340 | return 0; |
| 341 | } |
| 342 | |
| 343 | case NETEVENTTYPE_DEATH: |
| 344 | { |
| 345 | CNetEvent_Death *pObj = (CNetEvent_Death *)pData; |
| 346 | if(sizeof(*pObj) != Size) return -1; |
| 347 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pObj->m_ClientId, Min: 0, Max: MAX_CLIENTS-1)) return -1; |
| 348 | return 0; |
| 349 | } |
| 350 | |
| 351 | case NETEVENTTYPE_SOUNDWORLD: |
| 352 | { |
| 353 | CNetEvent_SoundWorld *pObj = (CNetEvent_SoundWorld *)pData; |
| 354 | if(sizeof(*pObj) != Size) return -1; |
| 355 | if(!CheckInt(pErrorMsg: "m_SoundId" , Value: pObj->m_SoundId, Min: 0, Max: NUM_SOUNDS-1)) return -1; |
| 356 | return 0; |
| 357 | } |
| 358 | |
| 359 | case NETEVENTTYPE_DAMAGE: |
| 360 | { |
| 361 | CNetEvent_Damage *pObj = (CNetEvent_Damage *)pData; |
| 362 | if(sizeof(*pObj) != Size) return -1; |
| 363 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pObj->m_ClientId, Min: 0, Max: MAX_CLIENTS-1)) return -1; |
| 364 | if(!CheckInt(pErrorMsg: "m_HealthAmount" , Value: pObj->m_HealthAmount, Min: 0, Max: 9)) return -1; |
| 365 | if(!CheckInt(pErrorMsg: "m_ArmorAmount" , Value: pObj->m_ArmorAmount, Min: 0, Max: 9)) return -1; |
| 366 | if(!CheckInt(pErrorMsg: "m_Self" , Value: pObj->m_Self, Min: 0, Max: 1)) return -1; |
| 367 | return 0; |
| 368 | } |
| 369 | |
| 370 | case NETOBJTYPE_PLAYERINFORACE: |
| 371 | { |
| 372 | CNetObj_PlayerInfoRace *pObj = (CNetObj_PlayerInfoRace *)pData; |
| 373 | if(sizeof(*pObj) != Size) return -1; |
| 374 | if(!CheckInt(pErrorMsg: "m_RaceStartTick" , Value: pObj->m_RaceStartTick, Min: 0, Max: max_int)) return -1; |
| 375 | return 0; |
| 376 | } |
| 377 | |
| 378 | case NETOBJTYPE_GAMEDATARACE: |
| 379 | { |
| 380 | CNetObj_GameDataRace *pObj = (CNetObj_GameDataRace *)pData; |
| 381 | if(sizeof(*pObj) != Size) return -1; |
| 382 | if(!CheckInt(pErrorMsg: "m_BestTime" , Value: pObj->m_BestTime, Min: -1, Max: max_int)) return -1; |
| 383 | if(!CheckInt(pErrorMsg: "m_Precision" , Value: pObj->m_Precision, Min: 0, Max: 3)) return -1; |
| 384 | if(!CheckFlag(pErrorMsg: "m_RaceFlags" , Value: pObj->m_RaceFlags, Mask: RACEFLAG_HIDE_KILLMSG|RACEFLAG_FINISHMSG_AS_CHAT|RACEFLAG_KEEP_WANTED_WEAPON)) return -1; |
| 385 | return 0; |
| 386 | } |
| 387 | |
| 388 | } |
| 389 | return -1; |
| 390 | }; |
| 391 | |
| 392 | void CNetObjHandler::DebugDumpSnapshot(const ::CSnapshot *pSnap) const |
| 393 | { |
| 394 | dbg_msg(sys: "snapshot" , fmt: "data_size=%d num_items=%d" , pSnap->DataSize(), pSnap->NumItems()); |
| 395 | for(int i = 0; i < pSnap->NumItems(); i++) |
| 396 | { |
| 397 | const CSnapshotItem *pItem = pSnap->GetItem(Index: i); |
| 398 | int Size = pSnap->GetItemSize(Index: i); |
| 399 | int Type = pSnap->GetItemType(Index: i); |
| 400 | const char *pName = GetObjName(Type: pItem->Type()); |
| 401 | if(Type > OFFSET_UUID && Type < g_UuidManager.NumUuids() + OFFSET_UUID) |
| 402 | pName = g_UuidManager.GetName(Id: Type); |
| 403 | dbg_msg(sys: "snapshot" , fmt: "\t%s type=%d id=%d size=%d" , pName, pItem->Type(), pItem->Id(), Size); |
| 404 | if(!DumpObj(Type, pData: pItem->Data(), Size)) |
| 405 | continue; |
| 406 | |
| 407 | for(size_t b = 0; b < Size / sizeof(int32_t); b++) |
| 408 | dbg_msg(sys: "snapshot" , fmt: "\t\t%3d %12d\t%08x" , (int)b, pItem->Data()[b], pItem->Data()[b]); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | int CNetObjHandler::DumpObj(int Type, const void *pData, int Size) const |
| 413 | { |
| 414 | char aRawData[512]; |
| 415 | switch(Type) |
| 416 | { |
| 417 | case NETOBJTYPE_PLAYERINPUT: |
| 418 | { |
| 419 | CNetObj_PlayerInput *pObj = (CNetObj_PlayerInput *)pData; |
| 420 | if(sizeof(*pObj) != Size) return -1; |
| 421 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 422 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Direction=%d (min=-1 max=1)" , aRawData, pObj->m_Direction); |
| 423 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 424 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_TargetX=%d" , aRawData, pObj->m_TargetX); |
| 425 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 426 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_TargetY=%d" , aRawData, pObj->m_TargetY); |
| 427 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 428 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Jump=%d (min=0 max=1)" , aRawData, pObj->m_Jump); |
| 429 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 430 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Fire=%d" , aRawData, pObj->m_Fire); |
| 431 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 5, ((const int *)pData)[5], ((const int *)pData)[5]); |
| 432 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Hook=%d (min=0 max=1)" , aRawData, pObj->m_Hook); |
| 433 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 6, ((const int *)pData)[6], ((const int *)pData)[6]); |
| 434 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_PlayerFlags=%d (mask=%d)" , aRawData, pObj->m_PlayerFlags, PLAYERFLAG_ADMIN|PLAYERFLAG_CHATTING|PLAYERFLAG_SCOREBOARD|PLAYERFLAG_READY|PLAYERFLAG_DEAD|PLAYERFLAG_WATCHING|PLAYERFLAG_BOT|PLAYERFLAG_AIM); |
| 435 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 7, ((const int *)pData)[7], ((const int *)pData)[7]); |
| 436 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_WantedWeapon=%d (min=0 max=NUM_WEAPONS-1(%d))" , aRawData, pObj->m_WantedWeapon, (int)NUM_WEAPONS-1); |
| 437 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 8, ((const int *)pData)[8], ((const int *)pData)[8]); |
| 438 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_NextWeapon=%d" , aRawData, pObj->m_NextWeapon); |
| 439 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 9, ((const int *)pData)[9], ((const int *)pData)[9]); |
| 440 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_PrevWeapon=%d" , aRawData, pObj->m_PrevWeapon); |
| 441 | return 0; |
| 442 | } |
| 443 | |
| 444 | case NETOBJTYPE_PROJECTILE: |
| 445 | { |
| 446 | CNetObj_Projectile *pObj = (CNetObj_Projectile *)pData; |
| 447 | if(sizeof(*pObj) != Size) return -1; |
| 448 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 449 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 450 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 451 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 452 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 453 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_VelX=%d" , aRawData, pObj->m_VelX); |
| 454 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 455 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_VelY=%d" , aRawData, pObj->m_VelY); |
| 456 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 457 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Type=%d (min=0 max=NUM_WEAPONS-1(%d))" , aRawData, pObj->m_Type, (int)NUM_WEAPONS-1); |
| 458 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 5, ((const int *)pData)[5], ((const int *)pData)[5]); |
| 459 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_StartTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_StartTick, (int)max_int); |
| 460 | return 0; |
| 461 | } |
| 462 | |
| 463 | case NETOBJTYPE_LASER: |
| 464 | { |
| 465 | CNetObj_Laser *pObj = (CNetObj_Laser *)pData; |
| 466 | if(sizeof(*pObj) != Size) return -1; |
| 467 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 468 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 469 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 470 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 471 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 472 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_FromX=%d" , aRawData, pObj->m_FromX); |
| 473 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 474 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_FromY=%d" , aRawData, pObj->m_FromY); |
| 475 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 476 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_StartTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_StartTick, (int)max_int); |
| 477 | return 0; |
| 478 | } |
| 479 | |
| 480 | case NETOBJTYPE_PICKUP: |
| 481 | { |
| 482 | CNetObj_Pickup *pObj = (CNetObj_Pickup *)pData; |
| 483 | if(sizeof(*pObj) != Size) return -1; |
| 484 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 485 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 486 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 487 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 488 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 489 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Type=%d (min=0 max=7)" , aRawData, pObj->m_Type); |
| 490 | return 0; |
| 491 | } |
| 492 | |
| 493 | case NETOBJTYPE_FLAG: |
| 494 | { |
| 495 | CNetObj_Flag *pObj = (CNetObj_Flag *)pData; |
| 496 | if(sizeof(*pObj) != Size) return -1; |
| 497 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 498 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 499 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 500 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 501 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 502 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Team=%d (min=TEAM_RED(%d) max=TEAM_BLUE(%d))" , aRawData, pObj->m_Team, (int)TEAM_RED, (int)TEAM_BLUE); |
| 503 | return 0; |
| 504 | } |
| 505 | |
| 506 | case NETOBJTYPE_GAMEDATA: |
| 507 | { |
| 508 | CNetObj_GameData *pObj = (CNetObj_GameData *)pData; |
| 509 | if(sizeof(*pObj) != Size) return -1; |
| 510 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 511 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_GameStartTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_GameStartTick, (int)max_int); |
| 512 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 513 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_GameStateFlags=%d (mask=%d)" , aRawData, pObj->m_GameStateFlags, GAMESTATEFLAG_WARMUP|GAMESTATEFLAG_SUDDENDEATH|GAMESTATEFLAG_ROUNDOVER|GAMESTATEFLAG_GAMEOVER|GAMESTATEFLAG_PAUSED|GAMESTATEFLAG_STARTCOUNTDOWN); |
| 514 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 515 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_GameStateEndTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_GameStateEndTick, (int)max_int); |
| 516 | return 0; |
| 517 | } |
| 518 | |
| 519 | case NETOBJTYPE_GAMEDATATEAM: |
| 520 | { |
| 521 | CNetObj_GameDataTeam *pObj = (CNetObj_GameDataTeam *)pData; |
| 522 | if(sizeof(*pObj) != Size) return -1; |
| 523 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 524 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_TeamscoreRed=%d" , aRawData, pObj->m_TeamscoreRed); |
| 525 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 526 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_TeamscoreBlue=%d" , aRawData, pObj->m_TeamscoreBlue); |
| 527 | return 0; |
| 528 | } |
| 529 | |
| 530 | case NETOBJTYPE_GAMEDATAFLAG: |
| 531 | { |
| 532 | CNetObj_GameDataFlag *pObj = (CNetObj_GameDataFlag *)pData; |
| 533 | if(sizeof(*pObj) != Size) return -1; |
| 534 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 535 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_FlagCarrierRed=%d (min=FLAG_MISSING(%d) max=MAX_CLIENTS-1(%d))" , aRawData, pObj->m_FlagCarrierRed, (int)FLAG_MISSING, (int)MAX_CLIENTS-1); |
| 536 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 537 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_FlagCarrierBlue=%d (min=FLAG_MISSING(%d) max=MAX_CLIENTS-1(%d))" , aRawData, pObj->m_FlagCarrierBlue, (int)FLAG_MISSING, (int)MAX_CLIENTS-1); |
| 538 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 539 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_FlagDropTickRed=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_FlagDropTickRed, (int)max_int); |
| 540 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 541 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_FlagDropTickBlue=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_FlagDropTickBlue, (int)max_int); |
| 542 | return 0; |
| 543 | } |
| 544 | |
| 545 | case NETOBJTYPE_CHARACTERCORE: |
| 546 | { |
| 547 | CNetObj_CharacterCore *pObj = (CNetObj_CharacterCore *)pData; |
| 548 | if(sizeof(*pObj) != Size) return -1; |
| 549 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 550 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Tick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_Tick, (int)max_int); |
| 551 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 552 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 553 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 554 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 555 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 556 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_VelX=%d" , aRawData, pObj->m_VelX); |
| 557 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 558 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_VelY=%d" , aRawData, pObj->m_VelY); |
| 559 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 5, ((const int *)pData)[5], ((const int *)pData)[5]); |
| 560 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Angle=%d" , aRawData, pObj->m_Angle); |
| 561 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 6, ((const int *)pData)[6], ((const int *)pData)[6]); |
| 562 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Direction=%d (min=-1 max=1)" , aRawData, pObj->m_Direction); |
| 563 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 7, ((const int *)pData)[7], ((const int *)pData)[7]); |
| 564 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Jumped=%d (min=0 max=3)" , aRawData, pObj->m_Jumped); |
| 565 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 8, ((const int *)pData)[8], ((const int *)pData)[8]); |
| 566 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookedPlayer=%d (min=-1 max=MAX_CLIENTS-1(%d))" , aRawData, pObj->m_HookedPlayer, (int)MAX_CLIENTS-1); |
| 567 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 9, ((const int *)pData)[9], ((const int *)pData)[9]); |
| 568 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookState=%d (min=-1 max=5)" , aRawData, pObj->m_HookState); |
| 569 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 10, ((const int *)pData)[10], ((const int *)pData)[10]); |
| 570 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_HookTick, (int)max_int); |
| 571 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 11, ((const int *)pData)[11], ((const int *)pData)[11]); |
| 572 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookX=%d" , aRawData, pObj->m_HookX); |
| 573 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 12, ((const int *)pData)[12], ((const int *)pData)[12]); |
| 574 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookY=%d" , aRawData, pObj->m_HookY); |
| 575 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 13, ((const int *)pData)[13], ((const int *)pData)[13]); |
| 576 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookDx=%d" , aRawData, pObj->m_HookDx); |
| 577 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 14, ((const int *)pData)[14], ((const int *)pData)[14]); |
| 578 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookDy=%d" , aRawData, pObj->m_HookDy); |
| 579 | return 0; |
| 580 | } |
| 581 | |
| 582 | case NETOBJTYPE_CHARACTER: |
| 583 | { |
| 584 | CNetObj_Character *pObj = (CNetObj_Character *)pData; |
| 585 | if(sizeof(*pObj) != Size) return -1; |
| 586 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 587 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Tick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_Tick, (int)max_int); |
| 588 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 589 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 590 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 591 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 592 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 593 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_VelX=%d" , aRawData, pObj->m_VelX); |
| 594 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 595 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_VelY=%d" , aRawData, pObj->m_VelY); |
| 596 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 5, ((const int *)pData)[5], ((const int *)pData)[5]); |
| 597 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Angle=%d" , aRawData, pObj->m_Angle); |
| 598 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 6, ((const int *)pData)[6], ((const int *)pData)[6]); |
| 599 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Direction=%d (min=-1 max=1)" , aRawData, pObj->m_Direction); |
| 600 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 7, ((const int *)pData)[7], ((const int *)pData)[7]); |
| 601 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Jumped=%d (min=0 max=3)" , aRawData, pObj->m_Jumped); |
| 602 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 8, ((const int *)pData)[8], ((const int *)pData)[8]); |
| 603 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookedPlayer=%d (min=-1 max=MAX_CLIENTS-1(%d))" , aRawData, pObj->m_HookedPlayer, (int)MAX_CLIENTS-1); |
| 604 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 9, ((const int *)pData)[9], ((const int *)pData)[9]); |
| 605 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookState=%d (min=-1 max=5)" , aRawData, pObj->m_HookState); |
| 606 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 10, ((const int *)pData)[10], ((const int *)pData)[10]); |
| 607 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_HookTick, (int)max_int); |
| 608 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 11, ((const int *)pData)[11], ((const int *)pData)[11]); |
| 609 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookX=%d" , aRawData, pObj->m_HookX); |
| 610 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 12, ((const int *)pData)[12], ((const int *)pData)[12]); |
| 611 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookY=%d" , aRawData, pObj->m_HookY); |
| 612 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 13, ((const int *)pData)[13], ((const int *)pData)[13]); |
| 613 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookDx=%d" , aRawData, pObj->m_HookDx); |
| 614 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 14, ((const int *)pData)[14], ((const int *)pData)[14]); |
| 615 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HookDy=%d" , aRawData, pObj->m_HookDy); |
| 616 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 15, ((const int *)pData)[15], ((const int *)pData)[15]); |
| 617 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Health=%d (min=0 max=10)" , aRawData, pObj->m_Health); |
| 618 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 16, ((const int *)pData)[16], ((const int *)pData)[16]); |
| 619 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Armor=%d (min=0 max=10)" , aRawData, pObj->m_Armor); |
| 620 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 17, ((const int *)pData)[17], ((const int *)pData)[17]); |
| 621 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_AmmoCount=%d" , aRawData, pObj->m_AmmoCount); |
| 622 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 18, ((const int *)pData)[18], ((const int *)pData)[18]); |
| 623 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Weapon=%d (min=-1 max=NUM_WEAPONS-1(%d))" , aRawData, pObj->m_Weapon, (int)NUM_WEAPONS-1); |
| 624 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 19, ((const int *)pData)[19], ((const int *)pData)[19]); |
| 625 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Emote=%d (min=0 max=5)" , aRawData, pObj->m_Emote); |
| 626 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 20, ((const int *)pData)[20], ((const int *)pData)[20]); |
| 627 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_AttackTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_AttackTick, (int)max_int); |
| 628 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 21, ((const int *)pData)[21], ((const int *)pData)[21]); |
| 629 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_TriggeredEvents=%d (mask=%d)" , aRawData, pObj->m_TriggeredEvents, COREEVENTFLAG_GROUND_JUMP|COREEVENTFLAG_AIR_JUMP|COREEVENTFLAG_HOOK_ATTACH_PLAYER|COREEVENTFLAG_HOOK_ATTACH_GROUND|COREEVENTFLAG_HOOK_HIT_NOHOOK); |
| 630 | return 0; |
| 631 | } |
| 632 | |
| 633 | case NETOBJTYPE_PLAYERINFO: |
| 634 | { |
| 635 | CNetObj_PlayerInfo *pObj = (CNetObj_PlayerInfo *)pData; |
| 636 | if(sizeof(*pObj) != Size) return -1; |
| 637 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 638 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_PlayerFlags=%d (mask=%d)" , aRawData, pObj->m_PlayerFlags, PLAYERFLAG_ADMIN|PLAYERFLAG_CHATTING|PLAYERFLAG_SCOREBOARD|PLAYERFLAG_READY|PLAYERFLAG_DEAD|PLAYERFLAG_WATCHING|PLAYERFLAG_BOT|PLAYERFLAG_AIM); |
| 639 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 640 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Score=%d" , aRawData, pObj->m_Score); |
| 641 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 642 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Latency=%d" , aRawData, pObj->m_Latency); |
| 643 | return 0; |
| 644 | } |
| 645 | |
| 646 | case NETOBJTYPE_SPECTATORINFO: |
| 647 | { |
| 648 | CNetObj_SpectatorInfo *pObj = (CNetObj_SpectatorInfo *)pData; |
| 649 | if(sizeof(*pObj) != Size) return -1; |
| 650 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 651 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_SpecMode=%d (min=0 max=NUM_SPECMODES-1(%d))" , aRawData, pObj->m_SpecMode, (int)NUM_SPECMODES-1); |
| 652 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 653 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_SpectatorId=%d (min=-1 max=MAX_CLIENTS-1(%d))" , aRawData, pObj->m_SpectatorId, (int)MAX_CLIENTS-1); |
| 654 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 655 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 656 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 657 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 658 | return 0; |
| 659 | } |
| 660 | |
| 661 | case NETOBJTYPE_DE_CLIENTINFO: |
| 662 | { |
| 663 | CNetObj_De_ClientInfo *pObj = (CNetObj_De_ClientInfo *)pData; |
| 664 | if(sizeof(*pObj) != Size) return -1; |
| 665 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 666 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Local=%d (min=0 max=1)" , aRawData, pObj->m_Local); |
| 667 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 668 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Team=%d (min=TEAM_SPECTATORS(%d) max=TEAM_BLUE(%d))" , aRawData, pObj->m_Team, (int)TEAM_SPECTATORS, (int)TEAM_BLUE); |
| 669 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 670 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 671 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 672 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Country=%d" , aRawData, pObj->m_Country); |
| 673 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 5, ((const int *)pData)[5], ((const int *)pData)[5]); |
| 674 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 6, ((const int *)pData)[6], ((const int *)pData)[6]); |
| 675 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 7, ((const int *)pData)[7], ((const int *)pData)[7]); |
| 676 | return 0; |
| 677 | } |
| 678 | |
| 679 | case NETOBJTYPE_DE_GAMEINFO: |
| 680 | { |
| 681 | CNetObj_De_GameInfo *pObj = (CNetObj_De_GameInfo *)pData; |
| 682 | if(sizeof(*pObj) != Size) return -1; |
| 683 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 684 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_GameFlags=%d (mask=%d)" , aRawData, pObj->m_GameFlags, GAMEFLAG_TEAMS|GAMEFLAG_FLAGS|GAMEFLAG_SURVIVAL|GAMEFLAG_RACE); |
| 685 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 686 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_ScoreLimit=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_ScoreLimit, (int)max_int); |
| 687 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 688 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_TimeLimit=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_TimeLimit, (int)max_int); |
| 689 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 690 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_MatchNum=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_MatchNum, (int)max_int); |
| 691 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 692 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_MatchCurrent=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_MatchCurrent, (int)max_int); |
| 693 | return 0; |
| 694 | } |
| 695 | |
| 696 | case NETOBJTYPE_DE_TUNEPARAMS: |
| 697 | { |
| 698 | CNetObj_De_TuneParams *pObj = (CNetObj_De_TuneParams *)pData; |
| 699 | if(sizeof(*pObj) != Size) return -1; |
| 700 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 701 | return 0; |
| 702 | } |
| 703 | |
| 704 | case NETEVENTTYPE_COMMON: |
| 705 | { |
| 706 | CNetEvent_Common *pObj = (CNetEvent_Common *)pData; |
| 707 | if(sizeof(*pObj) != Size) return -1; |
| 708 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 709 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 710 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 711 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 712 | return 0; |
| 713 | } |
| 714 | |
| 715 | case NETEVENTTYPE_EXPLOSION: |
| 716 | { |
| 717 | CNetEvent_Explosion *pObj = (CNetEvent_Explosion *)pData; |
| 718 | if(sizeof(*pObj) != Size) return -1; |
| 719 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 720 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 721 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 722 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 723 | return 0; |
| 724 | } |
| 725 | |
| 726 | case NETEVENTTYPE_SPAWN: |
| 727 | { |
| 728 | CNetEvent_Spawn *pObj = (CNetEvent_Spawn *)pData; |
| 729 | if(sizeof(*pObj) != Size) return -1; |
| 730 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 731 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 732 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 733 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 734 | return 0; |
| 735 | } |
| 736 | |
| 737 | case NETEVENTTYPE_HAMMERHIT: |
| 738 | { |
| 739 | CNetEvent_HammerHit *pObj = (CNetEvent_HammerHit *)pData; |
| 740 | if(sizeof(*pObj) != Size) return -1; |
| 741 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 742 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 743 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 744 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 745 | return 0; |
| 746 | } |
| 747 | |
| 748 | case NETEVENTTYPE_DEATH: |
| 749 | { |
| 750 | CNetEvent_Death *pObj = (CNetEvent_Death *)pData; |
| 751 | if(sizeof(*pObj) != Size) return -1; |
| 752 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 753 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 754 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 755 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 756 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 757 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_ClientId=%d (min=0 max=MAX_CLIENTS-1(%d))" , aRawData, pObj->m_ClientId, (int)MAX_CLIENTS-1); |
| 758 | return 0; |
| 759 | } |
| 760 | |
| 761 | case NETEVENTTYPE_SOUNDWORLD: |
| 762 | { |
| 763 | CNetEvent_SoundWorld *pObj = (CNetEvent_SoundWorld *)pData; |
| 764 | if(sizeof(*pObj) != Size) return -1; |
| 765 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 766 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 767 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 768 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 769 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 770 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_SoundId=%d (min=0 max=NUM_SOUNDS-1(%d))" , aRawData, pObj->m_SoundId, (int)NUM_SOUNDS-1); |
| 771 | return 0; |
| 772 | } |
| 773 | |
| 774 | case NETEVENTTYPE_DAMAGE: |
| 775 | { |
| 776 | CNetEvent_Damage *pObj = (CNetEvent_Damage *)pData; |
| 777 | if(sizeof(*pObj) != Size) return -1; |
| 778 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 779 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_X=%d" , aRawData, pObj->m_X); |
| 780 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 781 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Y=%d" , aRawData, pObj->m_Y); |
| 782 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 783 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_ClientId=%d (min=0 max=MAX_CLIENTS-1(%d))" , aRawData, pObj->m_ClientId, (int)MAX_CLIENTS-1); |
| 784 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 3, ((const int *)pData)[3], ((const int *)pData)[3]); |
| 785 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Angle=%d" , aRawData, pObj->m_Angle); |
| 786 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 4, ((const int *)pData)[4], ((const int *)pData)[4]); |
| 787 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_HealthAmount=%d (min=0 max=9)" , aRawData, pObj->m_HealthAmount); |
| 788 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 5, ((const int *)pData)[5], ((const int *)pData)[5]); |
| 789 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_ArmorAmount=%d (min=0 max=9)" , aRawData, pObj->m_ArmorAmount); |
| 790 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 6, ((const int *)pData)[6], ((const int *)pData)[6]); |
| 791 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Self=%d (min=0 max=1)" , aRawData, pObj->m_Self); |
| 792 | return 0; |
| 793 | } |
| 794 | |
| 795 | case NETOBJTYPE_PLAYERINFORACE: |
| 796 | { |
| 797 | CNetObj_PlayerInfoRace *pObj = (CNetObj_PlayerInfoRace *)pData; |
| 798 | if(sizeof(*pObj) != Size) return -1; |
| 799 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 800 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_RaceStartTick=%d (min=0 max=max_int(%d))" , aRawData, pObj->m_RaceStartTick, (int)max_int); |
| 801 | return 0; |
| 802 | } |
| 803 | |
| 804 | case NETOBJTYPE_GAMEDATARACE: |
| 805 | { |
| 806 | CNetObj_GameDataRace *pObj = (CNetObj_GameDataRace *)pData; |
| 807 | if(sizeof(*pObj) != Size) return -1; |
| 808 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 0, ((const int *)pData)[0], ((const int *)pData)[0]); |
| 809 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_BestTime=%d (min=-1 max=max_int(%d))" , aRawData, pObj->m_BestTime, (int)max_int); |
| 810 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 1, ((const int *)pData)[1], ((const int *)pData)[1]); |
| 811 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_Precision=%d (min=0 max=3)" , aRawData, pObj->m_Precision); |
| 812 | str_format(buffer: aRawData, buffer_size: sizeof(aRawData), format: "\t\t%3d %12d\t%08x" , 2, ((const int *)pData)[2], ((const int *)pData)[2]); |
| 813 | dbg_msg(sys: "snapshot" , fmt: "%s\tm_RaceFlags=%d (mask=%d)" , aRawData, pObj->m_RaceFlags, RACEFLAG_HIDE_KILLMSG|RACEFLAG_FINISHMSG_AS_CHAT|RACEFLAG_KEEP_WANTED_WEAPON); |
| 814 | return 0; |
| 815 | } |
| 816 | |
| 817 | } |
| 818 | return -1; |
| 819 | }; |
| 820 | |
| 821 | void *CNetObjHandler::SecureUnpackMsg(int Type, CUnpacker *pUnpacker) |
| 822 | { |
| 823 | m_pMsgFailedOn = 0; |
| 824 | m_pObjFailedOn = 0; |
| 825 | switch(Type) |
| 826 | { |
| 827 | case NETMSGTYPE_SV_MOTD: |
| 828 | { |
| 829 | CNetMsg_Sv_Motd *pMsg = (CNetMsg_Sv_Motd *)m_aMsgData; |
| 830 | (void)pMsg; |
| 831 | pMsg->m_pMessage = pUnpacker->GetString(); |
| 832 | } break; |
| 833 | |
| 834 | case NETMSGTYPE_SV_BROADCAST: |
| 835 | { |
| 836 | CNetMsg_Sv_Broadcast *pMsg = (CNetMsg_Sv_Broadcast *)m_aMsgData; |
| 837 | (void)pMsg; |
| 838 | pMsg->m_pMessage = pUnpacker->GetString(); |
| 839 | } break; |
| 840 | |
| 841 | case NETMSGTYPE_SV_CHAT: |
| 842 | { |
| 843 | CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)m_aMsgData; |
| 844 | (void)pMsg; |
| 845 | pMsg->m_Mode = pUnpacker->GetInt(); |
| 846 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 847 | pMsg->m_TargetId = pUnpacker->GetInt(); |
| 848 | pMsg->m_pMessage = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 849 | if(!CheckInt(pErrorMsg: "m_Mode" , Value: pMsg->m_Mode, Min: 0, Max: NUM_CHATS-1)) break; |
| 850 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 851 | if(!CheckInt(pErrorMsg: "m_TargetId" , Value: pMsg->m_TargetId, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 852 | } break; |
| 853 | |
| 854 | case NETMSGTYPE_SV_TEAM: |
| 855 | { |
| 856 | CNetMsg_Sv_Team *pMsg = (CNetMsg_Sv_Team *)m_aMsgData; |
| 857 | (void)pMsg; |
| 858 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 859 | pMsg->m_Team = pUnpacker->GetInt(); |
| 860 | pMsg->m_Silent = pUnpacker->GetInt(); |
| 861 | pMsg->m_CooldownTick = pUnpacker->GetInt(); |
| 862 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 863 | if(!CheckInt(pErrorMsg: "m_Team" , Value: pMsg->m_Team, Min: TEAM_SPECTATORS, Max: TEAM_BLUE)) break; |
| 864 | if(!CheckInt(pErrorMsg: "m_Silent" , Value: pMsg->m_Silent, Min: 0, Max: 1)) break; |
| 865 | if(!CheckInt(pErrorMsg: "m_CooldownTick" , Value: pMsg->m_CooldownTick, Min: 0, Max: max_int)) break; |
| 866 | } break; |
| 867 | |
| 868 | case NETMSGTYPE_SV_KILLMSG: |
| 869 | { |
| 870 | CNetMsg_Sv_KillMsg *pMsg = (CNetMsg_Sv_KillMsg *)m_aMsgData; |
| 871 | (void)pMsg; |
| 872 | pMsg->m_Killer = pUnpacker->GetInt(); |
| 873 | pMsg->m_Victim = pUnpacker->GetInt(); |
| 874 | pMsg->m_Weapon = pUnpacker->GetInt(); |
| 875 | pMsg->m_ModeSpecial = pUnpacker->GetInt(); |
| 876 | if(!CheckInt(pErrorMsg: "m_Killer" , Value: pMsg->m_Killer, Min: -2, Max: MAX_CLIENTS-1)) break; |
| 877 | if(!CheckInt(pErrorMsg: "m_Victim" , Value: pMsg->m_Victim, Min: 0, Max: MAX_CLIENTS-1)) break; |
| 878 | if(!CheckInt(pErrorMsg: "m_Weapon" , Value: pMsg->m_Weapon, Min: -3, Max: NUM_WEAPONS-1)) break; |
| 879 | } break; |
| 880 | |
| 881 | case NETMSGTYPE_SV_TUNEPARAMS: |
| 882 | { |
| 883 | CNetMsg_Sv_TuneParams *pMsg = (CNetMsg_Sv_TuneParams *)m_aMsgData; |
| 884 | (void)pMsg; |
| 885 | } break; |
| 886 | |
| 887 | case NETMSGTYPE_UNUSED: |
| 888 | { |
| 889 | CNetMsg_Unused *pMsg = (CNetMsg_Unused *)m_aMsgData; |
| 890 | (void)pMsg; |
| 891 | } break; |
| 892 | |
| 893 | case NETMSGTYPE_SV_READYTOENTER: |
| 894 | { |
| 895 | CNetMsg_Sv_ReadyToEnter *pMsg = (CNetMsg_Sv_ReadyToEnter *)m_aMsgData; |
| 896 | (void)pMsg; |
| 897 | } break; |
| 898 | |
| 899 | case NETMSGTYPE_SV_WEAPONPICKUP: |
| 900 | { |
| 901 | CNetMsg_Sv_WeaponPickup *pMsg = (CNetMsg_Sv_WeaponPickup *)m_aMsgData; |
| 902 | (void)pMsg; |
| 903 | pMsg->m_Weapon = pUnpacker->GetInt(); |
| 904 | if(!CheckInt(pErrorMsg: "m_Weapon" , Value: pMsg->m_Weapon, Min: 0, Max: NUM_WEAPONS-1)) break; |
| 905 | } break; |
| 906 | |
| 907 | case NETMSGTYPE_SV_EMOTICON: |
| 908 | { |
| 909 | CNetMsg_Sv_Emoticon *pMsg = (CNetMsg_Sv_Emoticon *)m_aMsgData; |
| 910 | (void)pMsg; |
| 911 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 912 | pMsg->m_Emoticon = pUnpacker->GetInt(); |
| 913 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: 0, Max: MAX_CLIENTS-1)) break; |
| 914 | if(!CheckInt(pErrorMsg: "m_Emoticon" , Value: pMsg->m_Emoticon, Min: 0, Max: 15)) break; |
| 915 | } break; |
| 916 | |
| 917 | case NETMSGTYPE_SV_VOTECLEAROPTIONS: |
| 918 | { |
| 919 | CNetMsg_Sv_VoteClearOptions *pMsg = (CNetMsg_Sv_VoteClearOptions *)m_aMsgData; |
| 920 | (void)pMsg; |
| 921 | } break; |
| 922 | |
| 923 | case NETMSGTYPE_SV_VOTEOPTIONLISTADD: |
| 924 | { |
| 925 | CNetMsg_Sv_VoteOptionListAdd *pMsg = (CNetMsg_Sv_VoteOptionListAdd *)m_aMsgData; |
| 926 | (void)pMsg; |
| 927 | } break; |
| 928 | |
| 929 | case NETMSGTYPE_SV_VOTEOPTIONADD: |
| 930 | { |
| 931 | CNetMsg_Sv_VoteOptionAdd *pMsg = (CNetMsg_Sv_VoteOptionAdd *)m_aMsgData; |
| 932 | (void)pMsg; |
| 933 | pMsg->m_pDescription = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 934 | } break; |
| 935 | |
| 936 | case NETMSGTYPE_SV_VOTEOPTIONREMOVE: |
| 937 | { |
| 938 | CNetMsg_Sv_VoteOptionRemove *pMsg = (CNetMsg_Sv_VoteOptionRemove *)m_aMsgData; |
| 939 | (void)pMsg; |
| 940 | pMsg->m_pDescription = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 941 | } break; |
| 942 | |
| 943 | case NETMSGTYPE_SV_VOTESET: |
| 944 | { |
| 945 | CNetMsg_Sv_VoteSet *pMsg = (CNetMsg_Sv_VoteSet *)m_aMsgData; |
| 946 | (void)pMsg; |
| 947 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 948 | pMsg->m_Type = pUnpacker->GetInt(); |
| 949 | pMsg->m_Timeout = pUnpacker->GetInt(); |
| 950 | pMsg->m_pDescription = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 951 | pMsg->m_pReason = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 952 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 953 | if(!CheckInt(pErrorMsg: "m_Type" , Value: pMsg->m_Type, Min: 0, Max: 6)) break; |
| 954 | if(!CheckInt(pErrorMsg: "m_Timeout" , Value: pMsg->m_Timeout, Min: 0, Max: 60)) break; |
| 955 | } break; |
| 956 | |
| 957 | case NETMSGTYPE_SV_VOTESTATUS: |
| 958 | { |
| 959 | CNetMsg_Sv_VoteStatus *pMsg = (CNetMsg_Sv_VoteStatus *)m_aMsgData; |
| 960 | (void)pMsg; |
| 961 | pMsg->m_Yes = pUnpacker->GetInt(); |
| 962 | pMsg->m_No = pUnpacker->GetInt(); |
| 963 | pMsg->m_Pass = pUnpacker->GetInt(); |
| 964 | pMsg->m_Total = pUnpacker->GetInt(); |
| 965 | if(!CheckInt(pErrorMsg: "m_Yes" , Value: pMsg->m_Yes, Min: 0, Max: MAX_CLIENTS)) break; |
| 966 | if(!CheckInt(pErrorMsg: "m_No" , Value: pMsg->m_No, Min: 0, Max: MAX_CLIENTS)) break; |
| 967 | if(!CheckInt(pErrorMsg: "m_Pass" , Value: pMsg->m_Pass, Min: 0, Max: MAX_CLIENTS)) break; |
| 968 | if(!CheckInt(pErrorMsg: "m_Total" , Value: pMsg->m_Total, Min: 0, Max: MAX_CLIENTS)) break; |
| 969 | } break; |
| 970 | |
| 971 | case NETMSGTYPE_SV_SERVERSETTINGS: |
| 972 | { |
| 973 | CNetMsg_Sv_ServerSettings *pMsg = (CNetMsg_Sv_ServerSettings *)m_aMsgData; |
| 974 | (void)pMsg; |
| 975 | pMsg->m_KickVote = pUnpacker->GetInt(); |
| 976 | pMsg->m_KickMin = pUnpacker->GetInt(); |
| 977 | pMsg->m_SpecVote = pUnpacker->GetInt(); |
| 978 | pMsg->m_TeamLock = pUnpacker->GetInt(); |
| 979 | pMsg->m_TeamBalance = pUnpacker->GetInt(); |
| 980 | pMsg->m_PlayerSlots = pUnpacker->GetInt(); |
| 981 | if(!CheckInt(pErrorMsg: "m_KickVote" , Value: pMsg->m_KickVote, Min: 0, Max: 1)) break; |
| 982 | if(!CheckInt(pErrorMsg: "m_KickMin" , Value: pMsg->m_KickMin, Min: 0, Max: MAX_CLIENTS)) break; |
| 983 | if(!CheckInt(pErrorMsg: "m_SpecVote" , Value: pMsg->m_SpecVote, Min: 0, Max: 1)) break; |
| 984 | if(!CheckInt(pErrorMsg: "m_TeamLock" , Value: pMsg->m_TeamLock, Min: 0, Max: 1)) break; |
| 985 | if(!CheckInt(pErrorMsg: "m_TeamBalance" , Value: pMsg->m_TeamBalance, Min: 0, Max: 1)) break; |
| 986 | if(!CheckInt(pErrorMsg: "m_PlayerSlots" , Value: pMsg->m_PlayerSlots, Min: 0, Max: MAX_CLIENTS)) break; |
| 987 | } break; |
| 988 | |
| 989 | case NETMSGTYPE_SV_CLIENTINFO: |
| 990 | { |
| 991 | CNetMsg_Sv_ClientInfo *pMsg = (CNetMsg_Sv_ClientInfo *)m_aMsgData; |
| 992 | (void)pMsg; |
| 993 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 994 | pMsg->m_Local = pUnpacker->GetInt(); |
| 995 | pMsg->m_Team = pUnpacker->GetInt(); |
| 996 | pMsg->m_pName = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 997 | pMsg->m_pClan = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 998 | pMsg->m_Country = pUnpacker->GetInt(); |
| 999 | pMsg->m_apSkinPartNames[0] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1000 | pMsg->m_apSkinPartNames[1] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1001 | pMsg->m_apSkinPartNames[2] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1002 | pMsg->m_apSkinPartNames[3] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1003 | pMsg->m_apSkinPartNames[4] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1004 | pMsg->m_apSkinPartNames[5] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1005 | pMsg->m_aUseCustomColors[0] = pUnpacker->GetInt(); |
| 1006 | pMsg->m_aUseCustomColors[1] = pUnpacker->GetInt(); |
| 1007 | pMsg->m_aUseCustomColors[2] = pUnpacker->GetInt(); |
| 1008 | pMsg->m_aUseCustomColors[3] = pUnpacker->GetInt(); |
| 1009 | pMsg->m_aUseCustomColors[4] = pUnpacker->GetInt(); |
| 1010 | pMsg->m_aUseCustomColors[5] = pUnpacker->GetInt(); |
| 1011 | pMsg->m_aSkinPartColors[0] = pUnpacker->GetInt(); |
| 1012 | pMsg->m_aSkinPartColors[1] = pUnpacker->GetInt(); |
| 1013 | pMsg->m_aSkinPartColors[2] = pUnpacker->GetInt(); |
| 1014 | pMsg->m_aSkinPartColors[3] = pUnpacker->GetInt(); |
| 1015 | pMsg->m_aSkinPartColors[4] = pUnpacker->GetInt(); |
| 1016 | pMsg->m_aSkinPartColors[5] = pUnpacker->GetInt(); |
| 1017 | pMsg->m_Silent = pUnpacker->GetInt(); |
| 1018 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: 0, Max: MAX_CLIENTS-1)) break; |
| 1019 | if(!CheckInt(pErrorMsg: "m_Local" , Value: pMsg->m_Local, Min: 0, Max: 1)) break; |
| 1020 | if(!CheckInt(pErrorMsg: "m_Team" , Value: pMsg->m_Team, Min: TEAM_SPECTATORS, Max: TEAM_BLUE)) break; |
| 1021 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[0]" , Value: pMsg->m_aUseCustomColors[0], Min: 0, Max: 1)) break; |
| 1022 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[1]" , Value: pMsg->m_aUseCustomColors[1], Min: 0, Max: 1)) break; |
| 1023 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[2]" , Value: pMsg->m_aUseCustomColors[2], Min: 0, Max: 1)) break; |
| 1024 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[3]" , Value: pMsg->m_aUseCustomColors[3], Min: 0, Max: 1)) break; |
| 1025 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[4]" , Value: pMsg->m_aUseCustomColors[4], Min: 0, Max: 1)) break; |
| 1026 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[5]" , Value: pMsg->m_aUseCustomColors[5], Min: 0, Max: 1)) break; |
| 1027 | if(!CheckInt(pErrorMsg: "m_Silent" , Value: pMsg->m_Silent, Min: 0, Max: 1)) break; |
| 1028 | } break; |
| 1029 | |
| 1030 | case NETMSGTYPE_SV_GAMEINFO: |
| 1031 | { |
| 1032 | CNetMsg_Sv_GameInfo *pMsg = (CNetMsg_Sv_GameInfo *)m_aMsgData; |
| 1033 | (void)pMsg; |
| 1034 | pMsg->m_GameFlags = pUnpacker->GetInt(); |
| 1035 | pMsg->m_ScoreLimit = pUnpacker->GetInt(); |
| 1036 | pMsg->m_TimeLimit = pUnpacker->GetInt(); |
| 1037 | pMsg->m_MatchNum = pUnpacker->GetInt(); |
| 1038 | pMsg->m_MatchCurrent = pUnpacker->GetInt(); |
| 1039 | if(!CheckFlag(pErrorMsg: "m_GameFlags" , Value: pMsg->m_GameFlags, Mask: GAMEFLAG_TEAMS|GAMEFLAG_FLAGS|GAMEFLAG_SURVIVAL|GAMEFLAG_RACE)) break; |
| 1040 | if(!CheckInt(pErrorMsg: "m_ScoreLimit" , Value: pMsg->m_ScoreLimit, Min: 0, Max: max_int)) break; |
| 1041 | if(!CheckInt(pErrorMsg: "m_TimeLimit" , Value: pMsg->m_TimeLimit, Min: 0, Max: max_int)) break; |
| 1042 | if(!CheckInt(pErrorMsg: "m_MatchNum" , Value: pMsg->m_MatchNum, Min: 0, Max: max_int)) break; |
| 1043 | if(!CheckInt(pErrorMsg: "m_MatchCurrent" , Value: pMsg->m_MatchCurrent, Min: 0, Max: max_int)) break; |
| 1044 | } break; |
| 1045 | |
| 1046 | case NETMSGTYPE_SV_CLIENTDROP: |
| 1047 | { |
| 1048 | CNetMsg_Sv_ClientDrop *pMsg = (CNetMsg_Sv_ClientDrop *)m_aMsgData; |
| 1049 | (void)pMsg; |
| 1050 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 1051 | pMsg->m_pReason = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1052 | pMsg->m_Silent = pUnpacker->GetInt(); |
| 1053 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: 0, Max: MAX_CLIENTS-1)) break; |
| 1054 | if(!CheckInt(pErrorMsg: "m_Silent" , Value: pMsg->m_Silent, Min: 0, Max: 1)) break; |
| 1055 | } break; |
| 1056 | |
| 1057 | case NETMSGTYPE_SV_GAMEMSG: |
| 1058 | { |
| 1059 | CNetMsg_Sv_GameMsg *pMsg = (CNetMsg_Sv_GameMsg *)m_aMsgData; |
| 1060 | (void)pMsg; |
| 1061 | } break; |
| 1062 | |
| 1063 | case NETMSGTYPE_DE_CLIENTENTER: |
| 1064 | { |
| 1065 | CNetMsg_De_ClientEnter *pMsg = (CNetMsg_De_ClientEnter *)m_aMsgData; |
| 1066 | (void)pMsg; |
| 1067 | pMsg->m_pName = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1068 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 1069 | pMsg->m_Team = pUnpacker->GetInt(); |
| 1070 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 1071 | if(!CheckInt(pErrorMsg: "m_Team" , Value: pMsg->m_Team, Min: TEAM_SPECTATORS, Max: TEAM_BLUE)) break; |
| 1072 | } break; |
| 1073 | |
| 1074 | case NETMSGTYPE_DE_CLIENTLEAVE: |
| 1075 | { |
| 1076 | CNetMsg_De_ClientLeave *pMsg = (CNetMsg_De_ClientLeave *)m_aMsgData; |
| 1077 | (void)pMsg; |
| 1078 | pMsg->m_pName = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1079 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 1080 | pMsg->m_pReason = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1081 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 1082 | } break; |
| 1083 | |
| 1084 | case NETMSGTYPE_CL_SAY: |
| 1085 | { |
| 1086 | CNetMsg_Cl_Say *pMsg = (CNetMsg_Cl_Say *)m_aMsgData; |
| 1087 | (void)pMsg; |
| 1088 | pMsg->m_Mode = pUnpacker->GetInt(); |
| 1089 | pMsg->m_Target = pUnpacker->GetInt(); |
| 1090 | pMsg->m_pMessage = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1091 | if(!CheckInt(pErrorMsg: "m_Mode" , Value: pMsg->m_Mode, Min: 0, Max: NUM_CHATS-1)) break; |
| 1092 | if(!CheckInt(pErrorMsg: "m_Target" , Value: pMsg->m_Target, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 1093 | } break; |
| 1094 | |
| 1095 | case NETMSGTYPE_CL_SETTEAM: |
| 1096 | { |
| 1097 | CNetMsg_Cl_SetTeam *pMsg = (CNetMsg_Cl_SetTeam *)m_aMsgData; |
| 1098 | (void)pMsg; |
| 1099 | pMsg->m_Team = pUnpacker->GetInt(); |
| 1100 | if(!CheckInt(pErrorMsg: "m_Team" , Value: pMsg->m_Team, Min: TEAM_SPECTATORS, Max: TEAM_BLUE)) break; |
| 1101 | } break; |
| 1102 | |
| 1103 | case NETMSGTYPE_CL_SETSPECTATORMODE: |
| 1104 | { |
| 1105 | CNetMsg_Cl_SetSpectatorMode *pMsg = (CNetMsg_Cl_SetSpectatorMode *)m_aMsgData; |
| 1106 | (void)pMsg; |
| 1107 | pMsg->m_SpecMode = pUnpacker->GetInt(); |
| 1108 | pMsg->m_SpectatorId = pUnpacker->GetInt(); |
| 1109 | if(!CheckInt(pErrorMsg: "m_SpecMode" , Value: pMsg->m_SpecMode, Min: 0, Max: NUM_SPECMODES-1)) break; |
| 1110 | if(!CheckInt(pErrorMsg: "m_SpectatorId" , Value: pMsg->m_SpectatorId, Min: -1, Max: MAX_CLIENTS-1)) break; |
| 1111 | } break; |
| 1112 | |
| 1113 | case NETMSGTYPE_CL_STARTINFO: |
| 1114 | { |
| 1115 | CNetMsg_Cl_StartInfo *pMsg = (CNetMsg_Cl_StartInfo *)m_aMsgData; |
| 1116 | (void)pMsg; |
| 1117 | pMsg->m_pName = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1118 | pMsg->m_pClan = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1119 | pMsg->m_Country = pUnpacker->GetInt(); |
| 1120 | pMsg->m_apSkinPartNames[0] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1121 | pMsg->m_apSkinPartNames[1] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1122 | pMsg->m_apSkinPartNames[2] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1123 | pMsg->m_apSkinPartNames[3] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1124 | pMsg->m_apSkinPartNames[4] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1125 | pMsg->m_apSkinPartNames[5] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1126 | pMsg->m_aUseCustomColors[0] = pUnpacker->GetInt(); |
| 1127 | pMsg->m_aUseCustomColors[1] = pUnpacker->GetInt(); |
| 1128 | pMsg->m_aUseCustomColors[2] = pUnpacker->GetInt(); |
| 1129 | pMsg->m_aUseCustomColors[3] = pUnpacker->GetInt(); |
| 1130 | pMsg->m_aUseCustomColors[4] = pUnpacker->GetInt(); |
| 1131 | pMsg->m_aUseCustomColors[5] = pUnpacker->GetInt(); |
| 1132 | pMsg->m_aSkinPartColors[0] = pUnpacker->GetInt(); |
| 1133 | pMsg->m_aSkinPartColors[1] = pUnpacker->GetInt(); |
| 1134 | pMsg->m_aSkinPartColors[2] = pUnpacker->GetInt(); |
| 1135 | pMsg->m_aSkinPartColors[3] = pUnpacker->GetInt(); |
| 1136 | pMsg->m_aSkinPartColors[4] = pUnpacker->GetInt(); |
| 1137 | pMsg->m_aSkinPartColors[5] = pUnpacker->GetInt(); |
| 1138 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[0]" , Value: pMsg->m_aUseCustomColors[0], Min: 0, Max: 1)) break; |
| 1139 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[1]" , Value: pMsg->m_aUseCustomColors[1], Min: 0, Max: 1)) break; |
| 1140 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[2]" , Value: pMsg->m_aUseCustomColors[2], Min: 0, Max: 1)) break; |
| 1141 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[3]" , Value: pMsg->m_aUseCustomColors[3], Min: 0, Max: 1)) break; |
| 1142 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[4]" , Value: pMsg->m_aUseCustomColors[4], Min: 0, Max: 1)) break; |
| 1143 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[5]" , Value: pMsg->m_aUseCustomColors[5], Min: 0, Max: 1)) break; |
| 1144 | } break; |
| 1145 | |
| 1146 | case NETMSGTYPE_CL_KILL: |
| 1147 | { |
| 1148 | CNetMsg_Cl_Kill *pMsg = (CNetMsg_Cl_Kill *)m_aMsgData; |
| 1149 | (void)pMsg; |
| 1150 | } break; |
| 1151 | |
| 1152 | case NETMSGTYPE_CL_READYCHANGE: |
| 1153 | { |
| 1154 | CNetMsg_Cl_ReadyChange *pMsg = (CNetMsg_Cl_ReadyChange *)m_aMsgData; |
| 1155 | (void)pMsg; |
| 1156 | } break; |
| 1157 | |
| 1158 | case NETMSGTYPE_CL_EMOTICON: |
| 1159 | { |
| 1160 | CNetMsg_Cl_Emoticon *pMsg = (CNetMsg_Cl_Emoticon *)m_aMsgData; |
| 1161 | (void)pMsg; |
| 1162 | pMsg->m_Emoticon = pUnpacker->GetInt(); |
| 1163 | if(!CheckInt(pErrorMsg: "m_Emoticon" , Value: pMsg->m_Emoticon, Min: 0, Max: 15)) break; |
| 1164 | } break; |
| 1165 | |
| 1166 | case NETMSGTYPE_CL_VOTE: |
| 1167 | { |
| 1168 | CNetMsg_Cl_Vote *pMsg = (CNetMsg_Cl_Vote *)m_aMsgData; |
| 1169 | (void)pMsg; |
| 1170 | pMsg->m_Vote = pUnpacker->GetInt(); |
| 1171 | if(!CheckInt(pErrorMsg: "m_Vote" , Value: pMsg->m_Vote, Min: -1, Max: 1)) break; |
| 1172 | } break; |
| 1173 | |
| 1174 | case NETMSGTYPE_CL_CALLVOTE: |
| 1175 | { |
| 1176 | CNetMsg_Cl_CallVote *pMsg = (CNetMsg_Cl_CallVote *)m_aMsgData; |
| 1177 | (void)pMsg; |
| 1178 | pMsg->m_pType = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1179 | pMsg->m_pValue = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1180 | pMsg->m_pReason = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1181 | pMsg->m_Force = pUnpacker->GetInt(); |
| 1182 | if(!CheckInt(pErrorMsg: "m_Force" , Value: pMsg->m_Force, Min: 0, Max: 1)) break; |
| 1183 | } break; |
| 1184 | |
| 1185 | case NETMSGTYPE_SV_SKINCHANGE: |
| 1186 | { |
| 1187 | CNetMsg_Sv_SkinChange *pMsg = (CNetMsg_Sv_SkinChange *)m_aMsgData; |
| 1188 | (void)pMsg; |
| 1189 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 1190 | pMsg->m_apSkinPartNames[0] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1191 | pMsg->m_apSkinPartNames[1] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1192 | pMsg->m_apSkinPartNames[2] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1193 | pMsg->m_apSkinPartNames[3] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1194 | pMsg->m_apSkinPartNames[4] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1195 | pMsg->m_apSkinPartNames[5] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1196 | pMsg->m_aUseCustomColors[0] = pUnpacker->GetInt(); |
| 1197 | pMsg->m_aUseCustomColors[1] = pUnpacker->GetInt(); |
| 1198 | pMsg->m_aUseCustomColors[2] = pUnpacker->GetInt(); |
| 1199 | pMsg->m_aUseCustomColors[3] = pUnpacker->GetInt(); |
| 1200 | pMsg->m_aUseCustomColors[4] = pUnpacker->GetInt(); |
| 1201 | pMsg->m_aUseCustomColors[5] = pUnpacker->GetInt(); |
| 1202 | pMsg->m_aSkinPartColors[0] = pUnpacker->GetInt(); |
| 1203 | pMsg->m_aSkinPartColors[1] = pUnpacker->GetInt(); |
| 1204 | pMsg->m_aSkinPartColors[2] = pUnpacker->GetInt(); |
| 1205 | pMsg->m_aSkinPartColors[3] = pUnpacker->GetInt(); |
| 1206 | pMsg->m_aSkinPartColors[4] = pUnpacker->GetInt(); |
| 1207 | pMsg->m_aSkinPartColors[5] = pUnpacker->GetInt(); |
| 1208 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: 0, Max: MAX_CLIENTS-1)) break; |
| 1209 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[0]" , Value: pMsg->m_aUseCustomColors[0], Min: 0, Max: 1)) break; |
| 1210 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[1]" , Value: pMsg->m_aUseCustomColors[1], Min: 0, Max: 1)) break; |
| 1211 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[2]" , Value: pMsg->m_aUseCustomColors[2], Min: 0, Max: 1)) break; |
| 1212 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[3]" , Value: pMsg->m_aUseCustomColors[3], Min: 0, Max: 1)) break; |
| 1213 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[4]" , Value: pMsg->m_aUseCustomColors[4], Min: 0, Max: 1)) break; |
| 1214 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[5]" , Value: pMsg->m_aUseCustomColors[5], Min: 0, Max: 1)) break; |
| 1215 | } break; |
| 1216 | |
| 1217 | case NETMSGTYPE_CL_SKINCHANGE: |
| 1218 | { |
| 1219 | CNetMsg_Cl_SkinChange *pMsg = (CNetMsg_Cl_SkinChange *)m_aMsgData; |
| 1220 | (void)pMsg; |
| 1221 | pMsg->m_apSkinPartNames[0] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1222 | pMsg->m_apSkinPartNames[1] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1223 | pMsg->m_apSkinPartNames[2] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1224 | pMsg->m_apSkinPartNames[3] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1225 | pMsg->m_apSkinPartNames[4] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1226 | pMsg->m_apSkinPartNames[5] = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1227 | pMsg->m_aUseCustomColors[0] = pUnpacker->GetInt(); |
| 1228 | pMsg->m_aUseCustomColors[1] = pUnpacker->GetInt(); |
| 1229 | pMsg->m_aUseCustomColors[2] = pUnpacker->GetInt(); |
| 1230 | pMsg->m_aUseCustomColors[3] = pUnpacker->GetInt(); |
| 1231 | pMsg->m_aUseCustomColors[4] = pUnpacker->GetInt(); |
| 1232 | pMsg->m_aUseCustomColors[5] = pUnpacker->GetInt(); |
| 1233 | pMsg->m_aSkinPartColors[0] = pUnpacker->GetInt(); |
| 1234 | pMsg->m_aSkinPartColors[1] = pUnpacker->GetInt(); |
| 1235 | pMsg->m_aSkinPartColors[2] = pUnpacker->GetInt(); |
| 1236 | pMsg->m_aSkinPartColors[3] = pUnpacker->GetInt(); |
| 1237 | pMsg->m_aSkinPartColors[4] = pUnpacker->GetInt(); |
| 1238 | pMsg->m_aSkinPartColors[5] = pUnpacker->GetInt(); |
| 1239 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[0]" , Value: pMsg->m_aUseCustomColors[0], Min: 0, Max: 1)) break; |
| 1240 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[1]" , Value: pMsg->m_aUseCustomColors[1], Min: 0, Max: 1)) break; |
| 1241 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[2]" , Value: pMsg->m_aUseCustomColors[2], Min: 0, Max: 1)) break; |
| 1242 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[3]" , Value: pMsg->m_aUseCustomColors[3], Min: 0, Max: 1)) break; |
| 1243 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[4]" , Value: pMsg->m_aUseCustomColors[4], Min: 0, Max: 1)) break; |
| 1244 | if(!CheckInt(pErrorMsg: "m_aUseCustomColors[5]" , Value: pMsg->m_aUseCustomColors[5], Min: 0, Max: 1)) break; |
| 1245 | } break; |
| 1246 | |
| 1247 | case NETMSGTYPE_SV_RACEFINISH: |
| 1248 | { |
| 1249 | CNetMsg_Sv_RaceFinish *pMsg = (CNetMsg_Sv_RaceFinish *)m_aMsgData; |
| 1250 | (void)pMsg; |
| 1251 | pMsg->m_ClientId = pUnpacker->GetInt(); |
| 1252 | pMsg->m_Time = pUnpacker->GetInt(); |
| 1253 | pMsg->m_Diff = pUnpacker->GetInt(); |
| 1254 | pMsg->m_RecordPersonal = pUnpacker->GetInt(); |
| 1255 | pMsg->m_RecordServer = pUnpacker->GetIntOrDefault(Default: 0); |
| 1256 | if(!CheckInt(pErrorMsg: "m_ClientId" , Value: pMsg->m_ClientId, Min: 0, Max: MAX_CLIENTS-1)) break; |
| 1257 | if(!CheckInt(pErrorMsg: "m_Time" , Value: pMsg->m_Time, Min: -1, Max: max_int)) break; |
| 1258 | if(!CheckInt(pErrorMsg: "m_RecordPersonal" , Value: pMsg->m_RecordPersonal, Min: 0, Max: 1)) break; |
| 1259 | if(!CheckInt(pErrorMsg: "m_RecordServer" , Value: pMsg->m_RecordServer, Min: 0, Max: 1)) break; |
| 1260 | } break; |
| 1261 | |
| 1262 | case NETMSGTYPE_SV_CHECKPOINT: |
| 1263 | { |
| 1264 | CNetMsg_Sv_Checkpoint *pMsg = (CNetMsg_Sv_Checkpoint *)m_aMsgData; |
| 1265 | (void)pMsg; |
| 1266 | pMsg->m_Diff = pUnpacker->GetInt(); |
| 1267 | } break; |
| 1268 | |
| 1269 | case NETMSGTYPE_SV_COMMANDINFO: |
| 1270 | { |
| 1271 | CNetMsg_Sv_CommandInfo *pMsg = (CNetMsg_Sv_CommandInfo *)m_aMsgData; |
| 1272 | (void)pMsg; |
| 1273 | pMsg->m_pName = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1274 | pMsg->m_pArgsFormat = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1275 | pMsg->m_pHelpText = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1276 | } break; |
| 1277 | |
| 1278 | case NETMSGTYPE_SV_COMMANDINFOREMOVE: |
| 1279 | { |
| 1280 | CNetMsg_Sv_CommandInfoRemove *pMsg = (CNetMsg_Sv_CommandInfoRemove *)m_aMsgData; |
| 1281 | (void)pMsg; |
| 1282 | pMsg->m_pName = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1283 | } break; |
| 1284 | |
| 1285 | case NETMSGTYPE_CL_COMMAND: |
| 1286 | { |
| 1287 | CNetMsg_Cl_Command *pMsg = (CNetMsg_Cl_Command *)m_aMsgData; |
| 1288 | (void)pMsg; |
| 1289 | pMsg->m_pName = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1290 | pMsg->m_pArguments = pUnpacker->GetString(SanitizeType: CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES); |
| 1291 | } break; |
| 1292 | |
| 1293 | default: |
| 1294 | m_pMsgFailedOn = "(type out of range)" ; |
| 1295 | break; |
| 1296 | } |
| 1297 | |
| 1298 | if(pUnpacker->Error()) |
| 1299 | m_pMsgFailedOn = "(unpack error)" ; |
| 1300 | |
| 1301 | if(m_pMsgFailedOn || m_pObjFailedOn) { |
| 1302 | if(!m_pMsgFailedOn) |
| 1303 | m_pMsgFailedOn = "" ; |
| 1304 | if(!m_pObjFailedOn) |
| 1305 | m_pObjFailedOn = "" ; |
| 1306 | return 0; |
| 1307 | } |
| 1308 | m_pMsgFailedOn = "" ; |
| 1309 | m_pObjFailedOn = "" ; |
| 1310 | return m_aMsgData; |
| 1311 | }; |
| 1312 | } |
| 1313 | |
| 1314 | |