Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
base.qh File Reference
#include <client/main.qh>
#include <menu/draw.qh>
#include "events.qh"
Include dependency graph for base.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Callback
 Callbacks may be added to zero or more callback chains. More...
class  CallbackChain
 Callback chains contain zero or more callbacks. More...
class  CallbackChain::CallbackNode
class  Mutator

Macros

#define _MUTATOR_CALLBACK(name, func)
#define _MUTATOR_CALLHOOK(id, ...)
#define _MUTATOR_HANDLE_NOP(type, id)
#define _MUTATOR_HANDLE_PARAMS(type, id)
#define _MUTATOR_HANDLE_POPOUT(type, id)
#define _MUTATOR_HANDLE_POPTMP(type, id)
#define _MUTATOR_HANDLE_PREPARE(type, id)
#define _MUTATOR_HANDLE_PUSHOUT(type, id)
#define _MUTATOR_HANDLE_PUSHTMP(type, id)
#define _MUTATOR_HOOKABLE(id, params)
#define _MUTATOR_IS_ENABLED(this)
#define _REGISTER_MUTATOR(id, dependence, cname)
#define EVAL_MUTATOR_HOOKFUNCTION(...)
#define MUTATOR_ADD(name)
#define MUTATOR_CALLHOOK(id, ...)
#define MUTATOR_HOOK(cb, func, order)
#define MUTATOR_HOOKABLE(id, params)
#define MUTATOR_HOOKFUNCTION(...)
#define MUTATOR_HOOKFUNCTION_2(mut, cb)
#define MUTATOR_HOOKFUNCTION_3(mut, cb, order)
#define MUTATOR_IS_ENABLED(this)
#define MUTATOR_ONADD   if (mode == MUTATOR_ADDING)
#define MUTATOR_ONREMOVE   if (mode == MUTATOR_REMOVING)
#define MUTATOR_ONROLLBACK_OR_REMOVE   if (mode == MUTATOR_REMOVING || mode == MUTATOR_ROLLING_BACK)
#define MUTATOR_REMOVE(name)
#define MUTATOR_RETURNVALUE   CallbackChain_ReturnValue
#define MUTATOR_STATIC()
#define REGISTER_MUTATOR(...)
#define REGISTER_MUTATOR_2(id, dependence)
#define REGISTER_MUTATOR_3(id, dependence, cname)

Typedefs

using mutatorfunc_t = bool(int)

Enumerations

enum  { MUTATOR_REMOVING , MUTATOR_ADDING , MUTATOR_ROLLING_BACK }

Functions

void _mutPrintFail (string cb, string func)
bool Mutator_Add (Mutator mut)
void Mutator_Remove (Mutator mut)
bool Mutator_SendEntity (entity this, entity to, int sf)
 server mutators activate corresponding client mutators for all clients
 NET_HANDLE (Mutator, bool isNew)
void NET_Mutator_Remove (entity this)
void RegisterCallbacks ()
void RegisterHooks ()
 STATIC_INIT (Mutators)
 STATIC_INIT_LATE (Mutators)

Variables

bool CallbackChain_ReturnValue
const int CBC_ORDER_ANY = 4
const int CBC_ORDER_EXCLUSIVE = 3
const int CBC_ORDER_FIRST = 1
const int CBC_ORDER_LAST = 2
bool m_added
bool mutator_log = false

Macro Definition Documentation

◆ _MUTATOR_CALLBACK

#define _MUTATOR_CALLBACK ( name,
func )
Value:
Callback CB_##name; \
bool func(); \
ACCUMULATE void RegisterCallbacks() { CB_##name = NEW(Callback, func); }
void RegisterCallbacks()
Definition base.qh:127
Callbacks may be added to zero or more callback chains.
Definition base.qh:20
#define ACCUMULATE
Definition _all.inc:31
string name
Definition menu.qh:30
#define NEW(cname,...)
Definition oo.qh:117

Definition at line 330 of file base.qh.

330#define _MUTATOR_CALLBACK(name, func) \
331 Callback CB_##name; \
332 bool func(); \
333 ACCUMULATE void RegisterCallbacks() { CB_##name = NEW(Callback, func); }

◆ _MUTATOR_CALLHOOK

#define _MUTATOR_CALLHOOK ( id,
... )
Value:
APPLY(__Mutator_Send_##id, 0 P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
#define APPLY(f,...)
Definition functional.qh:28
#define P99_IF_EMPTY(...)
Definition p99.qh:31

Definition at line 145 of file base.qh.

◆ _MUTATOR_HANDLE_NOP

#define _MUTATOR_HANDLE_NOP ( type,
id )

Definition at line 118 of file base.qh.

◆ _MUTATOR_HANDLE_PARAMS

#define _MUTATOR_HANDLE_PARAMS ( type,
id )
Value:
, type in_##id

