Xonotic
net.qh File Reference
#include "registry.qh"
#include "sort.qh"
#include "yenc.qh"
+ Include dependency graph for net.qh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NET_GUARD(id)
 
#define NET_HANDLE(id, param)   bool Net_Handle_##id(entity this, entity sender, param)
 
#define Read_byte()   ReadByte()
 
#define Read_float()   ReadFloat()
 
#define Read_int()   ReadInt24_t()
 
#define Read_string()   ReadString()
 
#define ReadRegistered(r)   REGISTRY_GET(r, Read_byte())
 
#define REGISTER_NET_C2S(id)
 
#define REGISTER_NET_LINKED(id)
 
#define REGISTER_NET_S2C(id)   REGISTER_NET_TEMP(id)
 
#define REGISTER_NET_TEMP(id)
 
#define serialize(T, stream, ...)
 
#define serialize_marker(stream, this)
 
#define serialize_vector(stream, this)
 
#define Write_byte(to, f)   WriteByte(to, f)
 
#define Write_float(to, f)   WriteFloat(to, f)
 
#define Write_int(to, f)   WriteInt24_t(to, f)
 
#define Write_string(to, f)   WriteString(to, f)
 
#define WriteRegistered(r, to, it)   Write_byte(to, it.m_id)
 

Typedefs

using Stream = int
 

Functions

 bool (entity this, entity sender, bool isNew) m_read
 
 STATIC_INIT (TempEntities_renumber)
 
 STATIC_INIT (LinkedEntities_renumber)
 
 STATIC_INIT (C2S_Protocol_renumber)
 

Variables

int m_id
 
string netname
 

Macro Definition Documentation

◆ NET_GUARD

#define NET_GUARD (   id)
Value:
bool Net_Handle_##id##_guard(entity this, entity sender, bool isNew) { \
bool valid = false; \
serialize_marker(to, valid); \
if (!valid) LOG_FATALF("Last message not fully parsed: %s", _net_prevmsgstr); \
_net_prevmsgstr = #id; \
return Net_Handle_##id(this, sender, isNew); \
}
entity() spawn
entity to
Definition: self.qh:96
#define LOG_FATALF(...)
Definition: log.qh:59

Definition at line 14 of file net.qh.

◆ NET_HANDLE

◆ Read_byte

#define Read_byte ( )    ReadByte()

Definition at line 296 of file net.qh.

◆ Read_float

#define Read_float ( )    ReadFloat()

Definition at line 331 of file net.qh.

◆ Read_int

#define Read_int ( )    ReadInt24_t()

Definition at line 328 of file net.qh.

◆ Read_string

#define Read_string ( )    ReadString()

Definition at line 334 of file net.qh.

◆ ReadRegistered

#define ReadRegistered (   r)    REGISTRY_GET(r, Read_byte())

Definition at line 293 of file net.qh.

Referenced by NET_HANDLE(), and W_Model().

◆ REGISTER_NET_C2S

