| 369 | |
| 370 | extern float g_fCatchObjectTime; |
| 371 | u32 xrServer::OnMessage(NET_Packet& P, ClientID sender) // Non-Zero means broadcasting with "flags" as returned |
| 372 | { |
| 373 | u16 type; |
| 374 | P.r_begin(type); |
| 375 | |
| 376 | csPlayers.Enter(); |
| 377 | |
| 378 | VERIFY(verify_entities()); |
| 379 | xrClientData* CL = ID_to_client(sender); |
| 380 | |
| 381 | switch (type) |
| 382 | { |
| 383 | case M_UPDATE: { |
| 384 | Process_update(P, sender); // No broadcast |
| 385 | VERIFY(verify_entities()); |
| 386 | } |
| 387 | break; |
| 388 | case M_SPAWN: { |
| 389 | if (CL->flags.bLocal) |
| 390 | Process_spawn(P, sender); |
| 391 | |
| 392 | VERIFY(verify_entities()); |
| 393 | } |
| 394 | break; |
| 395 | case M_EVENT: { |
| 396 | Process_event(P, sender); |
| 397 | VERIFY(verify_entities()); |
| 398 | } |
| 399 | break; |
| 400 | case M_EVENT_PACK: { |
| 401 | NET_Packet tmpP; |
| 402 | while (!P.r_eof()) |
| 403 | { |
| 404 | tmpP.B.count = P.r_u8(); |
| 405 | P.r(&tmpP.B.data, tmpP.B.count); |
| 406 | |
| 407 | OnMessage(tmpP, sender); |
| 408 | } |
| 409 | } |
| 410 | break; |
| 411 | case M_CLIENTREADY: { |
| 412 | xrClientData* CL = ID_to_client(sender); |
| 413 | if (CL) |
| 414 | { |
| 415 | CL->net_Ready = TRUE; |
| 416 | CL->ps->DeathTime = Device.dwTimeGlobal; |
| 417 | CL->ps->setName(CL->name.c_str()); |
| 418 | }; |
| 419 | game->signal_Syncronize(); |
| 420 | VERIFY(verify_entities()); |
| 421 | } |
| 422 | break; |
| 423 | case M_SWITCH_DISTANCE: { |
| 424 | game->switch_distance(P, sender); |
| 425 | VERIFY(verify_entities()); |
| 426 | } |
| 427 | break; |
| 428 | case M_CHANGE_LEVEL: { |
no test coverage detected