Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
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 APPROXPASTTIME_MAX   (16384 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
#define APPROXPASTTIME_RANGE   (64 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
#define Net_Accept(classname)
#define NET_GUARD(id)
#define NET_HANDLE(id, param)
#define Net_Reject()
#define Read_byte()
#define Read_float()
#define Read_int()
#define Read_string()
#define ReadAngleVector()
#define ReadAngleVector2D()
#define ReadFloat()
#define ReadInt48_t()
#define ReadInt72_t()
#define ReadRegistered(r)
#define ReadSByte()
#define ReadVector()
#define ReadVector2D()
#define REGISTER_NET_C2S(id)
#define REGISTER_NET_LINKED(id)
#define REGISTER_NET_TEMP(id)
#define serialize(T, stream, ...)
#define serialize_byte(stream, this)
#define serialize_float(stream, this)
#define serialize_marker(stream, this)
#define serialize_vector(stream, this)
#define stream_reading(stream)
#define stream_writing(stream)
#define Write_byte(to, f)
#define Write_float(to, f)
#define Write_int(to, f)
#define Write_string(to, f)
#define WriteHeader(to, id)
#define WriteRegistered(r, to, it)

Typedefs

using Stream = int

Functions

 bool (entity this, entity sender, bool isNew) m_read
void Net_ClientCommand (entity sender, string command)
void Net_Flush ()
void Net_LinkEntity (entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
void Net_UnlinkEntity (entity e)
float ReadApproxPastTime ()
int Readbits (int num)
int ReadByte ()
entity ReadCSQCEntity ()
int ReadInt24_t ()
void SetCustomizer (entity e, bool(entity this, entity client) customizer, void(entity this) uncustomizer)
 STATIC_INIT (C2S_Protocol_renumber)
 STATIC_INIT (g_uncustomizables)
 STATIC_INIT (LinkedEntities_renumber)
 STATIC_INIT (TempEntities_renumber)
 STRING_ITERATOR (g_buf, string_null, 0)
void UncustomizeEntitiesRun ()
 void (entity this) uncustomizeentityforclient
void WriteByte (int to, int b)
void WriteShort (int to, int b)

Variables

string _net_prevmsgstr
noref int _ReadSByte
const float APPROXPASTTIME_ACCURACY_REQUIREMENT = 0.05
string g_buf
IntrusiveList g_uncustomizables
int m_id
const int MSG_C2S = 0
const int MSG_ENTITY = 5
string netname
int SendFlags
float servertime
float uncustomizeentityforclient_set

Macro Definition Documentation

◆ APPROXPASTTIME_MAX

#define APPROXPASTTIME_MAX   (16384 * APPROXPASTTIME_ACCURACY_REQUIREMENT)

Definition at line 344 of file net.qh.

Referenced by ReadApproxPastTime().

◆ APPROXPASTTIME_RANGE

#define APPROXPASTTIME_RANGE   (64 * APPROXPASTTIME_ACCURACY_REQUIREMENT)

Definition at line 345 of file net.qh.

◆ Net_Accept

#define Net_Accept ( classname)
Value:
MACRO_BEGIN \
if (!this) this = new(classname); \
string classname
#define MACRO_END
Definition macro.qh:7
#define new(class)
entities you care about collisions with
Definition oo.qh:65
entity this
Definition self.qh:72

Definition at line 201 of file net.qh.

201 #define Net_Accept(classname) \
202 MACRO_BEGIN \
203 if (!this) this = new(classname); \
204 MACRO_END

Referenced by NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), and NET_HANDLE().

◆ 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); \
}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string _net_prevmsgstr
Definition net.qh:27
#define LOG_FATALF(...)
Definition log.qh:54

Definition at line 17 of file net.qh.

17#define NET_GUARD(id) \
18 bool Net_Handle_##id##_guard(entity this, entity sender, bool isNew) { \
19 bool valid = false; \
20 serialize_marker(to, valid); \
21 if (!valid) LOG_FATALF("Last message not fully parsed: %s", _net_prevmsgstr); \
22 _net_prevmsgstr = #id; \
23 return Net_Handle_##id(this, sender, isNew); \
24 }

◆ NET_HANDLE

#define NET_HANDLE ( id,
param )
Value:
bool Net_Handle_##id(entity this, entity sender, param)

