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

Go to the source code of this file.

Macros

#define _FOREACH_ENTITY_FIND_ORDERED(T, fld, match, cond, body)
 
#define _FOREACH_ENTITY_FIND_UNORDERED(id, T, fld, match, cond, body)
 
#define FOREACH(list, cond, body)   FOREACH_LIST(list, enemy, cond, body)
 
#define FOREACH_ARRAY(arr, start, end, cond, body)
 
#define FOREACH_CHAR(s, cond, body)
 
#define FOREACH_ENTITY(cond, body)   ORDERED(FOREACH_ENTITY)(cond, body)
 
#define FOREACH_ENTITY_CLASS(class, cond, body)   ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
 
#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body)   _FOREACH_ENTITY_FIND_ORDERED(string, classname, class, cond, body)
 
#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body)   _FOREACH_ENTITY_FIND_UNORDERED(clazz, string, classname, class, cond, body)
 
#define FOREACH_ENTITY_ENT(fld, match, body)   ORDERED(FOREACH_ENTITY_ENT)(fld, match, body)
 
#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_ORDERED(entity, fld, match, true, body)
 
#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_UNORDERED(, entity, fld, match, true, body)
 
#define FOREACH_ENTITY_FLAGS(fld, match, body)   ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
 
#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_ORDERED(flags, fld, match, true, body)
 
#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_UNORDERED(, flags, fld, match, true, body)
 
#define FOREACH_ENTITY_FLOAT(fld, match, body)   ORDERED(FOREACH_ENTITY_FLOAT)(fld, match, body)
 
#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_ORDERED(float, fld, match, true, body)
 
#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_UNORDERED(, float, fld, match, true, body)
 
#define FOREACH_ENTITY_ORDERED(cond, body)
 
#define FOREACH_ENTITY_STRING(fld, match, body)   ORDERED(FOREACH_ENTITY_STRING)(fld, match, body)
 
#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_ORDERED(string, fld, match, true, body)
 
#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body)   _FOREACH_ENTITY_FIND_UNORDERED(, string, fld, match, true, body)
 
#define FOREACH_ENTITY_UNORDERED(cond, body)   _FOREACH_ENTITY_FIND_UNORDERED(all, entity, _FOREACH_ENTITY_fld, NULL, cond, body)
 
#define FOREACH_LIST(list, next, cond, body)
 
#define FOREACH_WORD(words, cond, body)
 
#define ITER_CONST   const
 
#define MUTEX_LOCK(this)
 
#define MUTEX_UNLOCK(this)
 
#define ORDERED(F)   F##_UNORDERED
 
#define STRING_ITERATOR(this, s, i)
 
#define STRING_ITERATOR_GET(this)   str2chr(this##_s, this##_i++)
 
#define STRING_ITERATOR_LOAD(this, n)   MACRO_BEGIN this##_i = n; MACRO_END
 
#define STRING_ITERATOR_NEXT(this)   MACRO_BEGIN ++this##_i; MACRO_END
 
#define STRING_ITERATOR_PEEK(this)   str2chr(this##_s, this##_i)
 
#define STRING_ITERATOR_SAVE(this)   this##_i
 
#define STRING_ITERATOR_SET(this, s, i)
 
#define STRING_ITERATOR_UNGET(this)   MACRO_BEGIN --this##_i; MACRO_END
 

Variables

noref string _FOREACH_ENTITY_FIND_entity_allmutex
 
noref string _FOREACH_ENTITY_FIND_entity_mutex
 
entity _FOREACH_ENTITY_FIND_entity_next
 
entity _FOREACH_ENTITY_FIND_entity_nextall
 
noref string _FOREACH_ENTITY_FIND_flags_mutex
 
entity _FOREACH_ENTITY_FIND_flags_next
 
noref string _FOREACH_ENTITY_FIND_float_mutex
 
entity _FOREACH_ENTITY_FIND_float_next
 
noref string _FOREACH_ENTITY_FIND_string_clazzmutex
 
noref string _FOREACH_ENTITY_FIND_string_mutex
 
entity _FOREACH_ENTITY_FIND_string_next
 
entity _FOREACH_ENTITY_FIND_string_nextclazz
 