Definition at line 119 of file base.qh.

◆ _MUTATOR_HANDLE_POPOUT

#define _MUTATOR_HANDLE_POPOUT ( type,
id )
Value:
id = out_##id;

Definition at line 124 of file base.qh.

◆ _MUTATOR_HANDLE_POPTMP

#define _MUTATOR_HANDLE_POPTMP ( type,
id )
Value:
id = tmp_##id;

Definition at line 123 of file base.qh.

◆ _MUTATOR_HANDLE_PREPARE

#define _MUTATOR_HANDLE_PREPARE ( type,
id )
Value:
id = in_##id;

Definition at line 120 of file base.qh.

◆ _MUTATOR_HANDLE_PUSHOUT

#define _MUTATOR_HANDLE_PUSHOUT ( type,
id )
Value:
type out_##id = id;

Definition at line 122 of file base.qh.

◆ _MUTATOR_HANDLE_PUSHTMP

#define _MUTATOR_HANDLE_PUSHTMP ( type,
id )
Value:
TC(type, id); type tmp_##id = id;
#define TC(T, sym)
Definition _all.inc:82

Definition at line 121 of file base.qh.

◆ _MUTATOR_HOOKABLE

#define _MUTATOR_HOOKABLE ( id,
params )
Value:
CallbackChain HOOK_##id; \
bool __Mutator_Send_##id(int params(_MUTATOR_HANDLE_PARAMS, _MUTATOR_HANDLE_NOP)) { \
bool ret = CallbackChain_Call(HOOK_##id); \
return ret; \
} \
ACCUMULATE void RegisterHooks() { HOOK_##id = NEW(CallbackChain, #id); }
#define _MUTATOR_HANDLE_PUSHOUT(type, id)
Definition base.qh:122
#define _MUTATOR_HANDLE_POPOUT(type, id)
Definition base.qh:124
#define _MUTATOR_HANDLE_PARAMS(type, id)
Definition base.qh:119
#define _MUTATOR_HANDLE_POPTMP(type, id)
Definition base.qh:123
#define _MUTATOR_HANDLE_PREPARE(type, id)
Definition base.qh:120
void RegisterHooks()
Definition base.qh:126
#define _MUTATOR_HANDLE_NOP(type, id)
Definition base.qh:118
#define _MUTATOR_HANDLE_PUSHTMP(type, id)
Definition base.qh:121
Callback chains contain zero or more callbacks.
Definition base.qh:39

Definition at line 130 of file base.qh.

130#define _MUTATOR_HOOKABLE(id, params) \
131 CallbackChain HOOK_##id; \
132 bool __Mutator_Send_##id(int params(_MUTATOR_HANDLE_PARAMS, _MUTATOR_HANDLE_NOP)) { \
133 params(_MUTATOR_HANDLE_PUSHTMP, _MUTATOR_HANDLE_NOP) \
134 params(_MUTATOR_HANDLE_PREPARE, _MUTATOR_HANDLE_NOP) \
135 bool ret = CallbackChain_Call(HOOK_##id); \
136 params(_MUTATOR_HANDLE_NOP, _MUTATOR_HANDLE_PUSHOUT) \
137 params(_MUTATOR_HANDLE_POPTMP, _MUTATOR_HANDLE_NOP) \
138 params(_MUTATOR_HANDLE_NOP, _MUTATOR_HANDLE_POPOUT) \
139 return ret; \
140 } \
141 ACCUMULATE void RegisterHooks() { HOOK_##id = NEW(CallbackChain, #id); }

◆ _MUTATOR_IS_ENABLED

#define _MUTATOR_IS_ENABLED ( this)
Value:
this.mutatorcheck()

Definition at line 192 of file base.qh.

Referenced by STATIC_INIT_LATE().

◆ _REGISTER_MUTATOR

#define _REGISTER_MUTATOR ( id,
dependence,
cname )
Value:
bool MUTATORFUNC_##id##_hooks(int mode) { return = false; } \
bool MUTATORFUNC_##id(int mode) { \
return = false; \
bool ret = MUTATORFUNC_##id##_hooks(mode); if (ret) return ret; \
} \
bool MUTATOR_##id##_check() { return dependence; } \
REGISTER(Mutators, MUTATOR, id, m_id, NEW(cname)) \
{ \
this.m_name = #id; \
this.mutatorfunc = MUTATORFUNC_##id; \
this.mutatorcheck = MUTATOR_##id##_check; \
} \
ACCUMULATE bool MUTATORFUNC_##id(int mode)
string m_name
Definition scores.qh:142
int m_id
Definition effect.qh:19