Definition at line 15 of file net.qh.

Referenced by NET_HANDLE().

◆ Net_Reject

#define Net_Reject ( )
Value:
MACRO_BEGIN \
if (this) delete(this); \
#define delete(this)
Definition oo.qh:77

Definition at line 205 of file net.qh.

205 #define Net_Reject() \
206 MACRO_BEGIN \
207 if (this) delete(this); \
208 MACRO_END

◆ Read_byte

#define Read_byte ( )
Value:
int ReadByte()

Definition at line 301 of file net.qh.

◆ Read_float

#define Read_float ( )
Value:
#define ReadFloat()
Definition net.qh:366

Definition at line 336 of file net.qh.

◆ Read_int

#define Read_int ( )
Value:
int ReadInt24_t()
Definition net.qh:355

Definition at line 333 of file net.qh.

◆ Read_string

#define Read_string ( )
Value:
#define ReadString

Definition at line 339 of file net.qh.

◆ ReadAngleVector

#define ReadAngleVector ( )
Value:
vec3(ReadAngle(), ReadAngle(), ReadAngle())
#define vec3(_x, _y, _z)
Definition vector.qh:95

Definition at line 369 of file net.qh.

Referenced by NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), and NET_HANDLE().

◆ ReadAngleVector2D

#define ReadAngleVector2D ( )
Value:
vec2(ReadAngle(), ReadAngle())
#define vec2(...)
Definition vector.qh:90

Definition at line 370 of file net.qh.

Referenced by NET_HANDLE().

◆ ReadFloat

#define ReadFloat ( )
Value:
ReadCoord()

Definition at line 366 of file net.qh.

Referenced by NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), and string().

◆ ReadInt48_t

#define ReadInt48_t ( )
Value:

Definition at line 361 of file net.qh.

Referenced by ReadWepSet().

◆ ReadInt72_t

#define ReadInt72_t ( )
Value:

Definition at line 362 of file net.qh.

Referenced by ReadWepSet().

◆ ReadRegistered

#define ReadRegistered ( r)
Value:
#define Read_byte()
Definition net.qh:301
#define REGISTRY_GET(id, i)
Definition registry.qh:43

Definition at line 298 of file net.qh.

Referenced by NET_HANDLE(), and NET_HANDLE().

◆ ReadSByte

#define ReadSByte ( )
Value:
(_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7)))
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define BITS(n)
Definition bits.qh:9
noref int _ReadSByte
Definition net.qh:364

Definition at line 365 of file net.qh.

Referenced by NET_HANDLE(), and NET_HANDLE().

◆ ReadVector

◆ ReadVector2D

#define ReadVector2D ( )
Value:

Definition at line 368 of file net.qh.

◆ REGISTER_NET_C2S

#define REGISTER_NET_C2S ( id)
Value:
NET_HANDLE(id, bool); \
REGISTER(C2S_Protocol, NET, id, m_id, new_pure(net_c2s_packet)) \
{ \
this.netname = #id; \
this.m_read = Net_Handle_##id; \
}
string netname
Definition powerups.qc:20
int m_id
Definition effect.qh:19
#define NET_HANDLE(id, param)
Definition net.qh:15
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67

Definition at line 88 of file net.qh.

88 #define REGISTER_NET_C2S(id) \
89 NET_HANDLE(id, bool); \
90 REGISTER(C2S_Protocol, NET, id, m_id, new_pure(net_c2s_packet)) \
91 { \
92 this.netname = #id; \
93 this.m_read = Net_Handle_##id; \
94 }

◆ REGISTER_NET_LINKED

#define REGISTER_NET_LINKED ( id)
Value:
ACCUMULATE NET_HANDLE(id, bool isnew) \
{ \
this = __self; \
this.sourceLoc = __FILE__":"STR(__LINE__); \
if (!this) isnew = true; \
} \
NET_GUARD(id); \
REGISTER(LinkedEntities, NET, id, m_id, new_pure(net_linked_packet)) \
{ \
this.netname = #id; \
this.m_read = Net_Handle_##id##_guard; \
}
#define true
Definition csprogsdefs.qh:5
#define ACCUMULATE
Definition _all.inc:31
#define NET_GUARD(id)
Definition net.qh:17
#define STR(it)
Definition macro.qh:20
string sourceLoc
Location entity was spawned from in source.
Definition oo.qh:27
#define REGISTER(...)
Register a new entity with a registry.
Definition registry.qh:87