entity _FOREACH_ENTITY_fld
 marker field, always NULL More...
 

Macro Definition Documentation

◆ _FOREACH_ENTITY_FIND_ORDERED

#define _FOREACH_ENTITY_FIND_ORDERED (   T,
  fld,
  match,
  cond,
  body 
)
Value:
MACRO_BEGIN \
int _i = 0; \
for (entity _it = NULL; (_it = _find##T(_it, fld, match)); ++_i) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = _it; \
if (cond) LAMBDA(body) \
} \
MACRO_END
entity() spawn
#define LAMBDA(...)
Definition: misc.qh:37
#define NULL
Definition: post.qh:17

Definition at line 112 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_UNORDERED

#define _FOREACH_ENTITY_FIND_UNORDERED (   id,
  T,
  fld,
  match,
  cond,
  body 
)
Value:
MUTEX_LOCK(_FOREACH_ENTITY_FIND_##T##_##id##mutex); \
entity _foundchain_first = _findchain##T##_tofield(fld, match, _FOREACH_ENTITY_FIND_##T##_next##id); \
FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FIND_##T##_next##id, cond, body); \
MUTEX_UNLOCK(_FOREACH_ENTITY_FIND_##T##_##id##mutex); \
MACRO_END
#define MUTEX_LOCK(this)
Definition: iter.qh:122

Definition at line 129 of file iter.qh.

◆ FOREACH

#define FOREACH (   list,
  cond,
  body 
)    FOREACH_LIST(list, enemy, cond, body)

Definition at line 19 of file iter.qh.

Referenced by _MapInfo_Generate(), _MapInfo_Map_ApplyGametypeEx(), ammo_pickupevalfunc(), buff_FirstFromFlags(), buff_NewType(), buff_RemoveAll(), ClearPlayerSounds(), client_hasweapon(), ClientCommand_minigame(), Cmd_Scoreboard_SetFields(), CommonCommand_editmob(), CommonCommand_macro_command(), CommonCommand_macro_help(), CommonCommand_macro_usage(), CommonCommand_macro_write_aliases(), Create_Notification_Entity_Choice(), CSQC_Ent_Update(), CSQC_Parse_TempEntity(), Destroy_All_Notifications(), Dump_Items(), Dump_Notifications(), Dump_Weapon_Settings(), Ent_RemovePlayerScore(), GameCommand_macro_command(), GameCommand_macro_help(), GameCommand_macro_usage(), GameCommand_macro_write_aliases(), GENERIC_COMMAND(), GenericCommand_macro_command(), GenericCommand_macro_help(), GenericCommand_macro_usage(), GenericCommand_macro_write_aliases(), GenericCommand_restartnotifs(), getmonsterlist(), GetPlayerScoreString(), GetPlayerSound(), GetVoiceMessage(), GiveItems(), GiveRandomWeapons(), havocbot_ai(), havocbot_chooseweapon(), havocbot_chooseweapon_checkreload(), HUD_Main(), HUD_MinigameMenu_ClickCreate(), HUD_ModIcons_Export(), HUD_Weapons(), ImpulseCommands(), invasion_PickMonster(), Item_DefinitionFromInternalName(), Item_FindDefinition(), Item_GiveTo(), Item_Initialize(), Item_ItemsTime_Allow(), kh_Key_AssignTo(), LocalCommand_macro_command(), LocalCommand_macro_help(), LocalCommand_macro_usage(), LocalCommand_macro_write_aliases(), MapInfo_CurrentGametype(), MapInfo_Get_ByName(), MapInfo_Get_ByName_NoFallbacks(), MapInfo_LoadMapSettings(), MapInfo_SwitchGameType(), MapInfo_Type_FromString(), minigame_get_descriptor(), monsters_animoverride(), MUTATOR_HOOKFUNCTION(), Nade_FromProjectile(), NET_HANDLE(), NIX_ChooseNextWeapon(), PlayerDamage(), PlayerScore_Clear(), PlayerScore_Compare(), PlayerScore_PlayerStats(), PlayerScore_SendEntity(), PRECACHE(), PutPlayerInServer(), RandomItems_GetRandomItemClassNameWithProperty(), RandomItems_GetRandomVanillaItemClassName(), readlevelcvars(), readplayerstartcvars(), REGISTER_MUTATOR(), REGISTRY(), REGISTRY_END(), Score_ClearAll(), Score_NicePrint(), Score_NicePrint_Player(), Score_NicePrint_Team(), Scoreboard_AccuracyStats_Draw(), Scoreboard_AccuracyStats_WouldDraw(), Scoreboard_InitScores(), ScoreInfo_SendEntity(), ScoreRules_basics(), ServerList_TypeSort_Click(), spawnfunc(), spawnmonster(), STATIC_INIT(), STATIC_INIT_LATE(), target_init_use(), View_PostProcessing(), W_GetCycleWeapon(), W_Model(), W_NumberWeaponOrder_MapFunc(), W_RandomWeapons(), W_ThrowNewWeapon(), Weapon_from_name(), weapon_pickupevalfunc(), weapons_all(), weapons_devall(), weapons_most(), and weapons_start().

◆ FOREACH_ARRAY

#define FOREACH_ARRAY (   arr,
  start,
  end,
  cond,
  body 
)
Value:
for (int _i = start; _i < end; ++_i) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = arr[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

Definition at line 9 of file iter.qh.

◆ FOREACH_CHAR

#define FOREACH_CHAR (   s,
  cond,
  body 
)
Value:
STRING_ITERATOR(iter, s, 0); \
int _it; \
while ((_it = STRING_ITERATOR_GET(iter)) > 0) \
{ \
const noref int it = _it; \
if (cond) { LAMBDA(body) } \
} \
MACRO_END
#define LAMBDA(...)
Definition: misc.qh:37
#define STRING_ITERATOR(this, s, i)
Definition: iter.qh:45
#define STRING_ITERATOR_GET(this)
Definition: iter.qh:55

