Xonotic
utils.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CENTER_OR_VIEWOFS(ent)   (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
 
#define FOREACH_CLIENT(cond, body)   FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), LAMBDA(body))
 
#define FOREACH_CLIENT_RANDOM(cond, body)
 
#define FOREACH_CLIENTSLOT(cond, body)
 
#define IS_BOT_CLIENT(v)   (clienttype(v) == CLIENTTYPE_BOT)
 want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) More...
 
#define IS_CLIENT(v)   (v.flags & FL_CLIENT)
 
#define IS_DEAD(s)   ((s).deadflag != DEAD_NO)
 
#define IS_FAKE_CLIENT(v)   (clienttype(v) == CLIENTTYPE_NOTACLIENT)
 
#define IS_MONSTER(v)   (v.flags & FL_MONSTER)
 
#define IS_MOVABLE(v)   ((IS_PLAYER(v) || IS_MONSTER(v)) && !STAT(FROZEN, v))
 
#define IS_NOT_A_CLIENT(v)   (!IS_CLIENT(v))
 was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) More...
 
#define IS_OBSERVER(v)   ((v).classname == STR_OBSERVER)
 
#define IS_PLAYER(v)   ((v).classname == STR_PLAYER)
 
#define IS_REAL_CLIENT(v)   (clienttype(v) == CLIENTTYPE_REAL)
 
#define IS_SPEC(v)   ((v).classname == STR_SPECTATOR)
 
#define IS_TURRET(v)   (v.turret_flags & TUR_FLAG_ISTURRET)
 
#define IS_VEHICLE(v)   (v.vehicle_flags & VHF_ISVEHICLE)
 

Variables

entity _FCR_clients [255]
 
bool _FCR_entered = false
 
int maxclients
 
const string STR_OBSERVER = "observer"
 
const string STR_PLAYER = "player"
 
const string STR_SPECTATOR = "spectator"
 

Macro Definition Documentation

◆ CENTER_OR_VIEWOFS

◆ FOREACH_CLIENT

#define FOREACH_CLIENT (   cond,
  body 
)    FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), LAMBDA(body))

Definition at line 49 of file utils.qh.