Definition at line 55 of file net.qh.

55 #define REGISTER_NET_LINKED(id) \
56 ACCUMULATE NET_HANDLE(id, bool isnew) \
57 { \
58 this = __self; \
59 this.sourceLoc = __FILE__":"STR(__LINE__); \
60 if (!this) isnew = true; \
61 } \
62 NET_GUARD(id); \
63 REGISTER(LinkedEntities, NET, id, m_id, new_pure(net_linked_packet)) \
64 { \
65 this.netname = #id; \
66 this.m_read = Net_Handle_##id##_guard; \
67 }

◆ REGISTER_NET_TEMP

#define REGISTER_NET_TEMP ( id)
Value:
NET_HANDLE(id, bool); \
NET_GUARD(id); \
REGISTER(TempEntities, NET, id, m_id, new_pure(net_temp_packet)) { \
this.netname = #id; \
this.m_read = Net_Handle_##id##_guard; \
}

Definition at line 28 of file net.qh.

28 #define REGISTER_NET_TEMP(id) \
29 NET_HANDLE(id, bool); \
30 NET_GUARD(id); \
31 REGISTER(TempEntities, NET, id, m_id, new_pure(net_temp_packet)) { \
32 this.netname = #id; \
33 this.m_read = Net_Handle_##id##_guard; \
34 }

◆ serialize

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

Definition at line 243 of file net.qh.

243#define serialize(T, stream, ...) \
244MACRO_BEGIN \
245 noref Stream _stream = stream; \
246 serialize_##T(_stream, __VA_ARGS__); \
247MACRO_END

Referenced by EliminatedPlayers_SendEntity(), NET_HANDLE(), NET_HANDLE(), and SurvivalStatuses_SendEntity().

◆ serialize_byte

#define serialize_byte ( stream,
this )
Value:
MACRO_BEGIN \
WriteByte(stream, this); \

Definition at line 250 of file net.qh.

250 #define serialize_byte(stream, this) \
251 MACRO_BEGIN \
252 WriteByte(stream, this); \
253 MACRO_END

◆ serialize_float

#define serialize_float ( stream,
this )
Value:
MACRO_BEGIN \
WriteCoord(stream, this); \

Definition at line 262 of file net.qh.

262 #define serialize_float(stream, this) \
263 MACRO_BEGIN \
264 WriteCoord(stream, this); \
265 MACRO_END

◆ serialize_marker

#define serialize_marker ( stream,
this )
Value:
MACRO_BEGIN \
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); \
} \

Definition at line 282 of file net.qh.

282#define serialize_marker(stream, this) \
283MACRO_BEGIN \
284 if (NDEBUG) { \
285 this = true; \
286 } else { \
287 int _de = 0xDE, _ad = 0xAD, _be = 0xBE, _ef = 0xEF; \
288 serialize_byte(stream, _de); \
289 serialize_byte(stream, _ad); \
290 serialize_byte(stream, _be); \
291 serialize_byte(stream, _ef); \
292 this = (_de == 0xDE && _ad == 0xAD && _be == 0xBE && _ef == 0xEF); \
293 } \
294MACRO_END

◆ 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; \

Definition at line 273 of file net.qh.

273#define serialize_vector(stream, this) \
274MACRO_BEGIN \
275 vector _v = this; \
276 serialize_float(stream, _v.x); \
277 serialize_float(stream, _v.y); \
278 serialize_float(stream, _v.z); \
279 this = _v; \
280MACRO_END

◆ stream_reading

#define stream_reading ( stream)
Value:
false

Definition at line 236 of file net.qh.

◆ stream_writing

#define stream_writing ( stream)
Value:
true

Definition at line 237 of file net.qh.

◆ Write_byte

#define Write_byte ( to,
f )
Value:
WriteByte(to, f)
void WriteByte(float data, float dest, float desto)

Definition at line 302 of file net.qh.

◆ Write_float

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

Definition at line 337 of file net.qh.

◆ Write_int

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

Definition at line 334 of file net.qh.