Definition at line 62 of file iter.qh.

Referenced by markdown().

◆ FOREACH_ENTITY

#define FOREACH_ENTITY (   cond,
  body 
)    ORDERED(FOREACH_ENTITY)(cond, body)

Definition at line 137 of file iter.qh.

Referenced by GENERIC_COMMAND().

◆ FOREACH_ENTITY_CLASS

#define FOREACH_ENTITY_CLASS (   class,
  cond,
  body 
)    ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)

◆ FOREACH_ENTITY_CLASS_ORDERED

#define FOREACH_ENTITY_CLASS_ORDERED (   class,
  cond,
  body 
)    _FOREACH_ENTITY_FIND_ORDERED(string, classname, class, cond, body)

Definition at line 190 of file iter.qh.

Referenced by GENERIC_COMMAND().

◆ FOREACH_ENTITY_CLASS_UNORDERED

#define FOREACH_ENTITY_CLASS_UNORDERED (   class,
  cond,
  body 
)    _FOREACH_ENTITY_FIND_UNORDERED(clazz, string, classname, class, cond, body)

Definition at line 192 of file iter.qh.

◆ FOREACH_ENTITY_ENT

#define FOREACH_ENTITY_ENT (   fld,
  match,
  body 
)    ORDERED(FOREACH_ENTITY_ENT)(fld, match, body)

◆ FOREACH_ENTITY_ENT_ORDERED

#define FOREACH_ENTITY_ENT_ORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_ORDERED(entity, fld, match, true, body)

Definition at line 180 of file iter.qh.

◆ FOREACH_ENTITY_ENT_UNORDERED

#define FOREACH_ENTITY_ENT_UNORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_UNORDERED(, entity, fld, match, true, body)

Definition at line 182 of file iter.qh.

◆ FOREACH_ENTITY_FLAGS

#define FOREACH_ENTITY_FLAGS (   fld,
  match,
  body 
)    ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)

Definition at line 153 of file iter.qh.

◆ FOREACH_ENTITY_FLAGS_ORDERED

#define FOREACH_ENTITY_FLAGS_ORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_ORDERED(flags, fld, match, true, body)

Definition at line 154 of file iter.qh.

◆ FOREACH_ENTITY_FLAGS_UNORDERED

#define FOREACH_ENTITY_FLAGS_UNORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_UNORDERED(, flags, fld, match, true, body)