Referenced by accuracy_add(), AddWinners(), anticheat_endframe(), antilag_restore_all(), antilag_takeback_all(), assault_objective_decrease_use(), autoskill(), bot_cmd_barrier(), bot_fixcount(), bot_relinkplayerlist(), bot_removefromlargestteam(), bot_removenewest(), bot_resetqueues(), bot_serverframe(), bot_setnameandstuff(), botframe_autowaypoints(), botframe_showwaypointlinks(), CA_CheckWinner(), CA_count_alive_players(), ca_LastPlayerForTeam(), calculate_player_respawn_time(), CampaignPreIntermission(), CheatImpulse(), CheckRules_World(), ClearWinners(), ClientData_Touch(), CommonCommand_who(), CountSpectators(), ctf_CaptureShield_CheckStatus(), ctf_CheckStalemate(), ctf_FlagThink(), ctf_Handle_Pickup(), ctf_Handle_Retrieve(), ctf_Immediate_Return_Allowed(), Domination_RoundStart(), dompoint_captured(), DumpStats(), DynamicHandicap_UpdateHandicap(), EndFrame(), find_bot_by_name(), FireRailgunBullet(), Freeze(), freezetag_CheckWinner(), freezetag_count_alive_players(), freezetag_LastPlayerForTeam(), GameCommand_allspec(), GameCommand_bot_cmd(), GameCommand_defer_clear_all(), GameCommand_nospectators(), GENERIC_COMMAND(), GetFilteredEntity(), GetIndexedEntity(), havocbot_ctf_reset_role(), havocbot_ctf_teamcount(), havocbot_goalrating_enemyplayers(), havocbot_goalrating_ft_freeplayers(), havocbot_goalrating_item_pickable_check_players(), havocbot_goalrating_ons_controlpoints_attack(), havocbot_role_ctf_defense(), havocbot_role_ft_offense(), Invasion_CheckWinner(), Invasion_RoundStart(), Item_ItemsTime_Allow(), Item_RespawnCountdown(), kh_GetMissingTeams(), kh_Key_Think(), kh_LoserTeam(), kh_StartRound(), kh_update_state(), lms_RemovePlayer(), Local_Notification_WOVA(), MapVote_CheckRules_1(), MapVote_ClearAllVotes(), MapVote_Finished(), MapVote_Tick(), MUTATOR_HOOKFUNCTION(), NextLevel(), nJoinAllowed(), ons_camSetup(), ons_ControlPoint_Icon_Think(), ons_GeneratorDamage(), ons_GeneratorThink(), Onslaught_CheckWinner(), Onslaught_RoundStart(), Pause_TryPause(), PlayerPostThink(), PlayerScore_Sort(), PlayerState_detach(), Portal_Think(), PrintToChatTeam(), race_ClearRecords(), race_SendTime(), race_StartCompleting(), ReadyCount(), ReadyRestart_force(), RedirectionThink(), REGISTER_MUTATOR(), reset_map(), sandbox_ObjectFunction_Think(), sandbox_ObjectRemove(), Say(), Score_NicePrint(), SetWinners(), shuffleteams(), Spawn_Score(), StartFrame(), target_invasion_roundend_use(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_GetTeamCounts(), timeout_handler_think(), Unfreeze(), UpdatePlayerSounds(), vehicles_enter(), vehicles_spawn(), VoteCommand_call(), VoteCount(), VoteReset(), W_Model(), WarpZone_Projectile_Touch(), weapon_thinkf(), WinningCondition_Invasion(), WinningCondition_LMS(), WinningCondition_Race(), WinningCondition_RanOutOfSpawns(), WinningConditionHelper(), and WriteSpectators().

◆ FOREACH_CLIENT_RANDOM

#define FOREACH_CLIENT_RANDOM (   cond,
  body 
)
Value:
if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
_FCR_entered = true; \
int _cnt = 0; \
FOREACH_CLIENT(cond, { \
int _j = floor(random() * (_cnt + 1)); \
if (_j != _cnt) \
_FCR_clients[_cnt] = _FCR_clients[_j]; \
_FCR_clients[_j] = it; \
++_cnt; \
}); \
for (int _i = 0; _i < _cnt; ++_i) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = _FCR_clients[i]; \
if (cond) { LAMBDA(body) } \
} \
_FCR_entered = false; \
MACRO_END
entity() spawn
#define LAMBDA(...)
Definition: misc.qh:37
entity _FCR_clients[255]
Definition: utils.qh:53
bool _FCR_entered
Definition: utils.qh:54
if(IS_DEAD(this))
Definition: impulse.qc:92
#define LOG_FATAL(...)
Definition: log.qh:58

Definition at line 55 of file utils.qh.

Referenced by MUTATOR_HOOKFUNCTION(), and shuffleteams().

◆ FOREACH_CLIENTSLOT

#define FOREACH_CLIENTSLOT (   cond,
  body 
)
Value:
for(int _i = 1; _i <= maxclients; ++_i) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = ftoe(i); \
if(cond) { LAMBDA(body) } \
} \
MACRO_END
entity() spawn
#define LAMBDA(...)
Definition: misc.qh:37
for(int slot=0;slot< MAX_WEAPONSLOTS;++slot)
Definition: impulse.qc:97
int maxclients
Definition: utils.qh:3

Definition at line 39 of file utils.qh.

Referenced by Ban_Enforce(), and Score_ClearAll().

◆ IS_BOT_CLIENT

◆ IS_CLIENT

◆ IS_DEAD

#define IS_DEAD (   s)    ((s).deadflag != DEAD_NO)

Definition at line 26 of file utils.qh.

