MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Process_event

Method Process_event

ogsr_engine/xrGame/xrServer_process_event.cpp:15–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#pragma todo("KRodin: заменить на прямые вызовы вместо этих всратых ивентов!")
14
15void xrServer::Process_event(NET_Packet& P, ClientID sender)
16{
17#ifdef SLOW_VERIFY_ENTITIES
18 VERIFY(verify_entities());
19#endif
20
21 u32 timestamp;
22 u16 type;
23 u16 destination;
24 u32 MODE = net_flags(TRUE, TRUE);
25
26 // correct timestamp with server-unique-time (note: direct message correction)
27 P.r_u32(timestamp);
28
29 // read generic info
30 P.r_u16(type);
31 P.r_u16(destination);
32
33 CSE_Abstract* receiver = game->get_entity_from_eid(destination);
34 if (receiver)
35 {
36 if (!receiver->owner)
37 {
38 Msg("!![%s] Cnt't find owner for receiver with id [%u]. May be it already destroyed.", __FUNCTION__, destination);
39 return;
40 }
41
42 receiver->OnEvent(P, type, timestamp, sender);
43 }
44
45 switch (type)
46 {
47 case GE_INFO_TRANSFER:
48 case GE_WPN_STATE_CHANGE:
49 case GEG_PLAYER_ATTACH_HOLDER:
50 case GEG_PLAYER_DETACH_HOLDER:
51 case GEG_PLAYER_ACTIVATEARTEFACT:
52 case GEG_PLAYER_ITEM2SLOT:
53 case GEG_PLAYER_ITEM2BELT:
54 case GEG_PLAYER_ITEM2RUCK:
55 case GE_GRENADE_EXPLODE: {
56 SendBroadcast(BroadcastCID, P, MODE);
57 }
58 break;
59 case GE_TRADE_BUY:
60 case GE_OWNERSHIP_TAKE:
61 case GE_TRANSFER_TAKE: {
62 Process_event_ownership(P, sender, timestamp, destination);
63 VERIFY(verify_entities());
64 }
65 break;
66 case GE_TRADE_SELL:
67 case GE_OWNERSHIP_REJECT:
68 case GE_TRANSFER_REJECT:
69 case GE_LAUNCH_ROCKET: {
70 Process_event_reject(P, sender, timestamp, destination, P.r_u16());
71 VERIFY(verify_entities());
72 }

Callers

nothing calls this directly

Calls 15

net_flagsFunction · 0.85
MsgFunction · 0.85
ClientIDClass · 0.85
get_entity_from_eidMethod · 0.80
AddDelayedEventMethod · 0.80
set_visualMethod · 0.80
get_clientMethod · 0.80
w_beginMethod · 0.80
w_clientIDMethod · 0.80
r_u32Method · 0.45
r_u16Method · 0.45
OnEventMethod · 0.45

Tested by

no test coverage detected