Definition at line 280 of file base.qh.

280#define _REGISTER_MUTATOR(id, dependence, cname) \
281 bool MUTATORFUNC_##id##_hooks(int mode) { return = false; } \
282 bool MUTATORFUNC_##id(int mode) { \
283 return = false; \
284 bool ret = MUTATORFUNC_##id##_hooks(mode); if (ret) return ret; \
285 } \
286 bool MUTATOR_##id##_check() { return dependence; } \
287 REGISTER(Mutators, MUTATOR, id, m_id, NEW(cname)) \
288 { \
289 this.m_name = #id; \
290 this.mutatorfunc = MUTATORFUNC_##id; \
291 this.mutatorcheck = MUTATOR_##id##_check; \
292 } \
293 ACCUMULATE bool MUTATORFUNC_##id(int mode)

◆ EVAL_MUTATOR_HOOKFUNCTION

#define EVAL_MUTATOR_HOOKFUNCTION ( ...)
Value:
__VA_ARGS__

Definition at line 337 of file base.qh.

◆ MUTATOR_ADD

#define MUTATOR_ADD ( name)
Value:
Mutator_Add(MUTATOR_##name)
bool Mutator_Add(Mutator mut)
Definition base.qh:237

Definition at line 326 of file base.qh.

◆ MUTATOR_CALLHOOK

#define MUTATOR_CALLHOOK ( id,
... )
Value:
_MUTATOR_CALLHOOK(id, __VA_ARGS__)
#define _MUTATOR_CALLHOOK(id,...)
Definition base.qh:145

Definition at line 143 of file base.qh.