◆ Write_string

#define Write_string ( to,
f )
Value:
void WriteString(string data, float dest, float desto)

Definition at line 340 of file net.qh.

◆ WriteHeader

#define WriteHeader ( to,
id )
Value:
WriteByte(to, NET_##id.m_id)

Definition at line 221 of file net.qh.

221 #define WriteHeader(to, id) \
222 WriteByte(to, NET_##id.m_id)

Referenced by _entcs_send(), _wepent_send(), accuracy_send(), bd_controller_send(), bumble_raygun_send(), clientcamera_send(), ClientData_Send(), ClientInit_misc(), ClientInit_SendEntity(), conveyor_send(), corner_send(), cpicon_send(), CSQCModel_Send(), CSQCProjectile_SendEntity(), CSQCVehicleSetup(), Damage_DamageInfo_SendEntity(), debug_send(), debug_text_3d_fn(), door_send(), electro_orb_send(), EliminatedPlayers_SendEntity(), fpscounter_update(), func_ladder_send(), g_clientmodel_genericsendentity(), generator_send(), globalsound(), GrapplingHookSend(), Inventory_Send(), IT_Write(), ItemSend(), laser_SendEntity(), MapVote_SendEntity(), MapVote_SendPicture(), minigame_SendEntity(), modeleffect_SendEntity(), Mutator_SendEntity(), Nagger_SendEntity(), Net_Write_Effect(), Net_Write_Notification(), ons_Link_Send(), orb_send(), PingPLReport_Think(), plat_send(), PlayerScore_SendEntity(), playersound(), pointparticles_SendEntity(), race_ClearTime(), race_ImposePenaltyTime(), race_send_rankings_cnt(), race_send_recordtime(), race_send_speedaward(), race_send_speedaward_alltimebest(), race_SendNextCheckpoint(), race_SendRanking(), race_SendStatus(), race_SendTime(), rainsnow_SendEntity(), RandomSeed_Send(), Registry_send(), ScoreInfo_SendEntity(), Send_WeaponComplain(), SendAuxiliaryXhair(), SendCSQCVaporizerBeamParticle(), SendCSQCVortexBeamParticle(), SetSpectatee_status(), SpawnCasing(), SpawnEvent_Send(), SpawnPoint_Send(), StatusEffects_Send(), SurvivalStatuses_SendEntity(), sv_notice_to(), target_music_sendto(), target_push_send(), target_speed_send(), te_csqc_lightningarc(), TeamScore_SendEntity(), teleport_dest_send(), train_send(), trigger_impulse_send(), trigger_keylock_send(), trigger_music_SendEntity(), trigger_push_send(), trigger_push_velocity_send(), trigger_teleport_send(), trigger_viewloc_send(), turret_send(), unpause_update(), viewloc_send(), Violence_GibSplash_SendEntity(), W_Arc_Beam_Send(), W_Tuba_NoteSendEntity(), WarpZone_Camera_Send(), WarpZone_Send(), WarpZone_Teleported_Send(), WaypointSprite_SendEntity(), wframe_send(), and write_damagetext().

◆ WriteRegistered

#define WriteRegistered ( r,
to,
it )
Value:
Write_byte(to, it.m_id)
#define Write_byte(to, f)
Definition net.qh:302

Definition at line 299 of file net.qh.

Referenced by ScoreInfo_SendEntity().

Typedef Documentation

◆ Stream

using Stream = int

Definition at line 234 of file net.qh.

Function Documentation

◆ bool()

bool ( entity this,
entity sender,
bool isNew )

References entity().

◆ Net_ClientCommand()

void Net_ClientCommand ( entity sender,
string command )

Definition at line 177 of file net.qh.

178 {
179 // command matches `c2s "(.+)"`
180 string buf = substring(command, argv_start_index(1) + 1, -2);
181 if (buf == "") return;
182 STRING_ITERATOR_SET(g_buf, buf, 0);
183 for (int C2S; (C2S = ReadByte()) >= 0; )
184 {
185 entity reader = REGISTRY_GET(C2S_Protocol, C2S);
186 if (reader && reader.m_read && reader.m_read(NULL, sender, true)) continue;
187 LOG_SEVEREF("Net_ClientCommand() with malformed C2S=%d", C2S);
188 return;
189 }
190 g_buf_i--;
191 int expected = strlen(buf);
192 if (g_buf_i > expected) LOG_WARNF("Underflow: %d", g_buf_i - expected);
193 if (g_buf_i < expected) LOG_WARNF("Overrflow: %d", expected - g_buf_i);
194 }
#define strlen
#define argv_start_index
#define STRING_ITERATOR_SET(this, s, i)
Definition iter.qh:49
string g_buf
Definition net.qh:210
#define LOG_WARNF(...)
Definition log.qh:62
#define LOG_SEVEREF(...)
Definition log.qh:58
string substring(string s, float start, float length)
#define NULL
Definition post.qh:14

References argv_start_index, entity(), g_buf, LOG_SEVEREF, LOG_WARNF, NULL, ReadByte(), REGISTRY_GET, STRING_ITERATOR_SET, strlen, and substring().

Referenced by SV_ParseClientCommand().

◆ Net_Flush()

void Net_Flush ( )

Definition at line 212 of file net.qh.

213 {
214 if (g_buf == "") return;
215 localcmd("\ncmd c2s \"", strreplace("$", "$$", g_buf), "\"\n");
216 strfree(g_buf);
217 }
void localcmd(string command,...)
#define strfree(this)
Definition string.qh:59

References g_buf, localcmd(), and strfree.

Referenced by CSQC_UpdateView().

◆ Net_LinkEntity()

void Net_LinkEntity ( entity e,
bool docull,
float dt,
bool(entity this, entity to, int sendflags) sendfunc )

Definition at line 123 of file net.qh.

124 {
125 if (e.classname == "")
126 {
127 LOG_WARN("Net_LinkEntity called on an entity without a classname, assigning default");
128 e.classname = "net_linked";
129 }
130
131 if (e.model == "" || e.modelindex == 0)
132 {
133 vector mi = e.mins;
134 vector ma = e.maxs;
135 _setmodel(e, "null");
136 setsize(e, mi, ma);
137 }
138
139 setSendEntity(e, sendfunc);
140 e.SendFlags = 0xFFFFFF;
141
142 if (!docull) e.effects |= EF_NODEPTHTEST;
143
144 if (dt)
145 {
146 e.nextthink = time + dt;
148 }
149 }
float time
const float EF_NODEPTHTEST
void SUB_Remove(entity this)
Remove entity.
Definition defer.qh:13
#define LOG_WARN(...)
Definition log.qh:61
#define setSendEntity(e, f)
#define setthink(e, f)
vector
Definition self.qh:92

References EF_NODEPTHTEST, entity(), LOG_WARN, setSendEntity, setthink, SUB_Remove(), time, and vector.

Referenced by accuracy_init(), bd_setup_pieces(), ClientData_Attach(), ClientInit_Spawn(), conveyor_init(), CSQCProjectile(), Damage_DamageInfo(), EliminatedPlayers_Init(), entcs_attach(), FireGrapplingHook(), g_clientmodel_init(), Inventory_new(), Kill_Notification(), link_spawnpoint(), MapVote_Spawn(), minigame_addplayer(), modeleffect_spawn(), msle_spawn(), Mutator_Add(), MUTATOR_HOOKFUNCTION(), nades_spawn_orb(), Nagger_Init(), ons_camSetup(), ons_DelayedGeneratorSetup(), ons_GeneratorReset(), onslaught_controlpoint_icon_link(), PlayerScore_Attach(), PutPlayerInServer(), RandomSeed_Spawn(), ScoreInfo_Init(), Send_Notification(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), start_minigame(), StartItem(), StatusEffects_new(), SurvivalStatuses_Init(), target_push_link(), target_speed_link(), TeamScore_Spawn(), teleport_dest_link(), turret_link(), UpdateAuxiliaryXhair(), viewloc_init(), viewloc_link(), W_Arc_Beam(), W_Electro_Orb_ExplodeOverTime(), W_Tuba_NoteOn(), WaypointSprite_Spawn(), and wepent_link().

◆ Net_UnlinkEntity()

void Net_UnlinkEntity ( entity e)

Definition at line 151 of file net.qh.

152 {
154 }
var void func_null()

References entity(), func_null(), and setSendEntity.

Referenced by Mutator_Remove().

◆ ReadApproxPastTime()

float ReadApproxPastTime ( )

Definition at line 379 of file net.qh.

380 {
381 float dt = ReadByte();
382
383 // map from range...PPROXPASTTIME_MAX / 256
384 dt = (APPROXPASTTIME_MAX / 256) * (dt / (256 - dt));
385
386 return servertime - dt;
387 }
float servertime
Definition net.qh:348
#define APPROXPASTTIME_MAX
Definition net.qh:344

References APPROXPASTTIME_MAX, ReadByte(), and servertime.

◆ Readbits()

int Readbits ( int num)

Definition at line 372 of file net.qh.

373 {
374 if (num > 16) return ReadInt24_t();
375 if (num > 8) return ReadShort();
376 return ReadByte();
377 }

References ReadByte(), and ReadInt24_t().

Referenced by NET_HANDLE(), and NET_HANDLE().

◆ ReadByte()

◆ ReadCSQCEntity()

entity ReadCSQCEntity ( )

Definition at line 349 of file net.qh.

350 {
351 int f = ReadShort();
352 if (f == 0) return NULL;
353 return findfloat(NULL, entnum, f);
354 }
float entnum
entity findfloat(entity start,.float field, float match)

References entity(), entnum, findfloat(), and NULL.

◆ ReadInt24_t()

int ReadInt24_t ( )

Definition at line 355 of file net.qh.

356 {
357 int v = ReadShort() << 8; // note: this is signed
358 v += ReadByte(); // note: this is unsigned
359 return v;
360 }

References ReadByte().

Referenced by NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), Readbits(), ReadWepent(), and ReadWepSet().