Referenced by accuracy_isgooddamage(), basketball_touch(), bot_serverframe(), bot_shouldattack(), bot_think(), botframe_autowaypoints(), buff_Think(), CA_count_alive_players(), ca_isEliminated(), ca_LastPlayerForTeam(), ChatBubbleThink(), CheatImpulse(), CheatsAllowed(), CL_ExteriorWeaponentity_Think(), CL_Weaponentity_Think(), ClientCommand_selectteam(), ClientCommand_voice(), ClientKill_TeamChange(), CommonCommand_editmob(), CreatureFrame_FallDamage(), CSQCPlayer_SetCamera(), CSQCPlayer_SetMinsMaxs(), ctf_FlagThink(), Damage(), door_blocked(), door_generic_plat_blocked(), door_trigger_touch(), Drag_CanDrag(), DrownPlayer(), Fire_AddDamage(), freezetag_isEliminated(), func_ladder_think(), generic_plat_blocked(), havocbot_ai(), havocbot_ast_reset_role(), havocbot_ctf_reset_role(), havocbot_ctf_teamcount(), havocbot_goalrating_item_pickable_check_players(), havocbot_movetogoal(), havocbot_ons_reset_role(), havocbot_role_ast_defense(), havocbot_role_ast_offense(), havocbot_role_ctf_carrier(), havocbot_role_ctf_defense(), havocbot_role_ctf_escort(), havocbot_role_ctf_middle(), havocbot_role_ctf_offense(), havocbot_role_ctf_retriever(), havocbot_role_cts(), havocbot_role_dom(), havocbot_role_ft_freeing(), havocbot_role_ft_offense(), havocbot_role_generic(), havocbot_role_ka_carrier(), havocbot_role_ka_collector(), havocbot_role_kh_carrier(), havocbot_role_kh_defense(), havocbot_role_kh_freelancer(), havocbot_role_kh_offense(), havocbot_role_ons_offense(), havocbot_role_race(), Headshot(), Heal(), HUD_StrafeHUD(), IMPULSE(), instagib_ammocheck(), IsFlying(), Item_Touch(), jumppad_push(), ka_TouchEvent(), kh_GetMissingTeams(), kh_Key_Touch(), kh_StartRound(), KillPlayerForTeamChange(), Monster_Anim(), Monster_Attack_Leap_Check(), Monster_Move_Target(), Monster_ValidTarget(), MUTATOR_HOOKFUNCTION(), ons_ControlPoint_Icon_Think(), ons_ControlPoint_Touch(), plat_center_touch(), plat_crush(), player_anim(), player_powerups(), PlayerHealth(), PlayerPostThink(), PlayerPreThink(), PlayerThink(), PlayerUseKey(), PM_ClientMovement_UpdateStatus(), PM_dodging(), race_StartCompleting(), REGISTER_MUTATOR(), ShowRespawnCountdown(), Spawn_Score(), sys_phys_update(), target_items_use(), Teleport_Active(), TeleportPlayer(), UpdatePlayerSounds(), vehicle_impulse(), vehicle_use(), vehicles_enter(), vehicles_exit(), vehicles_locktarget(), vehicles_setreturn(), W_Nexball_Touch(), weapon_byid_handle(), weapon_group_handle(), WinningCondition_Invasion(), WinningCondition_RanOutOfSpawns(), and X().

◆ IS_FAKE_CLIENT

#define IS_FAKE_CLIENT (   v)    (clienttype(v) == CLIENTTYPE_NOTACLIENT)

Definition at line 16 of file utils.qh.

Referenced by StartFrame().

◆ IS_MONSTER

◆ IS_MOVABLE

#define IS_MOVABLE (   v)    ((IS_PLAYER(v) || IS_MONSTER(v)) && !STAT(FROZEN, v))

◆ IS_NOT_A_CLIENT

#define IS_NOT_A_CLIENT (   v)    (!IS_CLIENT(v))

was: (clienttype(v) == CLIENTTYPE_NOTACLIENT)

Definition at line 19 of file utils.qh.

Referenced by Fire_ApplyDamage(), reset_map(), WarpZone_Teleport(), and WarpZone_Touch().

◆ IS_OBSERVER

◆ IS_PLAYER

#define IS_PLAYER (   v)    ((v).classname == STR_PLAYER)

Definition at line 9 of file utils.qh.