Referenced by accuracy_isgooddamage(), AnnouncerOption(), AppendItemcodes(), bot_fixcount(), bot_shouldattack(), buff_Touch(), buffs_BuffModel_Customize(), bumblebee_gunner_enter(), bumblebee_gunner_exit(), calculate_player_respawn_time(), ChatBubbleThink(), CheatImpulse(), CheckRules_World(), ClientCommand_spectate(), ClientConnect(), ClientDisconnect(), ClientInit_SendEntity(), ClientKill_Now(), ClientKill_TeamChange(), CommonCommand_editmob(), CopyBody(), CSQCModel_AutoTagIndex_Apply(), CSQCPlayer_ModelAppearance_Apply(), Damage(), DecodeLevelParms(), Draw_GrapplingHook(), Draw_ShowNames(), DrawReticle(), Drop_Special_Items(), fireBullet_falloff(), FireGrapplingHook(), FixClientCvars(), FixPlayermodel(), formatmessage(), frag_centermessage_override(), GameCommand(), GameLogInit(), get_model_parameters(), GetCvars(), GetPlayerLimit(), GetPressedKeys(), getrecords(), GetResourceLimit(), GiveFrags(), GiveResource(), GiveResourceWithLimit(), GrapplingHookThink(), havocbot_aim(), havocbot_chooserole(), HUD_Contents(), HUD_Crosshair(), HUD_Damage(), HUD_Draw(), HUD_InfoMessages(), HUD_Physics(), HUD_Powerups(), HUD_RaceTimer(), HUD_Radar(), HUD_Score(), HUD_StrafeHUD(), HUD_Vote(), IMPULSE(), Item_IsDefinitionAllowed(), Item_Model(), Item_RespawnCountdown(), Item_ScheduleRespawnIn(), Item_Sound(), Item_Touch(), KillPlayerForTeamChange(), LocalCommand_hud(), M_Model(), MainWindow_configureMainWindow(), Monster_Damage(), monster_dropitem(), Monster_FindTarget(), Monster_Miniboss_Setup(), Monster_Move(), Monster_Remove(), Monster_Respawn_Check(), Monster_Spawn_Setup(), Monster_ValidTarget(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), nade_damage(), nade_translocate_boom(), NET_HANDLE(), NET_HANDLE(), NET_HANDLE(), net_handle_ServerWelcome(), NextLevel(), Obituary(), Physics_UpdateStats(), player_anim(), player_powerups(), player_regen(), Player_SetTeamIndex(), PlayerDamage(), PlayerJump(), PlayerPreThink(), PlayerScore_Add(), PlayerScore_Clear(), PlayerUseKey(), PM_ClientMovement_UpdateStatus(), Portal_TeleportPlayer(), PRECACHE(), PutClientInServer(), PutObserverInServer(), PutPlayerInServer(), race_SendTime(), RandomItems_GetRandomItemClassName(), readlevelcvars(), readplayerstartcvars(), ReadyRestart(), reset_map(), sandbox_Database_Save(), sandbox_ObjectFunction_Think(), Say(), Scoreboard_AccuracyStats_WouldDraw(), Scoreboard_Draw(), Scoreboard_ItemStats_WouldDraw(), Scoreboard_WouldDraw(), SendWelcomeMessage(), SetChangeParms(), SetDefaultAlpha(), SetNewParms(), SetResource(), skeleton_loadinfo(), Spawn_Score(), spawnfunc(), Spectate(), SpectateCopy(), SpectateNext(), SpectatePrev(), spritelookupcolor(), spritelookupicon(), spritelookuptext(), StartFrame(), StartItem(), SV_OnEntityPreSpawnFunction(), SV_ParseClientCommand(), sys_phys_update(), TakeResource(), TakeResourceWithLimit(), TeamBalance_CheckAllowedTeams(), TeamBalance_FindBestTeams(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_GetTeamCounts(), turret_checkfire(), turret_fire(), turret_fusionreactor_firecheck(), turret_initialize(), turret_think(), turret_validate_target(), URI_Get_Callback(), vehicle_initialize(), vehicles_enter(), vehicles_exit(), vehicles_touch(), View_EventChase(), viewmodel_draw(), VoteCommand_parse(), W_Arc_Attack_Bolt(), W_Blaster_Attack(), W_Crylink_Attack(), W_Crylink_Attack2(), W_DecreaseAmmo(), W_Devastator_Attack(), W_Devastator_DoRemoteExplode(), W_Electro_Attack_Bolt(), W_Electro_Attack_Orb(), W_Fireball_Attack1(), W_Fireball_Attack2(), W_Hagar_Attack(), W_Hagar_Attack2(), W_Hagar_Attack2_Load_Release(), W_HLAC_Attack(), W_HLAC_Attack2(), W_Hook_Attack2(), W_IsWeaponThrowable(), W_MineLayer_Attack(), W_Model(), W_Mortar_Attack(), W_Mortar_Attack2(), W_OverkillRocketPropelledChainsaw_Attack(), W_PlayStrengthSound(), W_Porto_Attack(), W_PrepareExplosionByDamage(), W_Reload(), W_RocketMinsta_Attack(), W_Seeker_Fire_Flac(), W_Seeker_Fire_Missile(), W_Seeker_Fire_Tag(), W_Sound(), W_ThrowWeapon(), W_WeaponRateFactor(), W_WeaponSpeedFactor(), want_weapon(), WantEventchase(), WaypointSprite_Customize(), WaypointSprite_SendEntity(), weapon_defaultspawnfunc(), weaponLocked(), weaponUseForbidden(), and WinningCondition_Scores().

◆ MUTATOR_HOOK

#define MUTATOR_HOOK ( cb,
func,
order )
Value:
MACRO_BEGIN \
MUTATOR_ONADD { \
if (!CallbackChain_Add(HOOK_##cb, CB_##func, order)) { \
_mutPrintFail(#cb, #func); \
return true; \
} \
} \
CallbackChain_Remove(HOOK_##cb, CB_##func); \
} \
#define MUTATOR_ONROLLBACK_OR_REMOVE
Definition base.qh:311
#define MACRO_END
Definition macro.qh:7

Definition at line 354 of file base.qh.

354#define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN \
355 MUTATOR_ONADD { \
356 if (!CallbackChain_Add(HOOK_##cb, CB_##func, order)) { \
357 _mutPrintFail(#cb, #func); \
358 return true; \
359 } \
360 } \
361 MUTATOR_ONROLLBACK_OR_REMOVE { \
362 CallbackChain_Remove(HOOK_##cb, CB_##func); \
363 } \
364MACRO_END

◆ MUTATOR_HOOKABLE

#define MUTATOR_HOOKABLE ( id,
params )
Value:
_MUTATOR_HOOKABLE(id, params)
#define _MUTATOR_HOOKABLE(id, params)
Definition base.qh:130

Definition at line 129 of file base.qh.

◆ MUTATOR_HOOKFUNCTION

#define MUTATOR_HOOKFUNCTION ( ...)
Value:
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
#define EVAL_MUTATOR_HOOKFUNCTION(...)
Definition base.qh:337
#define OVERLOAD(F,...)
Definition misc.qh:12

Definition at line 335 of file base.qh.

335#define MUTATOR_HOOKFUNCTION(...) \
336 EVAL_MUTATOR_HOOKFUNCTION(OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__))

◆ MUTATOR_HOOKFUNCTION_2

#define MUTATOR_HOOKFUNCTION_2 ( mut,
cb )
Value:
#define MUTATOR_HOOKFUNCTION_3(mut, cb, order)
Definition base.qh:342
const int CBC_ORDER_ANY
Definition base.qh:13

Definition at line 339 of file base.qh.

339#define MUTATOR_HOOKFUNCTION_2(mut, cb) \
340 MUTATOR_HOOKFUNCTION_3(mut, cb, CBC_ORDER_ANY)

◆ MUTATOR_HOOKFUNCTION_3

#define MUTATOR_HOOKFUNCTION_3 ( mut,
cb,
order )
Value:
_MUTATOR_CALLBACK(mut##_##cb, mut##_##cb) \
ACCUMULATE bool MUTATORFUNC_##mut##_hooks(int mode) { MUTATOR_HOOK(cb, mut##_##cb, order); } \
bool mut##_##cb() { return = false; } \
ACCUMULATE bool mut##_##cb()
#define _MUTATOR_CALLBACK(name, func)
Definition base.qh:330
#define MUTATOR_HOOK(cb, func, order)
Definition base.qh:354

Definition at line 342 of file base.qh.

342#define MUTATOR_HOOKFUNCTION_3(mut, cb, order) \
343 _MUTATOR_CALLBACK(mut##_##cb, mut##_##cb) \
344 ACCUMULATE bool MUTATORFUNC_##mut##_hooks(int mode) { MUTATOR_HOOK(cb, mut##_##cb, order); } \
345 bool mut##_##cb() { return = false; } \
346 ACCUMULATE bool mut##_##cb()

◆ MUTATOR_IS_ENABLED

#define MUTATOR_IS_ENABLED ( this)

◆ MUTATOR_ONADD

◆ MUTATOR_ONREMOVE

#define MUTATOR_ONREMOVE   if (mode == MUTATOR_REMOVING)

◆ MUTATOR_ONROLLBACK_OR_REMOVE

#define MUTATOR_ONROLLBACK_OR_REMOVE   if (mode == MUTATOR_REMOVING || mode == MUTATOR_ROLLING_BACK)

◆ MUTATOR_REMOVE

#define MUTATOR_REMOVE ( name)
Value:
Mutator_Remove(MUTATOR_##name)
void Mutator_Remove(Mutator mut)
Definition base.qh:260

Definition at line 327 of file base.qh.

◆ MUTATOR_RETURNVALUE

◆ MUTATOR_STATIC

#define MUTATOR_STATIC ( )
Value:
MACRO_BEGIN \
MUTATOR_ONADD { \
/* game loads at time 1 */ \
if (time > 1) { \
error("This is a gametype and it cannot be added at runtime."); \
} \
} \
LOG_INFO("This is a gametype and it cannot be removed at runtime."); \
return -1; \
} \
#define MUTATOR_ONREMOVE
Definition base.qh:310
float time

Definition at line 313 of file base.qh.

313#define MUTATOR_STATIC() MACRO_BEGIN \
314 MUTATOR_ONADD { \
315 /* game loads at time 1 */ \
316 if (time > 1) { \
317 error("This is a gametype and it cannot be added at runtime."); \
318 } \
319 } \
320 MUTATOR_ONREMOVE { \
321 LOG_INFO("This is a gametype and it cannot be removed at runtime."); \
322 return -1; \
323 } \
324MACRO_END

Referenced by REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), and REGISTER_MUTATOR().

◆ REGISTER_MUTATOR

◆ REGISTER_MUTATOR_2

#define REGISTER_MUTATOR_2 ( id,
dependence )
Value:
_REGISTER_MUTATOR(id, dependence, Mutator)
#define _REGISTER_MUTATOR(id, dependence, cname)
Definition base.qh:280

Definition at line 296 of file base.qh.

◆ REGISTER_MUTATOR_3

#define REGISTER_MUTATOR_3 ( id,
dependence,
cname )
Value:
_REGISTER_MUTATOR(id, dependence, cname)