◆ SetCustomizer()

void SetCustomizer ( entity e,
bool(entity this, entity client) customizer,
void(entity this) uncustomizer )

Definition at line 159 of file net.qh.

160 {
161 setcefc(e, customizer);
162 e.uncustomizeentityforclient = uncustomizer;
163 e.uncustomizeentityforclient_set = !!uncustomizer;
164 if(uncustomizer)
166 }
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
IntrusiveList g_uncustomizables
Definition net.qh:120
#define setcefc(e, f)

References entity(), g_uncustomizables, IL_PUSH(), and setcefc.

Referenced by LODmodel_attach().

◆ STATIC_INIT() [1/4]

STATIC_INIT ( C2S_Protocol_renumber )

Definition at line 110 of file net.qh.

110{ FOREACH(C2S_Protocol, true, it.m_id = i); }
#define FOREACH(list, cond, body)
Definition iter.qh:19

References FOREACH, and STATIC_INIT.

◆ STATIC_INIT() [2/4]

STATIC_INIT ( g_uncustomizables )

Definition at line 121 of file net.qh.

#define IL_NEW()

References g_uncustomizables, and IL_NEW.

◆ STATIC_INIT() [3/4]

STATIC_INIT ( LinkedEntities_renumber )

Definition at line 83 of file net.qh.

