From 19e5fa4ee9a0bb59c1cec92a1b0501b14f8ccb63 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 5 Aug 2017 18:37:08 +1000 Subject: [PATCH] Style: expand LAMBDA() --- qcsrc/common/mutators/base.qh | 8 ++-- qcsrc/common/mutators/mutator/buffs/buffs.qc | 2 +- .../common/mutators/mutator/buffs/cl_buffs.qc | 4 +- .../common/mutators/mutator/buffs/sv_buffs.qc | 4 +- .../mutator/damagetext/sv_damagetext.qc | 4 +- .../mutators/mutator/instagib/sv_instagib.qc | 2 +- .../mutators/mutator/itemstime/itemstime.qc | 38 ++++++++--------- qcsrc/common/mutators/mutator/nades/nades.qc | 12 +++--- qcsrc/common/mutators/mutator/nades/nades.qh | 4 +- .../mutators/mutator/new_toys/sv_new_toys.qc | 16 +++---- qcsrc/common/mutators/mutator/nix/sv_nix.qc | 6 +-- .../mutators/mutator/pinata/sv_pinata.qc | 4 +- .../mutators/mutator/sandbox/sv_sandbox.qc | 6 +-- .../sv_spawn_near_teammate.qc | 8 ++-- .../mutator/superspec/sv_superspec.qc | 14 +++---- .../mutator/touchexplode/sv_touchexplode.qc | 4 +- .../mutator/waypoints/waypointsprites.qc | 4 +- .../dialog_multiplayer_create_mutators.qc | 4 +- qcsrc/menu/xonotic/keybinder.qc | 4 +- qcsrc/server/_all.qh | 26 ++++++------ qcsrc/server/bot/default/bot.qc | 18 ++++---- qcsrc/server/bot/default/havocbot/havocbot.qc | 12 +++--- qcsrc/server/bot/default/havocbot/roles.qc | 4 +- qcsrc/server/bot/default/scripting.qc | 10 ++--- qcsrc/server/bot/default/waypoints.qc | 4 +- qcsrc/server/campaign.qc | 4 +- qcsrc/server/cheats.qc | 2 +- qcsrc/server/client.qc | 10 ++--- qcsrc/server/command/common.qc | 24 +++++------ qcsrc/server/command/common.qh | 14 +++---- qcsrc/server/command/reg.qh | 2 +- qcsrc/server/command/sv_cmd.qc | 32 +++++++------- qcsrc/server/command/vote.qc | 22 +++++----- qcsrc/server/g_damage.qc | 4 +- qcsrc/server/g_world.qc | 32 +++++++------- qcsrc/server/mapvoting.qc | 8 ++-- qcsrc/server/miscfunctions.qc | 26 ++++++------ qcsrc/server/miscfunctions.qh | 2 +- qcsrc/server/mutators/loader.qc | 2 +- .../mutators/mutator/gamemode_assault.qc | 2 +- qcsrc/server/mutators/mutator/gamemode_ca.qc | 12 +++--- qcsrc/server/mutators/mutator/gamemode_ctf.qc | 32 +++++++------- qcsrc/server/mutators/mutator/gamemode_cts.qc | 4 +- .../mutators/mutator/gamemode_domination.qc | 8 ++-- .../mutators/mutator/gamemode_freezetag.qc | 42 +++++++++---------- .../mutators/mutator/gamemode_invasion.qc | 8 ++-- .../mutators/mutator/gamemode_keyhunt.qc | 30 ++++++------- qcsrc/server/mutators/mutator/gamemode_lms.qc | 4 +- .../server/mutators/mutator/gamemode_race.qc | 8 ++-- qcsrc/server/player.qc | 8 ++-- qcsrc/server/portals.qc | 4 +- qcsrc/server/race.qc | 8 ++-- qcsrc/server/scores.qc | 14 +++---- qcsrc/server/spawnpoints.qc | 4 +- qcsrc/server/sv_main.qc | 8 ++-- qcsrc/server/teamplay.qc | 8 ++-- qcsrc/server/weapons/accuracy.qc | 2 +- qcsrc/server/weapons/spawning.qc | 8 ++-- qcsrc/server/weapons/throwing.qc | 4 +- qcsrc/server/weapons/tracing.qc | 4 +- qcsrc/server/weapons/weaponsystem.qc | 4 +- 61 files changed, 316 insertions(+), 316 deletions(-) diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index 7ef70f2c4..4e7676c15 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -185,9 +185,9 @@ bool Mutator_SendEntity(entity this, entity to, int sf) void NET_Mutator_Remove(entity this) { string s = this.netname; - WITH(bool, mutator_log, true, LAMBDA( + WITH(bool, mutator_log, true, { FOREACH(Mutators, it.registered_id == s, Mutator_Remove(it)); - )); + }); } NET_HANDLE(Mutator, bool isNew) { @@ -199,9 +199,9 @@ NET_HANDLE(Mutator, bool isNew) make_pure(this); this.entremove = NET_Mutator_Remove; int added = 0; - WITH(bool, mutator_log, true, LAMBDA( + WITH(bool, mutator_log, true, { FOREACH(Mutators, it.registered_id == s, { Mutator_Add(it); ++added; }); - )); + }); if (added > 1) LOG_WARNF("Added more than one mutator for %s", s); } } diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index b80875e36..8ef69aad9 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -10,7 +10,7 @@ entity buff_FirstFromFlags(int _buffs) { if (flags) { - FOREACH(Buffs, it.m_itemid & _buffs, LAMBDA(return it)); + FOREACH(Buffs, it.m_itemid & _buffs, { return it; }); } return BUFF_Null; } diff --git a/qcsrc/common/mutators/mutator/buffs/cl_buffs.qc b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qc index ca1475372..a46a92d0a 100644 --- a/qcsrc/common/mutators/mutator/buffs/cl_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/cl_buffs.qc @@ -4,9 +4,9 @@ REGISTER_MUTATOR(cl_buffs, true); MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add) { int allBuffs = STAT(BUFFS); - FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA( + FOREACH(Buffs, it.m_itemid & allBuffs, { addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, STAT(BUFF_TIME) - time, 99), 60); - )); + }); } MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format) { diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index fdc555dd2..b9b2a8e06 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -637,7 +637,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) { float best_distance = autocvar_g_buffs_swapper_range; entity closest = NULL; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle) if(DIFF_TEAM(it, player)) { @@ -648,7 +648,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) closest = it; } } - )); + }); if(closest) { diff --git a/qcsrc/common/mutators/mutator/damagetext/sv_damagetext.qc b/qcsrc/common/mutators/mutator/damagetext/sv_damagetext.qc index 8daf92030..0e170e57e 100644 --- a/qcsrc/common/mutators/mutator/damagetext/sv_damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext/sv_damagetext.qc @@ -16,7 +16,7 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) { const float armor = M_ARGV(3, float); const int deathtype = M_ARGV(5, int); const float potential_damage = M_ARGV(6, float); - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it), { if ( (SV_DAMAGETEXT_ALL()) || (SV_DAMAGETEXT_PLAYERS() && it == attacker) || @@ -53,5 +53,5 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) { else WriteShort(MSG_ONE, potential_damage * DAMAGETEXT_PRECISION_MULTIPLIER); } } - )); + }); } diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 578294a72..fefad540b 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -130,7 +130,7 @@ void instagib_ammocheck(entity this) MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd) { - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(instagib_stop_countdown(it))); + FOREACH_CLIENT(IS_PLAYER(it), { instagib_stop_countdown(it); }); } MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem) diff --git a/qcsrc/common/mutators/mutator/itemstime/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc index 472fc646d..c2402ef46 100644 --- a/qcsrc/common/mutators/mutator/itemstime/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc @@ -30,9 +30,9 @@ NET_HANDLE(itemstime, bool isNew) #ifdef CSQC void Item_ItemsTime_Init() { - FOREACH(Items, true, LAMBDA( + FOREACH(Items, true, { ItemsTime_time[it.m_id] = -1; - )); + }); ItemsTime_time[Items_MAX] = -1; } @@ -79,9 +79,9 @@ float it_times[Items_MAX + 1]; void Item_ItemsTime_Init() { - FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it), { it_times[it.m_id] = -1; - )); + }); it_times[Items_MAX] = -1; } @@ -92,25 +92,25 @@ STATIC_INIT(ItemsTime_Init) { void Item_ItemsTime_ResetTimes() { - FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it), { it_times[it.m_id] = (it_times[it.m_id] == -1) ? -1 : 0; - )); + }); it_times[Items_MAX] = (it_times[Items_MAX] == -1) ? -1 : 0; } void Item_ItemsTime_ResetTimesForPlayer(entity e) { - FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it), { IT_Write(e, it.m_id, (it_times[it.m_id] == -1) ? -1 : 0); - )); + }); IT_Write(e, Items_MAX, (it_times[Items_MAX] == -1) ? -1 : 0); } void Item_ItemsTime_SetTimesForPlayer(entity e) { - FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it), { IT_Write(e, it.m_id, it_times[it.m_id]); - )); + }); IT_Write(e, Items_MAX, it_times[Items_MAX]); } @@ -131,7 +131,7 @@ void Item_ItemsTime_SetTime(entity e, float t) void Item_ItemsTime_SetTimesForAllPlayers() { - FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it) || autocvar_sv_itemstime == 2), LAMBDA(Item_ItemsTime_SetTimesForPlayer(it))); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it) || autocvar_sv_itemstime == 2), { Item_ItemsTime_SetTimesForPlayer(it); }); } float Item_ItemsTime_UpdateTime(entity e, float t) @@ -293,23 +293,23 @@ void HUD_ItemsTime() int count = 0; if (autocvar_hud_panel_itemstime_hidespawned == 1) { - FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it), { count += (Item_ItemsTime_GetTime(it.m_id) > time || -Item_ItemsTime_GetTime(it.m_id) > time); - )); + }); count += (Item_ItemsTime_GetTime(Items_MAX) > time || -Item_ItemsTime_GetTime(Items_MAX) > time); } else if (autocvar_hud_panel_itemstime_hidespawned == 2) { - FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it), { count += (Item_ItemsTime_GetTime(it.m_id) > time); - )); + }); count += (Item_ItemsTime_GetTime(Items_MAX) > time); } else { - FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it), { count += (Item_ItemsTime_GetTime(it.m_id) != -1); - )); + }); count += (Item_ItemsTime_GetTime(Items_MAX) != -1); } if (count == 0) @@ -385,7 +385,7 @@ void HUD_ItemsTime() bool item_available; int id = 0; string icon = ""; - FOREACH(Items, Item_ItemsTime_Allow(it) && Item_ItemsTime_GetTime(it.m_id) != -1, LAMBDA( + FOREACH(Items, Item_ItemsTime_Allow(it) && Item_ItemsTime_GetTime(it.m_id) != -1, { id = it.m_id; icon = it.m_icon; @@ -429,7 +429,7 @@ LABEL(iteration) } if(id == Items_MAX) // can happen only in the last fake iteration break; - )); + }); // add another fake iteration for superweapons time if(id < Items_MAX && Item_ItemsTime_GetTime(Items_MAX) != -1) { diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 9447ba395..77286eac5 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -16,7 +16,7 @@ entity Nade_TrailEffect(int proj, int nade_team) case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team); } - FOREACH(Nades, true, LAMBDA( + FOREACH(Nades, true, { for (int j = 0; j < 2; j++) { if (it.m_projectile[j] == proj) @@ -26,7 +26,7 @@ entity Nade_TrailEffect(int proj, int nade_team) break; } } - )); + }); return EFFECT_Null; } @@ -1278,7 +1278,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) { vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != player, { if(!IS_DEAD(it)) if(STAT(FROZEN, it) == 0) if(SAME_TEAM(it, player)) @@ -1290,7 +1290,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) it.reviving = true; ++n; } - )); + }); } if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us @@ -1306,10 +1306,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname); } - FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, { it.revive_progress = player.revive_progress; it.reviving = false; - )); + }); } } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index fd8d26902..3618fd418 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -42,12 +42,12 @@ REGISTER_NADE(Null); Nade Nade_FromProjectile(int proj) { - FOREACH(Nades, true, LAMBDA( + FOREACH(Nades, true, { for (int j = 0; j < 2; j++) { if (it.m_projectile[j] == proj) return it; } - )); + }); return NADE_TYPE_Null; } diff --git a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc index 7cf5b430d..277a4e7db 100644 --- a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc +++ b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc @@ -78,18 +78,18 @@ REGISTER_MUTATOR(nt, cvar("g_new_toys") && !cvar("g_instagib") && !cvar("g_overk error("This cannot be added at runtime\n"); // mark the guns as ok to use by e.g. impulse 99 - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(nt_IsNewToy(it.m_id)) it.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; - )); + }); } MUTATOR_ONROLLBACK_OR_REMOVE { - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(nt_IsNewToy(it.m_id)) it.spawnflags |= WEP_FLAG_MUTATORBLOCKED; - )); + }); } MUTATOR_ONREMOVE @@ -165,20 +165,20 @@ MUTATOR_HOOKFUNCTION(nt, SetStartItems) WepSet seti = '0 0 0'; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { seti = it.m_wepset; n = tokenize_console(nt_GetReplacement(it.netname, autocvar_g_new_toys_autoreplace)); for(j = 0; j < n; ++j) - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(it.netname == argv(j)) { WepSet setk = it.m_wepset; if(start_weapons & seti) newdefault |= setk; if(warmup_start_weapons & seti) warmup_newdefault |= setk; } - )); - )); + }); + }); newdefault &= start_weapons_defaultmask; start_weapons &= ~start_weapons_defaultmask; diff --git a/qcsrc/common/mutators/mutator/nix/sv_nix.qc b/qcsrc/common/mutators/mutator/nix/sv_nix.qc index 135e50793..425b8c22b 100644 --- a/qcsrc/common/mutators/mutator/nix/sv_nix.qc +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qc @@ -44,7 +44,7 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill" nix_nextchange = 0; nix_nextweapon = 0; - FOREACH(Weapons, it != WEP_Null && NIX_CanChooseWeapon(it.m_id), LAMBDA(it.wr_init(it))); + FOREACH(Weapons, it != WEP_Null && NIX_CanChooseWeapon(it.m_id), { it.wr_init(it); }); } MUTATOR_ONROLLBACK_OR_REMOVE @@ -100,10 +100,10 @@ bool NIX_CanChooseWeapon(int wpn) void NIX_ChooseNextWeapon() { RandomSelection_Init(); - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(NIX_CanChooseWeapon(it.m_id)) RandomSelection_AddFloat(it.m_id, 1, (it.m_id != nix_weapon)); - )); + }); nix_nextweapon = RandomSelection_chosen_float; } diff --git a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc index ff44cc8bd..53e4f49e6 100644 --- a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc +++ b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc @@ -13,12 +13,12 @@ MUTATOR_HOOKFUNCTION(pinata, PlayerDies) if(frag_target.(weaponentity).m_weapon == WEP_Null) continue; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(frag_target.weapons & WepSet_FromWeapon(it)) if(frag_target.(weaponentity).m_weapon != it) if(W_IsWeaponThrowable(frag_target, it.m_id)) W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity); - )); + }); } return true; diff --git a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc index a2211fe75..0fd58c680 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc @@ -75,14 +75,14 @@ void sandbox_ObjectFunction_Think(entity this) // since if the owning player disconnects, the object's owner should also be reset. // bots can't have objects - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { if(this.crypto_idfp == it.crypto_idfp) { this.realowner = it; break; } this.realowner = NULL; - )); + }); this.nextthink = time; @@ -209,7 +209,7 @@ void sandbox_ObjectRemove(entity e) sandbox_ObjectAttach_Remove(e); // detach child objects // if the object being removed has been selected for attachment by a player, unset it - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.object_attach == e, LAMBDA(it.object_attach = NULL)); + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.object_attach == e, { it.object_attach = NULL; }); if(e.material) { strunzone(e.material); e.material = string_null; } if(e.crypto_idfp) { strunzone(e.crypto_idfp); e.crypto_idfp = string_null; } diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc index ee7572863..55bc12392 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc @@ -33,7 +33,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score) return; RandomSelection_Init(); - FOREACH_CLIENT(IS_PLAYER(it) && it != player && SAME_TEAM(it, player) && !IS_DEAD(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != player && SAME_TEAM(it, player) && !IS_DEAD(it), { if(vdist(spawn_spot.origin - it.origin, >, autocvar_g_spawn_near_teammate_distance)) continue; if(vdist(spawn_spot.origin - it.origin, <, 48)) @@ -41,7 +41,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score) if(!checkpvs(spawn_spot.origin, it)) continue; RandomSelection_AddEnt(it, 1, 1); - )); + }); if(RandomSelection_chosen_ent) { @@ -85,7 +85,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn) vector best_pos = '0 0 0'; float best_dist2 = FLOAT_MAX; int tested = 0; - FOREACH_CLIENT_RANDOM(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT_RANDOM(IS_PLAYER(it), { if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_max && tested >= autocvar_g_spawn_near_teammate_ignore_spawnpoint_max) break; if (PHYS_INPUT_BUTTON_CHAT(it)) continue; @@ -196,7 +196,7 @@ LABEL(skip) break; // don't test the other spots near this teammate, go to the next one } } - )); + }); if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath) if(best_mate) diff --git a/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc index c423042a3..4c99095b7 100644 --- a/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc +++ b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc @@ -103,7 +103,7 @@ MUTATOR_HOOKFUNCTION(superspec, ItemTouch) entity item = M_ARGV(0, entity); entity toucher = M_ARGV(1, entity); - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { if(!IS_SPEC(it) && !IS_OBSERVER(it)) continue; if(it.superspec_flags & SSF_ITEMMSG) @@ -143,7 +143,7 @@ MUTATOR_HOOKFUNCTION(superspec, ItemTouch) } } } - )); + }); return MUT_ITEMTOUCH_CONTINUE; } @@ -345,7 +345,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand) if(cmd_name == "followpowerup") { - FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), LAMBDA(return superspec_Spectate(player, it))); + FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), { return superspec_Spectate(player, it); }); superspec_msg("", "", player, "No active powerup\n", 1); return true; @@ -353,7 +353,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand) if(cmd_name == "followstrength") { - FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, LAMBDA(return superspec_Spectate(player, it))); + FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, { return superspec_Spectate(player, it); }); superspec_msg("", "", player, "No active Strength\n", 1); return true; @@ -361,7 +361,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand) if(cmd_name == "followshield") { - FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, LAMBDA(return superspec_Spectate(player, it))); + FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, { return superspec_Spectate(player, it); }); superspec_msg("", "", player, "No active Shield\n", 1); return true; @@ -440,7 +440,7 @@ MUTATOR_HOOKFUNCTION(superspec, PlayerDies) entity frag_attacker = M_ARGV(1, entity); entity frag_target = M_ARGV(2, entity); - FOREACH_CLIENT(IS_SPEC(it), LAMBDA( + FOREACH_CLIENT(IS_SPEC(it), { if(it.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && it.enemy == frag_target) { if(it.autospec_flags & ASF_SHOWWHAT) @@ -448,7 +448,7 @@ MUTATOR_HOOKFUNCTION(superspec, PlayerDies) superspec_Spectate(it, frag_attacker); } - )); + }); } MUTATOR_HOOKFUNCTION(superspec, ClientDisconnect) diff --git a/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc index ddcd89160..3e6edb04b 100644 --- a/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc +++ b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc @@ -33,7 +33,7 @@ MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink) if(IS_PLAYER(player)) if(!IS_DEAD(player)) if(!IS_INDEPENDENT_PLAYER(player)) - FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != player, { if(time > it.touchexplode_time) if(!STAT(FROZEN, it)) if(!IS_DEAD(it)) @@ -43,5 +43,5 @@ MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink) PlayerTouchExplode(player, it); player.touchexplode_time = it.touchexplode_time = time + 0.2; } - )); + }); } diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 81f54b1c9..9e2039223 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -259,9 +259,9 @@ string spritelookuptext(entity this, string s) } // need to loop, as our netname could be one of three - FOREACH(Waypoints, it.netname == s, LAMBDA( + FOREACH(Waypoints, it.netname == s, { return it.m_name; - )); + }); return s; } diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc index 3ce8afcbb..0ea24a889 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc @@ -41,10 +41,10 @@ string WeaponArenaString() s = ""; for(i = 0; i < n; ++i) { - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(argv(i) == it.netname) s = strcat(s, " & ", it.m_name); - )); + }); } s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3)); diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index 4546a62b1..1f28a1bdf 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -51,11 +51,11 @@ void Xonotic_KeyBinds_Read() int i; #define ADD_TO_W_LIST(pred) \ - FOREACH(Weapons, it != WEP_Null, LAMBDA( \ + FOREACH(Weapons, it != WEP_Null, { \ if (it.impulse != imp) continue; \ if (!(pred)) continue; \ w_list = strcat(w_list, it.m_name, " / "); \ - )) + }) for(int imp = 1; imp <= 9; ++imp) { diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh index 1fabe4d0f..1c0382cae 100644 --- a/qcsrc/server/_all.qh +++ b/qcsrc/server/_all.qh @@ -52,19 +52,19 @@ bool _FCR_entered = false; if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \ _FCR_entered = true; \ int _cnt = 0; \ - FOREACH_CLIENT(cond, LAMBDA( \ - int _j = floor(random() * (_cnt + 1)); \ - if (_j == _cnt) \ - { \ - _FCR_clients[_cnt] = it; \ - } \ - else \ - { \ - _FCR_clients[_cnt] = _FCR_clients[_j]; \ - _FCR_clients[_j] = it; \ - } \ - _cnt++; \ - )); \ + FOREACH_CLIENT(cond, { \ + int _j = floor(random() * (_cnt + 1)); \ + if (_j == _cnt) \ + { \ + _FCR_clients[_cnt] = it; \ + } \ + else \ + { \ + _FCR_clients[_cnt] = _FCR_clients[_j]; \ + _FCR_clients[_j] = it; \ + } \ + _cnt++; \ + }); \ for (int _i = 0; _i < _cnt; ++_i) \ { \ const noref int i = _i; \ diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index a1d7b10a4..8cef8618f 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -175,13 +175,13 @@ void bot_setnameandstuff(entity this) continue; s = argv(0); prio = 1; - FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_BOT_CLIENT(it), { if(s == it.cleanname) { prio = 0; break; } - )); + }); RandomSelection_AddString(readfile, 1, prio); } readfile = RandomSelection_chosen_string; @@ -248,10 +248,10 @@ void bot_setnameandstuff(entity this) // number bots with identical names int j = 0; - FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_BOT_CLIENT(it), { if(it.cleanname == name) ++j; - )); + }); if (j) this.netname = this.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix)); else @@ -526,12 +526,12 @@ void autoskill(float factor) bestbot = -1; bestplayer = -1; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(IS_REAL_CLIENT(it)) bestplayer = max(bestplayer, it.totalfrags - it.totalfrags_lastcheck); else bestbot = max(bestbot, it.totalfrags - it.totalfrags_lastcheck); - )); + }); LOG_DEBUG("autoskill: best player got ", ftos(bestplayer), ", "); LOG_DEBUG("best bot got ", ftos(bestbot), "; "); @@ -565,7 +565,7 @@ void autoskill(float factor) // don't reset counters, wait for them to accumulate } - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.totalfrags_lastcheck = it.totalfrags)); + FOREACH_CLIENT(IS_PLAYER(it), { it.totalfrags_lastcheck = it.totalfrags; }); } void bot_calculate_stepheightvec() @@ -584,11 +584,11 @@ float bot_fixcount() activerealplayers = M_ARGV(0, int); realplayers = M_ARGV(1, int); } else { - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it), { if(IS_PLAYER(it)) ++activerealplayers; ++realplayers; - )); + }); } int bots; diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 24d960284..5d31c7ee9 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -187,13 +187,13 @@ void havocbot_ai(entity this) if(skill >= 5) // bots can only look for unloaded weapons past this skill if(this.(weaponentity).clip_load >= 0) // only if we're not reloading a weapon already { - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.(weaponentity).weapon_load[it.m_id] < it.reloading_ammo)) { this.(weaponentity).m_switchweapon = it; break; } - )); + }); } } } @@ -1078,10 +1078,10 @@ float havocbot_chooseweapon_checkreload(entity this, .entity weaponentity, int n // if this weapon is scheduled for reloading, don't switch to it during combat if (this.(weaponentity).weapon_load[new_weapon] < 0) { - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(it.wr_checkammo1(it, this, weaponentity) + it.wr_checkammo2(it, this, weaponentity)) return true; // other weapon available - )); + }); } return false; @@ -1103,13 +1103,13 @@ void havocbot_chooseweapon(entity this, .entity weaponentity) { // If no weapon was chosen get the first available weapon if(this.(weaponentity).m_weapon==WEP_Null) - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(client_hasweapon(this, it, weaponentity, true, false)) { this.(weaponentity).m_switchweapon = it; return; } - )); + }); return; } diff --git a/qcsrc/server/bot/default/havocbot/roles.qc b/qcsrc/server/bot/default/havocbot/roles.qc index 675dd036b..22f444fd1 100644 --- a/qcsrc/server/bot/default/havocbot/roles.qc +++ b/qcsrc/server/bot/default/havocbot/roles.qc @@ -168,7 +168,7 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org ratingscale = ratingscale * 0.00005; // enemies are rated around 20000 already float t; - FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), { // TODO: Merge this logic with the bot_shouldattack function if(vdist(it.origin - org, <, 100) || vdist(it.origin - org, >, sradius)) continue; @@ -191,7 +191,7 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org ratingscale *= t; if (ratingscale > 0) navigation_routerating(this, it, ratingscale * BOT_RATING_ENEMY, 2000); - )); + }); } // legacy bot role for standard gamemodes diff --git a/qcsrc/server/bot/default/scripting.qc b/qcsrc/server/bot/default/scripting.qc index 9dca0af07..ca74965be 100644 --- a/qcsrc/server/bot/default/scripting.qc +++ b/qcsrc/server/bot/default/scripting.qc @@ -539,16 +539,16 @@ float bot_cmd_barrier(entity this) if(this.bot_barrier == 1) // find other bots { - FOREACH_CLIENT(it.isbot, LAMBDA( + FOREACH_CLIENT(it.isbot, { if(it.bot_cmdqueuebuf_allocated) if(it.bot_barrier != 1) return CMD_STATUS_EXECUTING; // not all are at the barrier yet - )); + }); // all bots hit the barrier! // acknowledge barrier - FOREACH_CLIENT(it.isbot, LAMBDA(it.bot_barrier = 2)); + FOREACH_CLIENT(it.isbot, { it.bot_barrier = 2; }); bot_barriertime = time; } @@ -1156,7 +1156,7 @@ void bot_setcurrentcommand(entity this) void bot_resetqueues() { - FOREACH_CLIENT(it.isbot, LAMBDA( + FOREACH_CLIENT(it.isbot, { it.bot_cmd_execution_index = 0; bot_clearqueue(it); // also, cancel all barriers @@ -1167,7 +1167,7 @@ void bot_resetqueues() it.(bot_placenames[i]) = string_null; } it.bot_places_count = 0; - )); + }); bot_barriertime = time; } diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index e4c227c8f..65cc69f66 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -1131,12 +1131,12 @@ LABEL(next) void botframe_autowaypoints() { - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && !IS_DEAD(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && !IS_DEAD(it), { // going back is broken, so only fix waypoints to walk TO the player //botframe_autowaypoints_fix(p, false, botframe_autowaypoints_lastwp0); botframe_autowaypoints_fix(it, true, botframe_autowaypoints_lastwp1); //te_explosion(p.botframe_autowaypoints_lastwp0.origin); - )); + }); if (autocvar_g_waypointeditor_auto >= 2) { botframe_deleteuselesswaypoints(); diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index 5097bd8a1..b39f82a10 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -192,12 +192,12 @@ void CampaignPreIntermission() int lost = 0; string savevar; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { if(it.winning) won += 1; else lost += 1; - )); + }); if(autocvar__campaign_testrun) { diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 6d78e160c..78c591264 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -264,7 +264,7 @@ float CheatImpulse(entity this, int imp) case CHIMPULSE_R00T.impulse: IS_CHEAT(this, imp, 0, 0); RandomSelection_Init(); - FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), LAMBDA(RandomSelection_AddEnt(it, 1, 1))); + FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), { RandomSelection_AddEnt(it, 1, 1); }); if(RandomSelection_chosen_ent) e = RandomSelection_chosen_ent; else diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 804868fa0..14b854bc6 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -151,7 +151,7 @@ void ClientData_Touch(entity e) CS(e).clientdata.SendFlags = 1; // make it spectatable - FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(CS(it).clientdata.SendFlags = 1)); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, { CS(it).clientdata.SendFlags = 1; }); } void SetSpectatee(entity this, entity spectatee); @@ -659,7 +659,7 @@ void PutPlayerInServer(entity this) target_voicescript_clear(this); // reset fields the weapons may use - FOREACH(Weapons, true, LAMBDA( + FOREACH(Weapons, true, { it.wr_resetplayer(it, this); // reload all reloadable weapons if (it.spawnflags & WEP_FLAG_RELOADABLE) { @@ -669,7 +669,7 @@ void PutPlayerInServer(entity this) this.(weaponentity).weapon_load[it.m_id] = it.reloading_ammo; } } - )); + }); { string s = spot.target; @@ -2009,13 +2009,13 @@ int nJoinAllowed(entity this, entity ignore) // TODO simplify this int totalClients = 0; int currentlyPlaying = 0; - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { if(it != ignore) ++totalClients; if(IS_REAL_CLIENT(it)) if(IS_PLAYER(it) || it.caplayer) ++currentlyPlaying; - )); + }); float free_slots = 0; if (!autocvar_g_maxplayers) diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 84366ea6b..77c393025 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -115,13 +115,13 @@ entity GetIndexedEntity(float argc, float start_index) } else // no, maybe it's a name? { - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { if(strdecolorize(it.netname) == strdecolorize(argv(start_index))) { selection = it; break; // no reason to keep looking } - )); + }); index = (start_index + 1); } @@ -148,13 +148,13 @@ entity GetFilteredEntity(string input) else { selection = NULL; - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { if(strdecolorize(it.netname) == strdecolorize(input)) { selection = it; break; // no reason to keep looking } - )); + }); } return selection; @@ -217,9 +217,9 @@ void timeout_handler_think(entity this) cvar_set("slowmo", ftos(orig_slowmo)); // unlock the view for players so they can move around again - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { it.fixangle = false; - )); + }); timeout_handler_reset(this); } @@ -244,16 +244,16 @@ void timeout_handler_think(entity this) cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE)); // reset all the flood variables - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { it.nickspamcount = it.nickspamtime = it.floodcontrol_chat = it.floodcontrol_chatteam = it.floodcontrol_chattell = it.floodcontrol_voice = it.floodcontrol_voiceteam = 0; - )); + }); // copy .v_angle to .lastV_angle for every player in order to fix their view during pause (see PlayerPreThink) - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { it.lastV_angle = it.v_angle; - )); + }); this.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code } @@ -784,7 +784,7 @@ void CommonCommand_who(float request, entity caller, float argc) "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id")); total_listed_players = 0; - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { is_bot = (IS_BOT_CLIENT(it)); if (is_bot) @@ -813,7 +813,7 @@ void CommonCommand_who(float request, entity caller, float argc) tmp_crypto_idfp)); ++total_listed_players; - )); + }); print_to(caller, strcat("Finished listing ", ftos(total_listed_players), " client(s) out of ", ftos(maxclients), " slots.")); diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index 27dd13a2d..13cbfe49e 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -15,7 +15,7 @@ REGISTRY_SORT(COMMON_COMMANDS) METHOD(commoncommand_##id, m_invokecmd, void(commoncommand_##id this, int request, entity caller, int arguments, string command)) STATIC_INIT(COMMON_COMMANDS_aliases) { - FOREACH(COMMON_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd")))); + FOREACH(COMMON_COMMANDS, true, { localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd")); }); } #include "vote.qh" @@ -157,30 +157,30 @@ COMMON_COMMAND(who, "Display detailed client information about all players") { C void CommonCommand_macro_help(entity caller) { - FOREACH(COMMON_COMMANDS, true, LAMBDA(print_to(caller, sprintf(" ^2%s^7: %s", it.m_name, it.m_description)))); + FOREACH(COMMON_COMMANDS, true, { print_to(caller, sprintf(" ^2%s^7: %s", it.m_name, it.m_description)); }); } float CommonCommand_macro_command(float argc, entity caller, string command) { string c = strtolower(argv(0)); - FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA( + FOREACH(COMMON_COMMANDS, it.m_name == c, { it.m_invokecmd(it, CMD_REQUEST_COMMAND, caller, argc, command); return true; - )); + }); return false; } float CommonCommand_macro_usage(float argc, entity caller) { string c = strtolower(argv(1)); - FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA( + FOREACH(COMMON_COMMANDS, it.m_name == c, { it.m_invokecmd(it, CMD_REQUEST_USAGE, caller, argc, ""); return true; - )); + }); return false; } void CommonCommand_macro_write_aliases(float fh) { - FOREACH(COMMON_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description))); + FOREACH(COMMON_COMMANDS, true, { CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description); }); } diff --git a/qcsrc/server/command/reg.qh b/qcsrc/server/command/reg.qh index b135c0460..8115d712e 100644 --- a/qcsrc/server/command/reg.qh +++ b/qcsrc/server/command/reg.qh @@ -14,5 +14,5 @@ REGISTRY_SORT(SERVER_COMMANDS) METHOD(servercommand_##id, m_invokecmd, void(servercommand_##id this, int request, entity caller, int arguments, string command)) STATIC_INIT(SERVER_COMMANDS_aliases) { - FOREACH(SERVER_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv")))); + FOREACH(SERVER_COMMANDS, true, { localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv")); }); } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 4d181c465..0bc47c0ac 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -193,11 +193,11 @@ void GameCommand_allspec(float request, float argc) { string reason = argv(1); int n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { if (it.caplayer) it.caplayer = 0; PutObserverInServer(it); ++n; - )); + }); if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n")); else LOG_INFO("No players found to spectate.\n"); return; @@ -563,11 +563,11 @@ void GameCommand_defer_clear_all(float request) int n = 0; float argc; - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { argc = tokenize_console(strcat("defer_clear ", ftos(etof(it)))); GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc); ++n; - )); + }); if (n) LOG_INFO(strcat("Successfully stuffed defer clear to all clients (", ftos(n), ")\n")); // should a message be added if no players were found? return; } @@ -1141,13 +1141,13 @@ void GameCommand_nospectators(float request) { blockSpectators = 1; // give every spectator seconds time to become a player - FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, { if(!it.caplayer) { CS(it).spectatortime = time; Send_Notification(NOTIF_ONE_ONLY, it, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); } - )); + }); bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds!\n")); return; } @@ -1345,7 +1345,7 @@ void GameCommand_shuffleteams(float request) return; } - FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, { if (it.team_forced) { // we could theoretically assign forced players to their teams // and shuffle the rest to fill the empty spots but in practise @@ -1353,7 +1353,7 @@ void GameCommand_shuffleteams(float request) LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n"); return; } - )); + }); int number_of_teams = 0; CheckAllowedTeams(NULL); @@ -1363,11 +1363,11 @@ void GameCommand_shuffleteams(float request) if (c4 >= 0) number_of_teams = max(4, number_of_teams); int team_index = 0; - FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, LAMBDA( + FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, { int target_team_number = Team_NumberToTeam(team_index + 1); if (it.team != target_team_number) MoveToTeam(it, target_team_number, 6); team_index = (team_index + 1) % number_of_teams; - )); + }); bprint("Successfully shuffled the players around randomly.\n"); return; @@ -1731,32 +1731,32 @@ SERVER_COMMAND(warp, "Choose different level in campaign") { GameCommand_warp(re void GameCommand_macro_help() { - FOREACH(SERVER_COMMANDS, true, LAMBDA(LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description))); + FOREACH(SERVER_COMMANDS, true, { LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description); }); } float GameCommand_macro_command(float argc, string command) { string c = strtolower(argv(0)); - FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA( + FOREACH(SERVER_COMMANDS, it.m_name == c, { it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command); return true; - )); + }); return false; } float GameCommand_macro_usage(float argc) { string c = strtolower(argv(1)); - FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA( + FOREACH(SERVER_COMMANDS, it.m_name == c, { it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, ""); return true; - )); + }); return false; } void GameCommand_macro_write_aliases(float fh) { - FOREACH(SERVER_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description))); + FOREACH(SERVER_COMMANDS, true, { CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description); }); } diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 5f96334dd..2db503ca2 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -119,7 +119,7 @@ string OriginalCallerName() void VoteReset() { - FOREACH_CLIENT(true, LAMBDA(it.vote_selection = 0)); + FOREACH_CLIENT(true, { it.vote_selection = 0; }); if (vote_called) { @@ -214,7 +214,7 @@ void VoteCount(float first_count) Nagger_VoteCountChanged(); // add up all the votes from each connected client - FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), { ++vote_player_count; if (IS_PLAYER(it)) ++vote_real_player_count; switch (it.vote_selection) @@ -233,7 +233,7 @@ void VoteCount(float first_count) } default: break; } - )); + }); // Check to see if there are enough players on the server to allow master voting... otherwise, vote master could be used for evil. if ((vote_called == VOTE_MASTER) && autocvar_sv_vote_master_playerlimit > vote_player_count) @@ -362,7 +362,7 @@ void reset_map(bool dorespawn) if (it.reset2) it.reset2(it); }); - FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(Unfreeze(it))); + FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), { Unfreeze(it); }); // Moving the player reset code here since the player-reset depends // on spawnpoint entities which have to be reset first --blub @@ -422,11 +422,11 @@ void ReadyRestart_force() game_starttime = time + RESTART_COUNTDOWN; // clear player attributes - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { it.alivetime = 0; CS(it).killcount = 0; PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, -PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, 0)); - )); + }); restart_mapalreadyrestarted = false; // reset this var, needed when cvar sv_ready_restart_repeatable is in use @@ -434,7 +434,7 @@ void ReadyRestart_force() warmup_stage = 0; // once the game is restarted the game is in match stage // reset the .ready status of all players (also spectators) - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(it.ready = false)); + FOREACH_CLIENT(IS_REAL_CLIENT(it), { it.ready = false; }); readycount = 0; Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client @@ -456,7 +456,7 @@ void ReadyRestart_force() // after a restart every players number of allowed timeouts gets reset, too if (autocvar_sv_timeout) { - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(CS(it).allowed_timeouts = autocvar_sv_timeout_number)); + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { CS(it).allowed_timeouts = autocvar_sv_timeout_number; }); } // reset map immediately if this cvar is not set if (!autocvar_sv_ready_restart_after_countdown) reset_map(true); @@ -480,10 +480,10 @@ void ReadyCount() float ready_needed_factor, ready_needed_count; float t_ready = 0, t_players = 0; - FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_PLAYER(it) || it.caplayer == 1), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_PLAYER(it) || it.caplayer == 1), { ++t_players; if (it.ready) ++t_ready; - )); + }); readycount = t_ready; @@ -808,7 +808,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm msg_entity = caller; } - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(++tmp_playercount)); + FOREACH_CLIENT(IS_REAL_CLIENT(it), { ++tmp_playercount; }); if (tmp_playercount > 1) Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_VOTE_CALL); // don't announce a "vote now" sound if player is alone bprint("\{1}^2* ^3", OriginalCallerName(), "^2 calls a vote for ", vote_called_display, "\n"); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 83911eeaf..61d04801b 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -1266,7 +1266,7 @@ void Fire_ApplyDamage(entity e) if(!IS_INDEPENDENT_PLAYER(e)) if(!STAT(FROZEN, e)) - FOREACH_CLIENT(IS_PLAYER(it) && it != e, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != e, { if(!IS_DEAD(it)) if(!IS_INDEPENDENT_PLAYER(it)) if(boxesoverlap(e.absmin, e.absmax, it.absmin, it.absmax)) @@ -1275,7 +1275,7 @@ void Fire_ApplyDamage(entity e) d = autocvar_g_balance_firetransfer_damage * e.fire_damagepersec * t; Fire_AddDamage(it, o, d, t, DEATH_FIRE.m_id); } - )); + }); } void Fire_ApplyEffect(entity e) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 4ad405adb..f00db073e 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1459,7 +1459,7 @@ void DumpStats(float final) if(to_file) fputs(file, strcat(s, "\n")); - FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), { s = strcat(":player:see-labels:", GetPlayerScoreString(it, 0), ":"); s = strcat(s, ftos(rint(time - CS(it).jointime)), ":"); if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it)) @@ -1473,7 +1473,7 @@ void DumpStats(float final) GameLogEcho(strcat(s, ftos(it.playerid), ":", playername(it, false))); if(to_file) fputs(file, strcat(s, playername(it, false), "\n")); - )); + }); if(teamplay) { @@ -1530,9 +1530,9 @@ void FixIntermissionClient(entity e) { stuffcmd(e, "\nscr_printspeed 1000000\n"); RandomSelection_Init(); - FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, LAMBDA( + FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, { RandomSelection_AddString(it, 1, 1); - )); + }); if (RandomSelection_chosen_string != "") { stuffcmd(e, sprintf("\ncd loop %s\n", RandomSelection_chosen_string)); @@ -1582,11 +1582,11 @@ void NextLevel() GameLogClose(); - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { FixIntermissionClient(it); if(it.winning) bprint(playername(it, false), " ^7wins.\n"); - )); + }); target_music_kill(); @@ -1660,22 +1660,22 @@ float GetWinningCode(float fraglimitreached, float equality) // set the .winning flag for exactly those players with a given field value void SetWinners(.float field, float value) { - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = (it.(field) == value))); + FOREACH_CLIENT(IS_PLAYER(it), { it.winning = (it.(field) == value); }); } // set the .winning flag for those players with a given field value void AddWinners(.float field, float value) { - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(it.(field) == value) it.winning = 1; - )); + }); } // clear the .winning flags void ClearWinners() { - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = 0)); + FOREACH_CLIENT(IS_PLAYER(it), { it.winning = 0; }); } void ShuffleMaplist() @@ -1768,7 +1768,7 @@ float WinningCondition_RanOutOfSpawns() team1_score = team2_score = team3_score = team4_score = 0; - FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), { switch(it.team) { case NUM_TEAM_1: team1_score = 1; break; @@ -1776,7 +1776,7 @@ float WinningCondition_RanOutOfSpawns() case NUM_TEAM_3: team3_score = 1; break; case NUM_TEAM_4: team4_score = 1; break; } - )); + }); IL_EACH(g_spawnpoints, true, { @@ -1902,13 +1902,13 @@ void CheckRules_World() float playerswithlaps; float readyplayers; totalplayers = playerswithlaps = readyplayers = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { ++totalplayers; if(PlayerScore_Add(it, SP_RACE_FASTEST, 0)) ++playerswithlaps; if(it.ready) ++readyplayers; - )); + }); // at least 2 of the players have completed a lap: start the RACE // otherwise, the players should end the qualifying on their own @@ -2128,7 +2128,7 @@ float RedirectionThink() redirection_nextthink = time + 1; clients_found = 0; - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it), { // TODO add timer LOG_INFO("Redirecting: sending connect command to ", it.netname, "\n"); if(redirection_target == "self") @@ -2136,7 +2136,7 @@ float RedirectionThink() else stuffcmd(it, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n")); ++clients_found; - )); + }); LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.\n"); diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index d22073ef6..53cf1cdba 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -100,7 +100,7 @@ string GameTypeVote_MapInfo_FixName(string m) void MapVote_ClearAllVotes() { - FOREACH_CLIENT(true, LAMBDA(it.mapvote = 0)); + FOREACH_CLIENT(true, { it.mapvote = 0; }); } void MapVote_UnzoneStrings() @@ -454,7 +454,7 @@ bool MapVote_Finished(int mappos) GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos])); } - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(FixClientCvars(it))); + FOREACH_CLIENT(IS_REAL_CLIENT(it), { FixClientCvars(it); }); if(gametypevote) { @@ -595,7 +595,7 @@ void MapVote_Tick() return; int totalvotes = 0; - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it), { // hide scoreboard again if(it.health != 2342) { @@ -621,7 +621,7 @@ void MapVote_Tick() if(it.mapvote) ++totalvotes; - )); + }); MapVote_CheckRules_1(); // just count } diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 3a5eb76f6..652ef656b 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -547,10 +547,10 @@ void readplayerstartcvars() { g_weaponarena = 1; g_weaponarena_list = "All Weapons"; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) g_weaponarena_weapons |= (it.m_wepset); - )); + }); } else if (s == "devall") { @@ -565,11 +565,11 @@ void readplayerstartcvars() { g_weaponarena = 1; g_weaponarena_list = "Most Weapons"; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) if(it.spawnflags & WEP_FLAG_NORMAL) g_weaponarena_weapons |= (it.m_wepset); - )); + }); } else if (s == "none") { @@ -584,14 +584,14 @@ void readplayerstartcvars() for (i = 0; i < t; ++i) { s = argv(i); - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(it.netname == s) { g_weaponarena_weapons |= (it.m_wepset); g_weaponarena_list = strcat(g_weaponarena_list, it.m_name, " & "); break; } - )); + }); } g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3)); } @@ -610,7 +610,7 @@ void readplayerstartcvars() } else { - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { int w = want_weapon(it, false); WepSet s = it.m_wepset; if(w & 1) @@ -619,7 +619,7 @@ void readplayerstartcvars() start_weapons_default |= s; if(w & 4) start_weapons_defaultmask |= s; - )); + }); } if(!cvar("g_use_ammunition")) @@ -671,7 +671,7 @@ void readplayerstartcvars() warmup_start_weapons = '0 0 0'; warmup_start_weapons_default = '0 0 0'; warmup_start_weapons_defaultmask = '0 0 0'; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { int w = want_weapon(it, g_warmup_allguns); WepSet s = (it.m_wepset); if(w & 1) @@ -680,7 +680,7 @@ void readplayerstartcvars() warmup_start_weapons_default |= s; if(w & 4) warmup_start_weapons_defaultmask |= s; - )); + }); } } @@ -699,10 +699,10 @@ void readplayerstartcvars() WepSet precache_weapons = start_weapons; if (g_warmup_allguns != 1) precache_weapons |= warmup_start_weapons; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(precache_weapons & (it.m_wepset)) it.wr_init(it); - )); + }); start_ammo_shells = max(0, start_ammo_shells); start_ammo_nails = max(0, start_ammo_nails); @@ -763,7 +763,7 @@ void precache_all_playermodels(string pattern) void precache_playermodels(string s) { - FOREACH_WORD(s, true, LAMBDA(precache_playermodel(it))); + FOREACH_WORD(s, true, { precache_playermodel(it); }); } void precache() diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index c5f846b16..789ba9381 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -306,7 +306,7 @@ void readlevelcvars() if (!warmup_stage) game_starttime = time + cvar("g_start_delay"); - FOREACH(Weapons, it != WEP_Null, LAMBDA(it.wr_init(it))); + FOREACH(Weapons, it != WEP_Null, { it.wr_init(it); }); readplayerstartcvars(); } diff --git a/qcsrc/server/mutators/loader.qc b/qcsrc/server/mutators/loader.qc index 1784e72ec..43c668edd 100644 --- a/qcsrc/server/mutators/loader.qc +++ b/qcsrc/server/mutators/loader.qc @@ -5,7 +5,7 @@ STATIC_INIT_LATE(Gametype) { if (g) { for (string _s = g.m_mutators; _s != ""; _s = cdr(_s)) { string s = car(_s); - FOREACH(Mutators, it.m_name == s, LAMBDA(Mutator_Add(it); break)); + FOREACH(Mutators, it.m_name == s, { Mutator_Add(it); break; }); } } } diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index 350dc5d68..85801af52 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -65,7 +65,7 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger) this.enemy.health = -1; if(this.enemy.message) - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(centerprint(it, this.enemy.message))); + FOREACH_CLIENT(IS_PLAYER(it), { centerprint(it, this.enemy.message); }); SUB_UseTargets(this.enemy, this, trigger); } diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index e46b22de2..ca402f7f1 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -6,7 +6,7 @@ bool autocvar_g_ca_spectate_enemies; void CA_count_alive_players() { total_players = redalive = bluealive = yellowalive = pinkalive = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { switch(it.team) { case NUM_TEAM_1: ++total_players; if(!IS_DEAD(it)) ++redalive; break; @@ -14,13 +14,13 @@ void CA_count_alive_players() case NUM_TEAM_3: ++total_players; if(!IS_DEAD(it)) ++yellowalive; break; case NUM_TEAM_4: ++total_players; if(!IS_DEAD(it)) ++pinkalive; break; } - )); - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + }); + FOREACH_CLIENT(IS_REAL_CLIENT(it), { it.redalive_stat = redalive; it.bluealive_stat = bluealive; it.yellowalive_stat = yellowalive; it.pinkalive_stat = pinkalive; - )); + }); } float CA_GetWinnerTeam() @@ -58,7 +58,7 @@ float CA_CheckWinner() { Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER); Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER); - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it))); + FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); }); allowed_to_spawn = false; game_stopped = true; @@ -87,7 +87,7 @@ float CA_CheckWinner() game_stopped = true; round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit); - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it))); + FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); }); return 1; } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 35689d4b6..23bbeaae2 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -288,7 +288,7 @@ bool ctf_CaptureShield_CheckStatus(entity p) return false; players_total = players_worseeq = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(DIFF_TEAM(it, p)) continue; se = PlayerScore_Add(it, SP_CTF_CAPS, 0); @@ -301,7 +301,7 @@ bool ctf_CaptureShield_CheckStatus(entity p) if(ser <= sr) ++players_worseeq; ++players_total; - )); + }); // player is in the worse half, if >= half the players are better than him, or consequently, if < half of the players are worse // use this rule here @@ -441,14 +441,14 @@ void ctf_Handle_Retrieve(entity flag, entity player) _sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM); ctf_EventLog("receive", flag.team, player); - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { if(it == sender) Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_SENT), player.netname); else if(it == player) Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_RECEIVED), sender.netname); else if(SAME_TEAM(it, sender)) Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_OTHER), sender.netname, player.netname); - )); + }); // create new waypoint ctf_FlagcarrierWaypoints(player); @@ -720,16 +720,16 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, APP_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname); if(!flag.team) - FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname))); + FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), { Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname); }); if(flag.team) - FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != player, { if(CTF_SAMETEAM(flag, it)) if(SAME_TEAM(player, it)) Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname); else Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname); - )); + }); _sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE); @@ -881,7 +881,7 @@ void ctf_CheckStalemate() if (!wpforenemy_announced) { - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((it.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER)))); + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((it.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER)); }); wpforenemy_announced = true; } @@ -919,7 +919,7 @@ void ctf_FlagThink(entity this) // captureshield if(this == ctf_worldflaglist) // only for the first flag - FOREACH_CLIENT(true, LAMBDA(ctf_CaptureShield_Update(it, 1))); // release shield only + FOREACH_CLIENT(true, { ctf_CaptureShield_Update(it, 1); }); // release shield only // sanity checks if(this.mins != this.m_mins || this.maxs != this.m_maxs) { // reset the flag boundaries in case it got squished @@ -1458,13 +1458,13 @@ int havocbot_ctf_teamcount(entity bot, vector org, float tc_radius) int c = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(DIFF_TEAM(it, bot) || IS_DEAD(it) || it == bot) continue; if(vdist(it.origin - org, <, tc_radius)) ++c; - )); + }); return c; } @@ -1643,7 +1643,7 @@ void havocbot_ctf_reset_role(entity this) // if there is only me on the team switch to offense c = 0; - FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), LAMBDA(++c)); + FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), { ++c; }); if(c==1) { @@ -1998,14 +1998,14 @@ void havocbot_role_ctf_defense(entity this) // if enemies are closer to our base, go there entity closestplayer = NULL; float distance, bestdistance = 10000; - FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), { distance = vlen(org - it.origin); if(distance= 1 && STAT(FROZEN, it) != 1) ++redalive; break; @@ -25,13 +25,13 @@ void freezetag_count_alive_players() case NUM_TEAM_3: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++yellowalive; break; case NUM_TEAM_4: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++pinkalive; break; } - )); - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + }); + FOREACH_CLIENT(IS_REAL_CLIENT(it), { it.redalive_stat = redalive; it.bluealive_stat = bluealive; it.yellowalive_stat = yellowalive; it.pinkalive_stat = pinkalive; - )); + }); eliminatedPlayers.SendFlags |= 1; } @@ -106,10 +106,10 @@ float freezetag_CheckWinner() { Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER); Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER); - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { it.freezetag_frozen_timeout = 0; nades_Clear(it); - )); + }); game_stopped = true; round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit); return 1; @@ -131,10 +131,10 @@ float freezetag_CheckWinner() Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED); } - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { it.freezetag_frozen_timeout = 0; nades_Clear(it); - )); + }); game_stopped = true; round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit); @@ -144,7 +144,7 @@ float freezetag_CheckWinner() entity freezetag_LastPlayerForTeam(entity this) { entity last_pl = NULL; - FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != this, { if(it.health >= 1) if(!STAT(FROZEN, it)) if(SAME_TEAM(it, this)) @@ -152,7 +152,7 @@ entity freezetag_LastPlayerForTeam(entity this) last_pl = it; else return NULL; - )); + }); return last_pl; } @@ -226,7 +226,7 @@ void(entity this) havocbot_role_ft_offense; void havocbot_goalrating_freeplayers(entity this, float ratingscale, vector org, float sradius) { float t; - FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), { if (STAT(FROZEN, it) == 1) { if(vdist(it.origin - org, >, sradius)) @@ -240,7 +240,7 @@ void havocbot_goalrating_freeplayers(entity this, float ratingscale, vector org, t = 0.2 * 150 / (this.health + this.armorvalue); navigation_routerating(this, it, t * ratingscale, 2000); } - )); + }); } void havocbot_role_ft_offense(entity this) @@ -253,7 +253,7 @@ void havocbot_role_ft_offense(entity this) // Count how many players on team are unfrozen. int unfrozen = 0; - FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), LAMBDA(unfrozen++)); + FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), { unfrozen++; }); // If only one left on team or if role has timed out then start trying to free players. if (((unfrozen == 0) && (!STAT(FROZEN, this))) || (time > this.havocbot_role_timeout)) @@ -416,12 +416,12 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn) MUTATOR_HOOKFUNCTION(ft, reset_map_players) { - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { CS(it).killcount = 0; it.freezetag_frozen_timeout = -1; PutClientInServer(it); it.freezetag_frozen_timeout = 0; - )); + }); freezetag_count_alive_players(); return true; } @@ -454,7 +454,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) { vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != player, { if(STAT(FROZEN, it) == 0) if(!IS_DEAD(it)) if(SAME_TEAM(it, player)) @@ -466,7 +466,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) it.reviving = true; ++n; } - )); + }); } @@ -488,21 +488,21 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) } // EVERY team mate nearby gets a point (even if multiple!) - FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, { PlayerScore_Add(it, SP_FREEZETAG_REVIVALS, +1); PlayerScore_Add(it, SP_SCORE, +1); nades_GiveBonus(it,autocvar_g_nades_bonus_score_low); - )); + }); Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname); Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname); Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED, player.netname, o.netname); } - FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, { it.revive_progress = player.revive_progress; it.reviving = false; - )); + }); } else if(!n && STAT(FROZEN, player) == 1) // only if no teammate is nearby will we reset { diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 05a89c75d..fabcc26f6 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -252,14 +252,14 @@ bool Invasion_CheckWinner() } else { - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { float cs = PlayerScore_Add(it, SP_KILLS, 0); if(cs > winning_score) { winning_score = cs; winner = it; } - )); + }); } IL_EACH(g_monsters, true, @@ -295,10 +295,10 @@ bool Invasion_CheckPlayers() void Invasion_RoundStart() { int numplayers = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { it.player_blocked = false; ++numplayers; - )); + }); if(inv_roundcnt < inv_maxrounds) inv_roundcnt += 1; // a limiter to stop crazy counts diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 52daeb796..d32df0f59 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -133,7 +133,7 @@ void kh_update_state() s |= (32 ** key.count) * f; } - FOREACH_CLIENT(true, LAMBDA(it.kh_state = s)); + FOREACH_CLIENT(true, { it.kh_state = s; }); FOR_EACH_KH_KEY(key) { @@ -394,9 +394,9 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic { if (!k.owner) continue; entity first = WP_Null; - FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break)); + FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; }); entity third = WP_Null; - FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break)); + FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; }); WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFinish, third); } } @@ -409,9 +409,9 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic { if (!k.owner) continue; entity first = WP_Null; - FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break)); + FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; }); entity third = WP_Null; - FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break)); + FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; }); WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFriend, third); } } @@ -601,7 +601,7 @@ void kh_LoserTeam(int loser_team, entity lostkey) // runs when a player pushes int players = 0; float of = autocvar_g_balance_keyhunt_score_destroyed_ownfactor; - FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, LAMBDA(++players)); + FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, { ++players; }); entity key; int keys = 0; @@ -636,16 +636,16 @@ void kh_LoserTeam(int loser_team, entity lostkey) // runs when a player pushes continue; players = 0; - FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA(++players)); + FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, { ++players; }); DistributeEvenly_Init(fragsleft, j); fragsleft = DistributeEvenly_Get(j - 1); DistributeEvenly_Init(DistributeEvenly_Get(1), players); - FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, { f = DistributeEvenly_Get(1); kh_Scores_Event(it, NULL, "destroyed", f, 0); - )); + }); --j; } @@ -703,7 +703,7 @@ LABEL(not_winning) if(kh_interferemsg_time && time > kh_interferemsg_time) { kh_interferemsg_time = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(it.team == kh_interferemsg_team) if(it.kh_next) Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET); @@ -711,7 +711,7 @@ LABEL(not_winning) Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP); else Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE)); - )); + }); } this.nextthink = time + 0.05; @@ -858,10 +858,10 @@ int kh_GetMissingTeams() { int teem = kh_Team_ByID(i); int players = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem) ++players; - )); + }); if (!players) missing_teams |= (2 ** i); } @@ -939,14 +939,14 @@ void kh_StartRound() // runs at the start of each round int teem = kh_Team_ByID(i); int players = 0; entity my_player = NULL; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem) { ++players; if(random() * players <= 1) my_player = it; } - )); + }); kh_Key_Spawn(my_player, 360 * i / NumTeams(kh_teams), i); } diff --git a/qcsrc/server/mutators/mutator/gamemode_lms.qc b/qcsrc/server/mutators/mutator/gamemode_lms.qc index fbe6b0c1d..158492cd3 100644 --- a/qcsrc/server/mutators/mutator/gamemode_lms.qc +++ b/qcsrc/server/mutators/mutator/gamemode_lms.qc @@ -367,10 +367,10 @@ MUTATOR_HOOKFUNCTION(lms, ItemTouch) MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE) { - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it), { ++M_ARGV(0, int); // activerealplayers ++M_ARGV(1, int); // realplayers - )); + }); return true; } diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qc b/qcsrc/server/mutators/mutator/gamemode_race.qc index b1759fb6a..c51afbf16 100644 --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@ -71,11 +71,11 @@ float WinningCondition_Race(float fraglimit) n = 0; c = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { ++n; if(CS(it).race_completed) ++c; - )); + }); if(n && (n == c)) return WINNING_YES; wc = WinningCondition_Scores(fraglimit, 0); @@ -198,7 +198,7 @@ MUTATOR_HOOKFUNCTION(rc, reset_map_global) race_ClearRecords(); PlayerScore_Sort(race_place, 0, 1, 0); - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { if(it.race_place) { s = PlayerScore_Add(it, SP_RACE_FASTEST, 0); @@ -206,7 +206,7 @@ MUTATOR_HOOKFUNCTION(rc, reset_map_global) it.race_place = 0; } race_EventLog(ftos(it.race_place), it); - )); + }); if(g_race_qualifying == 2) { diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 4e8663d24..d70210fea 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -235,10 +235,10 @@ void calculate_player_respawn_time(entity this) float pcount = 1; // Include myself whether or not team is already set right and I'm a "player". if (teamplay) { - FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != this, { if(it.team == this.team) ++pcount; - )); + }); if (sdelay_small_count == 0) sdelay_small_count = 1; if (sdelay_large_count == 0) @@ -246,9 +246,9 @@ void calculate_player_respawn_time(entity this) } else { - FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != this, { ++pcount; - )); + }); if (sdelay_small_count == 0) { if (IS_INDEPENDENT_PLAYER(this)) diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 99125a1a3..260e035b5 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -473,7 +473,7 @@ void Portal_Think(entity this) fixedmakevectors(this.mangle); - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(it != o) if(IS_INDEPENDENT_PLAYER(it) || IS_INDEPENDENT_PLAYER(o)) continue; // cannot go through someone else's portal @@ -487,7 +487,7 @@ void Portal_Think(entity this) if(it.(weaponentity).hook) Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g); } - )); + }); this.solid = SOLID_TRIGGER; this.aiment = o; #endif diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index a96253297..0a3e2e8fa 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -443,7 +443,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) strunzone(race_checkpoint_recordholders[cp]); race_checkpoint_recordholders[cp] = strzone(e.netname); if(g_race_qualifying) - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, LAMBDA(race_SendNextCheckpoint(it, 0))); + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, { race_SendNextCheckpoint(it, 0); }); } } @@ -1048,7 +1048,7 @@ void race_AbandonRaceCheck(entity p) void race_StartCompleting() { race_completing = 1; - FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), LAMBDA(race_AbandonRaceCheck(it))); + FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), { race_AbandonRaceCheck(it); }); } void race_PreparePlayer(entity this) @@ -1091,11 +1091,11 @@ void race_ClearRecords() race_checkpoint_recordholders[j] = string_null; } - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { float p = it.race_place; race_PreparePlayer(it); it.race_place = p; - )); + }); } void race_ImposePenaltyTime(entity pl, float penalty, string reason) diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 042d450ec..266f7734b 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -454,7 +454,7 @@ void WinningConditionHelper(entity this) WinningConditionHelper_second = NULL; winnerscorekeeper = NULL; secondscorekeeper = NULL; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { sk = CS(it).scorekeeper; c = PlayerScore_Compare(winnerscorekeeper, sk, 1); if(c < 0) @@ -473,7 +473,7 @@ void WinningConditionHelper(entity this) secondscorekeeper = sk; } } - )); + }); WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0); if(WinningConditionHelper_equality) @@ -515,7 +515,7 @@ void WinningConditionHelper(entity this) strunzone(worldstatus); worldstatus = strzone(s); - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { string s = ""; if(fullstatus) { @@ -535,7 +535,7 @@ void WinningConditionHelper(entity this) if(it.clientstatus) strunzone(it.clientstatus); it.clientstatus = strzone(s); - )); + }); } string GetScoreLogLabel(string label, float fl) @@ -694,7 +694,7 @@ entity PlayerScore_Sort(.float field, float teams, float strict, float nospectat plist = NULL; - FOREACH_CLIENT(true, LAMBDA(it.(field) = 0)); + FOREACH_CLIENT(true, { it.(field) = 0; }); FOREACH_CLIENT(CS(it).scorekeeper, { @@ -894,12 +894,12 @@ void Score_NicePrint(entity to) } t = 0; - FOREACH_CLIENT(!IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(!IS_PLAYER(it), { if (!t) Score_NicePrint_Spectators(to); Score_NicePrint_Spectator(to, it); t = 1; - )); + }); } void PlayerScore_PlayerStats(entity p) diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index bdb9cdab7..254e799ee 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -241,11 +241,11 @@ vector Spawn_Score(entity this, entity spot, float mindist, float teamcheck) } shortest = vlen(world.maxs - world.mins); - FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != this, { thisdist = vlen(it.origin - spot.origin); if (thisdist < shortest) shortest = thisdist; - )); + }); if(shortest > mindist) prio += SPAWN_PRIO_GOOD_DISTANCE; diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 0ae9b356c..74dce96a2 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -139,10 +139,10 @@ void CreatureFrame_All() void Pause_TryPause(bool ispaused) { int n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { if (PHYS_INPUT_BUTTON_CHAT(it) != ispaused) return; ++n; - )); + }); if (!n) return; setpause(ispaused); } @@ -187,12 +187,12 @@ void StartFrame() LOG_INFO("CEFC time: ", ftos(t * 1000), "ms; "); int c_seeing = 0; int c_seen = 0; - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { if(IS_REAL_CLIENT(it)) ++c_seeing; if(IS_PLAYER(it)) ++c_seen; - )); + }); LOG_INFO("CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; "); LOG_INFO("CEFC 100% load at: ", ftos(solve_quadratic(t, -t, -1) * '0 1 0'), "\n"); diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 2d6ceb8e0..793a227b8 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -328,7 +328,7 @@ void GetTeamCounts(entity ignore) // FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around) // also remember the lowest-scoring player - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { float t; if(IS_PLAYER(it) || it.caplayer) t = it.team; @@ -376,7 +376,7 @@ void GetTeamCounts(entity ignore) } } } - )); + }); // if the player who has a forced team has not joined yet, reserve the spot if(autocvar_g_campaign) @@ -737,7 +737,7 @@ void ShufflePlayerOutOfTeam (float source_team) lowest_player_score = 999999999; // find the lowest-scoring player & bot of that team - FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, { if(it.isbot) { if(it.totalfrags < lowest_bot_score) @@ -754,7 +754,7 @@ void ShufflePlayerOutOfTeam (float source_team) lowest_player_score = it.totalfrags; } } - )); + }); // prefers to move a bot... if(lowest_bot != NULL) diff --git a/qcsrc/server/weapons/accuracy.qc b/qcsrc/server/weapons/accuracy.qc index bee961bc0..4b01a3138 100644 --- a/qcsrc/server/weapons/accuracy.qc +++ b/qcsrc/server/weapons/accuracy.qc @@ -85,7 +85,7 @@ void accuracy_add(entity this, int w, int fired, int hit) if (b == accuracy_byte(a.accuracy_hit[w], a.accuracy_fired[w])) return; // no change int sf = 1 << (w % 24); a.SendFlags |= sf; - FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, LAMBDA(CS(it).accuracy.SendFlags |= sf)); + FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, { CS(it).accuracy.SendFlags |= sf; }); } bool accuracy_isgooddamage(entity attacker, entity targ) diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index b493409b0..62b11ea45 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -50,7 +50,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e) for (int i = 1; i < t; ++i) { s = argv(i); - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(it.netname == s) { entity replacement = spawn(); @@ -59,20 +59,20 @@ void weapon_defaultspawnfunc(entity this, Weapon e) weapon_defaultspawnfunc(replacement, it); break; } - )); + }); } } if (t >= 1) // always the case! { s = argv(0); wpn = WEP_Null; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { if(it.netname == s) { wpn = it; break; } - )); + }); } if (wpn == WEP_Null) { diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index dd0f3a6c0..4b7d45b96 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -60,10 +60,10 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto else { int superweapons = 1; - FOREACH(Weapons, it != WEP_Null, LAMBDA( + FOREACH(Weapons, it != WEP_Null, { WepSet set = it.m_wepset; if((set & WEPSET_SUPERWEAPONS) && (own.weapons & set)) ++superweapons; - )); + }); if(superweapons <= 1) { wep.superweapons_finished = own.superweapons_finished; diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 475eb3d26..d6c9fdfff 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -262,7 +262,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector // Find all non-hit players the beam passed close by if(deathtype == WEP_VAPORIZER.m_id || deathtype == WEP_VORTEX.m_id) { - FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, { if(!it.railgunhit) if(!(IS_SPEC(it) && it.enemy == this)) { @@ -278,7 +278,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASE * f, ATTEN_NONE); } - )); + }); if(pseudoprojectile) delete(pseudoprojectile); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index cbde7d360..f8949b156 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -393,10 +393,10 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void( if (this) { - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { if(it == actor || (IS_SPEC(it) && it.enemy == actor)) wframe_send(it, this, a, restartanim); - )); + }); } if ((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t) -- 2.39.2