Definition at line 297 of file base.qh.

Typedef Documentation

◆ mutatorfunc_t

Definition at line 156 of file base.qh.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MUTATOR_REMOVING 
MUTATOR_ADDING 
MUTATOR_ROLLING_BACK 

Definition at line 150 of file base.qh.

150 {
154};
@ MUTATOR_ADDING
Definition base.qh:152
@ MUTATOR_REMOVING
Definition base.qh:151
@ MUTATOR_ROLLING_BACK
Definition base.qh:153

Function Documentation

◆ _mutPrintFail()

void _mutPrintFail ( string cb,
string func )

Definition at line 348 of file base.qh.

349{
350 // this is inside a function to avoid expanding it on compilation everytime
351 LOG_INFO("HOOK FAILED: ", cb, ":", func);
352}
#define LOG_INFO(...)
Definition log.qh:65

References LOG_INFO.

◆ Mutator_Add()

bool Mutator_Add ( Mutator mut)

Definition at line 237 of file base.qh.

238{
239 if(mut.m_added)
240 return true; // already added
241
242 mut.m_added = true;
243 mutatorfunc_t func = mut.mutatorfunc;
244 if (!func(MUTATOR_ADDING)) {
245 // good
246 if (mutator_log) LOG_TRACEF("Mutator: added %s", mut.m_name);
247#ifdef SVQC
248 Net_LinkEntity(mut, false, 0, Mutator_SendEntity);
249#endif
250 return true;
251 }
252 backtrace("WARNING: when adding mutator: adding failed, rolling back\n");
253 if (func(MUTATOR_ROLLING_BACK)) {
254 // baaaaad
255 error("WARNING: when adding mutator: rolling back failed");
256 }
257 return false;
258}
bool Mutator_SendEntity(entity this, entity to, int sf)
server mutators activate corresponding client mutators for all clients
Definition base.qh:200
bool mutator_log
Definition base.qh:189
bool(int) mutatorfunc_t
Definition base.qh:156
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
#define LOG_TRACEF(...)
Definition log.qh:77
#define backtrace(msg)
Definition log.qh:99
#define error
Definition pre.qh:6