Definition at line 156 of file iter.qh.

◆ FOREACH_ENTITY_FLOAT

#define FOREACH_ENTITY_FLOAT (   fld,
  match,
  body 
)    ORDERED(FOREACH_ENTITY_FLOAT)(fld, match, body)

Definition at line 174 of file iter.qh.

Referenced by crosshair_trace_plusvisibletriggers__is_wz().

◆ FOREACH_ENTITY_FLOAT_ORDERED

#define FOREACH_ENTITY_FLOAT_ORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_ORDERED(float, fld, match, true, body)

Definition at line 175 of file iter.qh.

Referenced by reset_map().

◆ FOREACH_ENTITY_FLOAT_UNORDERED

#define FOREACH_ENTITY_FLOAT_UNORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_UNORDERED(, float, fld, match, true, body)

Definition at line 177 of file iter.qh.

◆ FOREACH_ENTITY_ORDERED

#define FOREACH_ENTITY_ORDERED (   cond,
  body 
)
Value:
MACRO_BEGIN \
int _i = 0; \
for (entity _it = NULL; (_it = nextent(_it)); ++_i) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = _it; \
if (cond) LAMBDA(body) \
} \
MACRO_END
entity() spawn
#define LAMBDA(...)
Definition: misc.qh:37
#define NULL
Definition: post.qh:17

Definition at line 138 of file iter.qh.

Referenced by GameCommand(), GENERIC_COMMAND(), reset_map(), and Shutdown().

◆ FOREACH_ENTITY_STRING

#define FOREACH_ENTITY_STRING (   fld,
  match,
  body 
)    ORDERED(FOREACH_ENTITY_STRING)(fld, match, body)

◆ FOREACH_ENTITY_STRING_ORDERED

#define FOREACH_ENTITY_STRING_ORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_ORDERED(string, fld, match, true, body)

Definition at line 185 of file iter.qh.

◆ FOREACH_ENTITY_STRING_UNORDERED

#define FOREACH_ENTITY_STRING_UNORDERED (   fld,
  match,
  body 
)    _FOREACH_ENTITY_FIND_UNORDERED(, string, fld, match, true, body)

Definition at line 187 of file iter.qh.

◆ FOREACH_ENTITY_UNORDERED

#define FOREACH_ENTITY_UNORDERED (   cond,
  body 
)    _FOREACH_ENTITY_FIND_UNORDERED(all, entity, _FOREACH_ENTITY_fld, NULL, cond, body)

Definition at line 151 of file iter.qh.

◆ FOREACH_LIST

#define FOREACH_LIST (   list,
  next,
  cond,
  body 
)
Value:
MACRO_BEGIN \
int _i = 0; \
for (entity _it = list##_first, _next = NULL; _it; (_it = _next, ++_i)) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = _it; \
_next = _it.next; \
if (cond) { LAMBDA(body) } \
} \
MACRO_END
entity() spawn
#define LAMBDA(...)
Definition: misc.qh:37
#define NULL
Definition: post.qh:17

Definition at line 21 of file iter.qh.

Referenced by WarpZone_FindRadius().

◆ FOREACH_WORD

#define FOREACH_WORD (   words,
  cond,
  body 
)
Value:
MACRO_BEGIN \
string _words = words; \
int _i = 0; \
for (string _it; (_it = car(_words)); (_words = cdr(_words), ++_i)) \
{ \
const noref int i = _i; \
const noref string it = _it; \
if (cond) { LAMBDA(body) } \
} \
MACRO_END
ERASEABLE string cdr(string s)
returns all but first word
Definition: string.qh:249
#define LAMBDA(...)
Definition: misc.qh:37
ERASEABLE string car(string s)
returns first word
Definition: string.qh:240

Definition at line 33 of file iter.qh.

Referenced by findinlist_abbrev(), FixIntermissionClient(), GenericCommand_addtolist(), GenericCommand_maplist(), GenericCommand_removefromlist(), invasion_SpawnChosenMonster(), precache_playermodels(), Say(), Teleport_Touch(), TeleportPlayer(), and W_Apply_Weaponreplace().

◆ ITER_CONST

#define ITER_CONST   const

Definition at line 4 of file iter.qh.