Referenced by AddWinners(), antilag_restore_all(), antilag_takeback_all(), assault_objective_decrease_use(), autoskill(), basketball_touch(), bot_fixcount(), bot_think(), botframe_autowaypoints(), botframe_showwaypointlinks(), buff_Inferno_CalculateTime(), buff_Touch(), CA_CheckWinner(), CA_count_alive_players(), ca_LastPlayerForTeam(), calculate_player_respawn_time(), CampaignPreIntermission(), ChatBubbleThink(), CheatImpulse(), CheatsAllowed(), checkpoint_passed(), CheckRules_World(), ClearWinners(), ClientCommand_join(), ClientCommand_ready(), ClientCommand_selectteam(), ClientCommand_spectate(), ClientCommand_wpeditor(), ClientConnect(), ClientDisconnect(), ClientKill_TeamChange(), CommonCommand_editmob(), CommonCommand_timeout(), CSQCModel_Send(), ctf_CaptureShield_CheckStatus(), ctf_CheckStalemate(), ctf_FlagThink(), ctf_Handle_Pickup(), ctf_Handle_Retrieve(), ctf_Handle_Return(), ctf_Immediate_Return_Allowed(), ctf_Reset(), ctf_Stalemate_Customize(), Damage(), debugnode(), Domination_RoundStart(), dompointtouch(), door_check_keys(), door_touch(), Drag_CanDrag(), DumpStats(), DynamicHandicap_UpdateHandicap(), FindConnectedComponent(), Fire_AddDamage(), fireBullet_antilag(), football_touch(), fragsfilter_use(), Freeze(), freezetag_Add_Score(), freezetag_CheckWinner(), freezetag_count_alive_players(), freezetag_isEliminated(), freezetag_LastPlayerForTeam(), func_ladder_think(), GameCommand_allspec(), GetResourceLimit(), havocbot_ai(), havocbot_bunnyhop(), havocbot_ctf_reset_role(), havocbot_ctf_teamcount(), havocbot_goalrating_enemyplayers(), havocbot_goalrating_ft_freeplayers(), havocbot_goalrating_item_pickable_check_players(), havocbot_goalrating_ons_controlpoints_attack(), havocbot_movetogoal(), havocbot_role_ctf_defense(), havocbot_role_ft_offense(), Headshot(), instagib_ammocheck(), Invasion_CheckWinner(), Invasion_RoundStart(), Item_ItemsTime_Allow(), Join(), jumppad_push(), ka_TouchEvent(), kh_GetMissingTeams(), kh_Key_Damage(), kh_Key_Think(), kh_Key_Touch(), kh_KeyCarrier_waypointsprite_visible_for_player(), kh_LoserTeam(), kh_StartRound(), lms_RemovePlayer(), Monster_Dead(), Monster_Move_2D(), monster_setupcolors(), Monster_Spawn_Setup(), MUTATOR_HOOKFUNCTION(), navigation_check_submerged_state(), navigation_findnearestwaypoint_withdist_except(), navigation_poptouchedgoals(), navigation_routerating(), NextLevel(), nJoinAllowed(), Obituary(), ons_CaptureShield_Touch(), ons_ControlPoint_Icon_BuildThink(), ons_ControlPoint_Icon_Damage(), ons_ControlPoint_Icon_Think(), ons_ControlPoint_Touch(), ons_GeneratorDamage(), ons_GeneratorThink(), Onslaught_CheckWinner(), onslaught_generator_touch(), Onslaught_RoundStart(), Pause_TryPause(), plat_center_touch(), plat_outside_touch(), player_clear_minigame(), PlayerDamage(), PlayerPostThink(), PlayerPreThink(), PlayerUseKey(), PM_ClientMovement_UpdateStatus(), Portal_TeleportPlayer(), Portal_Think(), Portal_Touch(), PrintWelcomeMessage(), PutClientInServer(), PutObserverInServer(), race_SendTime(), race_StartCompleting(), RadiusDamageForSource(), ReadyCount(), ReadyRestart_force(), REGISTER_MUTATOR(), reset_map(), sandbox_ObjectFunction_Think(), sandbox_ObjectRemove(), Say(), Score_NicePrint(), score_use(), set_tracewalk_dest(), SetWinners(), shuffleteams(), Spawn_Score(), spawnmonster(), SpectateSet(), SpectateUpdate(), StartFrame(), SUB_UseTargets_Ex(), sys_phys_pregame_hold(), sys_phys_update(), target_invasion_roundend_use(), target_items_use(), Teleport_Active(), Teleport_Touch(), TeleportPlayer(), timeout_handler_think(), trigger_keylock_touch(), Unfreeze(), UpdatePlayerSounds(), vehicles_crushable(), vehicles_enter(), vehicles_spawn(), VoteCommand_call(), VoteCommand_master(), VoteCount(), W_GiveWeapon(), W_Nexball_Touch(), W_SetupShot_Dir_ProjectileSize_Range(), W_WeaponFrame(), WarpZone_PostTeleportPlayer_Callback(), WarpZone_Projectile_Touch(), WarpZone_Teleport(), WarpZone_TeleportPlayer(), WinningCondition_Invasion(), WinningCondition_LMS(), WinningCondition_Race(), WinningCondition_RanOutOfSpawns(), and WinningConditionHelper().