References backtrace, error, LOG_TRACEF, MUTATOR_ADDING, mutator_log, MUTATOR_ROLLING_BACK, Mutator_SendEntity(), and Net_LinkEntity().

Referenced by STATIC_INIT_LATE().

◆ Mutator_Remove()

void Mutator_Remove ( Mutator mut)

Definition at line 260 of file base.qh.

261{
262 if(!mut.m_added)
263 {
264 backtrace("WARNING: removing not-added mutator\n");
265 return;
266 }
267
268 mut.m_added = false;
269 mutatorfunc_t func = mut.mutatorfunc;
270 if (func(MUTATOR_REMOVING)) {
271 // baaaaad
272 error("Mutator_Remove: removing mutator failed");
273 }
274 if (mutator_log) LOG_TRACEF("Mutator: removed %s", mut.m_name);
275#ifdef SVQC
276 Net_UnlinkEntity(mut);
277#endif
278}
void Net_UnlinkEntity(entity e)
Definition net.qh:151

References backtrace, error, LOG_TRACEF, mutator_log, MUTATOR_REMOVING, and Net_UnlinkEntity().

Referenced by NET_Mutator_Remove().

◆ Mutator_SendEntity()

bool Mutator_SendEntity ( entity this,
entity to,
int sf )

server mutators activate corresponding client mutators for all clients