◆ MUTEX_LOCK

#define MUTEX_LOCK (   this)
Value:
if (this) LOG_SEVEREF("Loop mutex held by %s", this); \
this = __FUNC__; \
#define MACRO_END
Definition: macro.qh:7
#define LOG_SEVEREF(...)
Definition: log.qh:63
entity this
Definition: self.qh:83
if(IS_DEAD(this))
Definition: impulse.qc:92

Definition at line 122 of file iter.qh.

◆ MUTEX_UNLOCK

#define MUTEX_UNLOCK (   this)
Value:
MACRO_BEGIN \
this = string_null; \
MACRO_END
string string_null
Definition: nil.qh:9

Definition at line 126 of file iter.qh.

◆ ORDERED

#define ORDERED (   F)    F##_UNORDERED

Definition at line 111 of file iter.qh.

◆ STRING_ITERATOR

#define STRING_ITERATOR (   this,
  s,
 
)
Value:
string this##_s = s; \
int this##_i = i

Definition at line 45 of file iter.qh.

◆ STRING_ITERATOR_GET

◆ STRING_ITERATOR_LOAD

#define STRING_ITERATOR_LOAD (   this,
 
)    MACRO_BEGIN this##_i = n; MACRO_END

Definition at line 60 of file iter.qh.

◆ STRING_ITERATOR_NEXT

#define STRING_ITERATOR_NEXT (   this)    MACRO_BEGIN ++this##_i; MACRO_END

Definition at line 57 of file iter.qh.

Referenced by _json_parse_array(), and _json_parse_members().

◆ STRING_ITERATOR_PEEK

#define STRING_ITERATOR_PEEK (   this)    str2chr(this##_s, this##_i)

Definition at line 56 of file iter.qh.

Referenced by _json_parse_array(), and _json_parse_members().

◆ STRING_ITERATOR_SAVE

#define STRING_ITERATOR_SAVE (   this)    this##_i

Definition at line 59 of file iter.qh.

◆ STRING_ITERATOR_SET

#define STRING_ITERATOR_SET (   this,
  s,
 
)
Value:
MACRO_BEGIN \
this##_s = s; \
this##_i = i; \
MACRO_END

Definition at line 49 of file iter.qh.

Referenced by json_parse(), and STATIC_INIT().

◆ STRING_ITERATOR_UNGET

#define STRING_ITERATOR_UNGET (   this)    MACRO_BEGIN --this##_i; MACRO_END

Definition at line 58 of file iter.qh.

Referenced by _json_parse_float(), _json_parse_int(), and _json_parse_string().

Variable Documentation

◆ _FOREACH_ENTITY_FIND_entity_allmutex

noref string _FOREACH_ENTITY_FIND_entity_allmutex

Definition at line 150 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_entity_mutex

noref string _FOREACH_ENTITY_FIND_entity_mutex

Definition at line 181 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_entity_next

entity _FOREACH_ENTITY_FIND_entity_next

Definition at line 181 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_entity_nextall

entity _FOREACH_ENTITY_FIND_entity_nextall

Definition at line 150 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_flags_mutex

noref string _FOREACH_ENTITY_FIND_flags_mutex

Definition at line 155 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_flags_next

entity _FOREACH_ENTITY_FIND_flags_next

Definition at line 155 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_float_mutex

noref string _FOREACH_ENTITY_FIND_float_mutex

Definition at line 176 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_float_next

entity _FOREACH_ENTITY_FIND_float_next

Definition at line 176 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_string_clazzmutex

noref string _FOREACH_ENTITY_FIND_string_clazzmutex

Definition at line 191 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_string_mutex

noref string _FOREACH_ENTITY_FIND_string_mutex

Definition at line 186 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_string_next

entity _FOREACH_ENTITY_FIND_string_next

Definition at line 186 of file iter.qh.

◆ _FOREACH_ENTITY_FIND_string_nextclazz

entity _FOREACH_ENTITY_FIND_string_nextclazz

Definition at line 191 of file iter.qh.

◆ _FOREACH_ENTITY_fld

entity _FOREACH_ENTITY_fld

marker field, always NULL

Definition at line 149 of file iter.qh.