83{ FOREACH(LinkedEntities, true, it.m_id = 1 + i); }

References FOREACH, and STATIC_INIT.

◆ STATIC_INIT() [4/4]

STATIC_INIT ( TempEntities_renumber )

Definition at line 50 of file net.qh.

50{ FOREACH(TempEntities, true, it.m_id = 80 + i); }

References FOREACH, and STATIC_INIT.

◆ STRING_ITERATOR()

STRING_ITERATOR ( g_buf ,
string_null ,
0  )

References g_buf, and string_null.

◆ UncustomizeEntitiesRun()

void UncustomizeEntitiesRun ( )

Definition at line 168 of file net.qh.

169 {
170 IL_EACH(g_uncustomizables, it.uncustomizeentityforclient_set, it.uncustomizeentityforclient(it));
171 }
#define IL_EACH(this, cond, body)

References g_uncustomizables, and IL_EACH.

Referenced by StartFrame().

◆ void()

void ( entity this)

References entity().

◆ WriteByte()

void WriteByte ( int to,
int b )

Definition at line 306 of file net.qh.

307 {
308 assert(to == MSG_C2S);
309 string s = string_null;
310 yenc_single(b, s);
311 string tmp = strcat(g_buf, s);
312 strcpy(g_buf, tmp);
313 }
const int MSG_C2S
Definition net.qh:199
#define assert(expr,...)
Definition log.qh:8
string string_null
Definition nil.qh:9
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define strcpy(this, s)
Definition string.qh:52
#define yenc_single(c, ret)
Definition yenc.qh:5