Definition at line 200 of file base.qh.

201{
202 int chan = MSG_ENTITY;
203 WriteHeader(chan, Mutator);
204 WriteString(chan, this.registered_id);
205 return true;
206}
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
void WriteString(string data, float dest, float desto)
string registered_id
registered item identifier
Definition registry.qh:60

References entity(), MSG_ENTITY, registered_id, WriteHeader, and WriteString().

Referenced by Mutator_Add().

◆ NET_HANDLE()

NET_HANDLE ( Mutator ,
bool isNew )

Definition at line 217 of file base.qh.

218{
219 make_pure(this);
220 string s = this.netname = ReadString();
221 return = true;
222 if (isNew)
223 {
224 make_pure(this);
225 this.entremove = NET_Mutator_Remove;
226 int added = 0;
227 WITH(bool, mutator_log, true, {
228 FOREACH(Mutators, it.registered_id == s, { Mutator_Add(it); ++added; });
229 });
230 if (added > 1) LOG_WARNF("Added more than one mutator for %s", s);
231 }
232}
void NET_Mutator_Remove(entity this)
Definition base.qh:210
#define ReadString
string netname
Definition powerups.qc:20
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define LOG_WARNF(...)
Definition log.qh:62
#define WITH(type, name, value, block)
Definition misc.qh:37
#define make_pure(e)
direct use is
Definition oo.qh:13

References FOREACH, LOG_WARNF, make_pure, mutator_log, NET_Mutator_Remove(), netname, ReadString, and WITH.

◆ NET_Mutator_Remove()

void NET_Mutator_Remove ( entity this)

Definition at line 210 of file base.qh.

211{
212 string s = this.netname;
213 WITH(bool, mutator_log, true, {
214 FOREACH(Mutators, it.registered_id == s, Mutator_Remove(it));
215 });
216}

References entity(), FOREACH, mutator_log, Mutator_Remove(), netname, and WITH.

Referenced by NET_HANDLE().

◆ RegisterCallbacks()

void RegisterCallbacks ( )

Definition at line 127 of file base.qh.

127{};

Referenced by STATIC_INIT().

◆ RegisterHooks()

void RegisterHooks ( )

Definition at line 126 of file base.qh.

126{};

Referenced by STATIC_INIT().

◆ STATIC_INIT()

STATIC_INIT ( Mutators )

Definition at line 299 of file base.qh.

299 {
302 RegisterMutators();
303}

References RegisterCallbacks(), and RegisterHooks().

◆ STATIC_INIT_LATE()

STATIC_INIT_LATE ( Mutators )

Definition at line 305 of file base.qh.

305 {
306 FOREACH(Mutators, _MUTATOR_IS_ENABLED(it), Mutator_Add(it));
307}

References _MUTATOR_IS_ENABLED, FOREACH, and Mutator_Add().

Variable Documentation

◆ CallbackChain_ReturnValue

bool CallbackChain_ReturnValue

Definition at line 15 of file base.qh.

Referenced by CallbackChain::CallbackChain_Call().

◆ CBC_ORDER_ANY

const int CBC_ORDER_ANY = 4

◆ CBC_ORDER_EXCLUSIVE

◆ CBC_ORDER_FIRST

◆ CBC_ORDER_LAST

◆ m_added

bool m_added

Definition at line 190 of file base.qh.

◆ mutator_log

bool mutator_log = false

Definition at line 189 of file base.qh.

Referenced by Mutator_Add(), Mutator_Remove(), NET_HANDLE(), and NET_Mutator_Remove().