#define REGISTER_NET_C2S (   id)
Value:
const bool NET_##id##_istemp = true; \
REGISTER(C2S_Protocol, NET, id, m_id, new_pure(net_c2s_packet)) \
{ \
this.netname = #id; \
}
int m_id
Definition: net.qh:10
#define new_pure(class)
purely logical entities (.origin doesn't work)
Definition: oo.qh:62

Definition at line 94 of file net.qh.

Referenced by W_Model().

◆ REGISTER_NET_LINKED

#define REGISTER_NET_LINKED (   id)
Value:
const bool NET_##id##_istemp = false; \
REGISTER(LinkedEntities, NET, id, m_id, new_pure(net_linked_packet)) \
{ \
this.netname = #id; \
}
int m_id
Definition: net.qh:10
#define new_pure(class)
purely logical entities (.origin doesn't work)
Definition: oo.qh:62

Definition at line 67 of file net.qh.

Referenced by LinkDoors(), Local_Notification_WOVA(), train_next(), trigger_impulse_touch_radial(), and trigger_keylock_touch().

◆ REGISTER_NET_S2C

#define REGISTER_NET_S2C (   id)    REGISTER_NET_TEMP(id)

Definition at line 40 of file net.qh.

◆ REGISTER_NET_TEMP

#define REGISTER_NET_TEMP (   id)
Value:
const bool NET_##id##_istemp = true; \
REGISTER(TempEntities, NET, id, m_id, new_pure(net_temp_packet)) \
{ \
this.netname = #id; \
}
int m_id
Definition: net.qh:10
#define new_pure(class)
purely logical entities (.origin doesn't work)
Definition: oo.qh:62

Definition at line 33 of file net.qh.

Referenced by GENERIC_COMMAND(), and W_Model().

◆ serialize

#define serialize (   T,
  stream,
  ... 
)
Value:
MACRO_BEGIN \
noref Stream _stream = stream; \
serialize_##T(_stream, __VA_ARGS__); \
MACRO_END
int Stream
Definition: net.qh:229

Definition at line 238 of file net.qh.

Referenced by EliminatedPlayers_SendEntity(), and NET_HANDLE().

◆ serialize_marker

#define serialize_marker (   stream,
  this 
)
Value:
if (NDEBUG) { \
this = true; \
} else { \
int _de = 0xDE, _ad = 0xAD, _be = 0xBE, _ef = 0xEF; \
serialize_byte(stream, _de); \
serialize_byte(stream, _ad); \
serialize_byte(stream, _be); \
serialize_byte(stream, _ef); \
this = (_de == 0xDE && _ad == 0xAD && _be == 0xBE && _ef == 0xEF); \
} \
MACRO_END
if(IS_DEAD(this))
Definition: impulse.qc:92

Definition at line 277 of file net.qh.

◆ serialize_vector

#define serialize_vector (   stream,
  this 
)
Value:
MACRO_BEGIN \
vector _v = this; \
serialize_float(stream, _v.x); \
serialize_float(stream, _v.y); \
serialize_float(stream, _v.z); \
this = _v; \
MACRO_END

Definition at line 268 of file net.qh.

◆ Write_byte

#define Write_byte (   to,
 
)    WriteByte(to, f)

Definition at line 297 of file net.qh.

◆ Write_float

#define Write_float (   to,
 
)    WriteFloat(to, f)

Definition at line 332 of file net.qh.

◆ Write_int

#define Write_int (   to,
 
)    WriteInt24_t(to, f)

Definition at line 329 of file net.qh.

◆ Write_string

#define Write_string (   to,
 
)    WriteString(to, f)

Definition at line 335 of file net.qh.

◆ WriteRegistered

#define WriteRegistered (   r,
  to,
  it 
)    Write_byte(to, it.m_id)

Definition at line 294 of file net.qh.

Referenced by ScoreInfo_SendEntity(), and W_Model().

Typedef Documentation

◆ Stream

using Stream = int

Definition at line 229 of file net.qh.

Function Documentation

◆ bool()

bool ( entity  this,
entity  sender,
bool  isNew 
)

◆ STATIC_INIT() [1/3]

STATIC_INIT ( TempEntities_renumber  )

Definition at line 48 of file net.qh.

References FOREACH.

Referenced by STATIC_INIT().

48 { FOREACH(TempEntities, true, it.m_id = 80 + i); }
#define FOREACH(list, cond, body)
Definition: iter.qh:19
+ Here is the caller graph for this function:

◆ STATIC_INIT() [2/3]

STATIC_INIT ( LinkedEntities_renumber  )

Definition at line 81 of file net.qh.

References FOREACH.

81 { FOREACH(LinkedEntities, true, it.m_id = 1 + i); }
#define FOREACH(list, cond, body)
Definition: iter.qh:19

◆ STATIC_INIT() [3/3]

STATIC_INIT ( C2S_Protocol_renumber  )

Definition at line 108 of file net.qh.

References argv_start_index, EF_NODEPTHTEST, entity(), FOREACH, func_null(), IL_EACH, IL_NEW, IL_PUSH(), localcmd, LOG_SEVEREF, LOG_WARN, LOG_WARNF, NULL, REGISTRY_GET, sendflags, setSendEntity, setthink, STATIC_INIT(), strfree, STRING_ITERATOR(), STRING_ITERATOR_SET, string_null, strlen(), substring(), time, to, and vector().

108 { FOREACH(C2S_Protocol, true, it.m_id = i); }
#define FOREACH(list, cond, body)
Definition: iter.qh:19
+ Here is the call graph for this function:

Variable Documentation

◆ m_id

int m_id

Definition at line 10 of file net.qh.

◆ netname

string netname

Definition at line 9 of file net.qh.