References assert, g_buf, MSG_C2S, strcat(), strcpy, string_null, and yenc_single.

Referenced by WriteShort().

◆ WriteShort()

void WriteShort ( int to,
int b )

Definition at line 314 of file net.qh.

315 {
316 WriteByte(to, (b >> 8) & 0xFF);
317 WriteByte(to, b & 0xFF);
318 }
void WriteByte(int to, int b)
Definition net.qh:306

References WriteByte().

Variable Documentation

◆ _net_prevmsgstr

string _net_prevmsgstr

Definition at line 27 of file net.qh.

◆ _ReadSByte

noref int _ReadSByte

Definition at line 364 of file net.qh.

◆ APPROXPASTTIME_ACCURACY_REQUIREMENT

const float APPROXPASTTIME_ACCURACY_REQUIREMENT = 0.05

Definition at line 343 of file net.qh.

◆ g_buf

string g_buf

Definition at line 210 of file net.qh.

Referenced by Net_ClientCommand(), Net_Flush(), STRING_ITERATOR(), and WriteByte().

◆ g_uncustomizables

IntrusiveList g_uncustomizables

Definition at line 120 of file net.qh.

Referenced by SetCustomizer(), STATIC_INIT(), and UncustomizeEntitiesRun().

◆ m_id

int m_id

Definition at line 13 of file net.qh.

◆ MSG_C2S

const int MSG_C2S = 0

Definition at line 199 of file net.qh.

Referenced by fpscounter_update(), unpause_update(), and WriteByte().

◆ MSG_ENTITY

const int MSG_ENTITY = 5

Definition at line 115 of file net.qh.

Referenced by _entcs_send(), _wepent_send(), accuracy_send(), bd_controller_send(), bd_server_event(), bumble_raygun_send(), clientcamera_send(), ClientData_Send(), ClientInit_SendEntity(), conveyor_send(), corner_send(), cpicon_send(), CSQCModel_Send(), CSQCProjectile_SendEntity(), Damage_DamageInfo_SendEntity(), door_send(), electro_orb_send(), EliminatedPlayers_SendEntity(), entcs_send(), func_ladder_send(), g_clientmodel_genericsendentity(), GameTypeVote_SendOption(), generator_send(), GrapplingHookSend(), Inventory_Send(), Inventory_Write(), ItemSend(), laser_SendEntity(), MapVote_SendEntity(), MapVote_SendOption(), MapVote_WriteMask(), minigame_SendEntity(), modeleffect_SendEntity(), Mutator_SendEntity(), Nagger_SendEntity(), Net_Write_Notification(), ons_Link_Send(), orb_send(), plat_send(), PlayerScore_SendEntity(), pointparticles_SendEntity(), pong_server_event(), pp_server_event(), rainsnow_SendEntity(), RandomSeed_Send(), ScoreInfo_SendEntity(), SendAuxiliaryXhair(), SpawnEvent_Send(), SpawnPoint_Send(), StatusEffects_Send(), StatusEffects_Write(), SurvivalStatuses_SendEntity(), target_push_send(), target_speed_send(), TeamScore_SendEntity(), teleport_dest_send(), train_send(), trigger_common_write(), trigger_impulse_send(), trigger_keylock_send(), trigger_music_SendEntity(), trigger_push_send(), trigger_push_velocity_send(), trigger_teleport_send(), trigger_viewloc_send(), ttt_server_event(), turret_send(), viewloc_send(), W_Arc_Beam_Send(), W_Tuba_NoteSendEntity(), WarpZone_Camera_Send(), WarpZone_Send(), WarpZone_Teleported_Send(), WaypointSprite_SendEntity(), wepent_send(), and write_damagetext().

◆ netname

string netname

Definition at line 9 of file net.qh.

◆ SendFlags

◆ servertime

◆ uncustomizeentityforclient_set

float uncustomizeentityforclient_set

Definition at line 157 of file net.qh.

Referenced by CopyBody().