◆ IS_REAL_CLIENT

#define IS_REAL_CLIENT (   v)    (clienttype(v) == CLIENTTYPE_REAL)

Definition at line 17 of file utils.qh.

Referenced by antilag_getlag(), autoskill(), Ban_Enforce(), bot_fixcount(), bot_serverframe(), botframe_autowaypoints(), CA_count_alive_players(), CampaignPreIntermission(), client_hasweapon(), ClientCommand_tell(), ClientConnect(), ClientData_Touch(), ClientDisconnect(), ClientKill_TeamChange(), CountSpectators(), CSQCVehicleSetup(), ctf_CaptureShield_Touch(), ctf_CheckStalemate(), ctf_FlagcarrierWaypoints(), ctf_Handle_Retrieve(), dompoint_captured(), DumpStats(), EndFrame(), FireRailgunBullet(), FixIntermissionClient(), freezetag_count_alive_players(), GameCommand_allspec(), GameCommand_nospectators(), IntermissionThink(), IsFlying(), Item_ItemsTime_Allow(), Item_RespawnCountdown(), join_minigame(), jumppad_push(), KillIndicator_Think(), Local_Notification_WOVA(), MapVote_CheckRules_1(), MapVote_Finished(), MapVote_Tick(), MUTATOR_HOOKFUNCTION(), Nagger_SendEntity(), nJoinAllowed(), ons_CaptureShield_Touch(), ons_GeneratorDamage(), ons_GeneratorThink(), OriginalCallerName(), Pause_TryPause(), PingPLReport_Think(), play_countdown(), Player_DetermineForcedTeam(), PlayerDamage(), PlayerInIPList(), PlayerInList(), PlayerPostThink(), PlayerPreThink(), PrintToChatTeam(), PutClientInServer(), PutObserverInServer(), race_ClearTime(), race_ImposePenaltyTime(), race_SendAll(), race_SendNextCheckpoint(), race_SendStatus(), race_SendTime(), ReadyCount(), ReadyRestart_force(), RedirectionThink(), sandbox_ObjectFunction_Think(), sandbox_ObjectRemove(), Say(), Spawn_Score(), start_minigame(), StartFrame(), SUB_UseTargets_Ex(), target_invasion_roundend_use(), TeamBalance_CompareTeamsInternal(), timeout_handler_think(), tracebox_antilag_force_wz(), UpdateAuxiliaryXhair(), UpdatePlayerSounds(), vehicles_enter(), vehicles_exit(), VerifyClientEntity(), VerifyKickableEntity(), VoteCommand_call(), VoteCount(), W_HitPlotAnalysis(), W_Model(), W_Reload(), WarpZone_Projectile_Touch(), WinningCondition_LMS(), WinningConditionHelper(), and WriteSpectators().

◆ IS_SPEC

◆ IS_TURRET

#define IS_TURRET (   v)    (v.turret_flags & TUR_FLAG_ISTURRET)

Definition at line 23 of file utils.qh.

Referenced by Damage(), MUTATOR_HOOKFUNCTION(), Teleport_Active(), and vehicles_locktarget().

◆ IS_VEHICLE

Variable Documentation

◆ _FCR_clients

entity _FCR_clients[255]

Definition at line 53 of file utils.qh.

◆ _FCR_entered

bool _FCR_entered = false

Definition at line 54 of file utils.qh.

◆ maxclients

int maxclients

Definition at line 3 of file utils.qh.

◆ STR_OBSERVER

const string STR_OBSERVER = "observer"

Definition at line 7 of file utils.qh.

Referenced by Observer::Observer ::Observer().

◆ STR_PLAYER

const string STR_PLAYER = "player"

◆ STR_SPECTATOR

const string STR_SPECTATOR = "spectator"

Definition at line 6 of file utils.qh.

Referenced by Spectator::Spectator ::Spectator().