From 97cbca4fc1745460133e1bcde48bbc02f7671a53 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Fri, 7 Oct 2016 21:19:37 +0200 Subject: [PATCH] refactor RandomSelection, add a field for vector --- .../gamemodes/gamemode/onslaught/sv_onslaught.qc | 4 ++-- qcsrc/common/minigames/minigame/snake.qc | 4 ++-- qcsrc/common/minigames/minigame/ttt.qc | 2 +- qcsrc/common/monsters/sv_spawn.qc | 2 +- qcsrc/common/mutators/mutator/buffs/sv_buffs.qc | 2 +- qcsrc/common/mutators/mutator/nades/nades.qc | 2 +- qcsrc/common/mutators/mutator/nix/sv_nix.qc | 2 +- .../spawn_near_teammate/sv_spawn_near_teammate.qc | 2 +- qcsrc/common/t_items.qc | 4 ++-- qcsrc/common/triggers/teleporters.qc | 4 ++-- qcsrc/common/triggers/trigger/jumppads.qc | 4 ++-- qcsrc/common/triggers/triggers.qc | 2 +- qcsrc/common/weapons/all.qc | 2 +- qcsrc/common/weapons/weapon/fireball.qc | 2 +- qcsrc/lib/random.qc | 4 +++- qcsrc/lib/random.qh | 7 ++++++- qcsrc/server/bot/default/bot.qc | 2 +- qcsrc/server/cheats.qc | 10 +++++----- qcsrc/server/g_world.qc | 2 +- qcsrc/server/mapvoting.qc | 4 ++-- qcsrc/server/mutators/mutator/gamemode_invasion.qc | 12 ++++++------ qcsrc/server/spawnpoints.qc | 2 +- qcsrc/server/teamplay.qc | 8 ++++---- 23 files changed, 48 insertions(+), 41 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index d6606a370..a18ce34c5 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -1685,7 +1685,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn) { if(SAME_TEAM(tmp_entity, player)) if(random_target) - RandomSelection_Add(tmp_entity, 0, string_null, 1, 1); + RandomSelection_AddEnt(tmp_entity, 1, 1); else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL) closest_target = tmp_entity; } @@ -1732,7 +1732,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn) for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext) { if(random_target) - RandomSelection_Add(tmp_entity, 0, string_null, 1, 1); + RandomSelection_AddEnt(tmp_entity, 1, 1); else { if(SAME_TEAM(tmp_entity, player)) diff --git a/qcsrc/common/minigames/minigame/snake.qc b/qcsrc/common/minigames/minigame/snake.qc index c15ecd463..7f0fdb2ff 100644 --- a/qcsrc/common/minigames/minigame/snake.qc +++ b/qcsrc/common/minigames/minigame/snake.qc @@ -95,7 +95,7 @@ void snake_new_mouse(entity minigame) { string pos = minigame_tile_buildname(i, j); if(!snake_find_piece(minigame, pos)) - RandomSelection_Add(NULL, 0, pos, 1, 1); + RandomSelection_AddString(pos, 1, 1); } entity piece = msle_spawn(minigame,"minigame_board_piece"); @@ -175,7 +175,7 @@ void minigame_setup_snake(entity minigame, int pteam) { string pos = minigame_tile_buildname(i, j); if(!snake_find_piece(minigame, pos)) - RandomSelection_Add(NULL, 0, pos, 1, 1); + RandomSelection_AddString(pos, 1, 1); } entity piece = msle_spawn(minigame,"minigame_board_piece"); diff --git a/qcsrc/common/minigames/minigame/ttt.qc b/qcsrc/common/minigames/minigame/ttt.qc index e06bb4662..c5a658054 100644 --- a/qcsrc/common/minigames/minigame/ttt.qc +++ b/qcsrc/common/minigames/minigame/ttt.qc @@ -418,7 +418,7 @@ int ttt_ai_random(int piecemask) for ( int i = 0; i < 9; i++ ) { if ( piecemask & f ) - RandomSelection_Add(NULL, f, string_null, 1, 1); + RandomSelection_AddFloat(f, 1, 1); f <<= 1; } diff --git a/qcsrc/common/monsters/sv_spawn.qc b/qcsrc/common/monsters/sv_spawn.qc index da924cf96..9e87e488e 100644 --- a/qcsrc/common/monsters/sv_spawn.qc +++ b/qcsrc/common/monsters/sv_spawn.qc @@ -24,7 +24,7 @@ entity spawnmonster (string monster, int monster_id, entity spawnedby, entity ow RandomSelection_Init(); FOREACH(Monsters, it != MON_Null, { - RandomSelection_Add(it, 0, string_null, 1, 1); + RandomSelection_AddEnt(it, 1, 1); }); monster_id = RandomSelection_chosen_ent.monsterid; diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 82fa2d33c..5587da593 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -216,7 +216,7 @@ void buff_NewType(entity ent, float cb) FOREACH(Buffs, buff_Available(it), LAMBDA( it.buff_seencount += 1; // if it's already been chosen, give it a lower priority - RandomSelection_Add(NULL, it.m_itemid, string_null, 1, max(0.2, 1 / it.buff_seencount)); + RandomSelection_AddFloat(it.m_itemid, 1, max(0.2, 1 / it.buff_seencount)); )); ent.buffs = RandomSelection_chosen_float; } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 02760045c..b0c0e582a 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -211,7 +211,7 @@ void napalm_damage(entity this, float dist, float damage, float edgedamage, floa if(d < dist) { e.fireball_impactvec = p; - RandomSelection_Add(e, 0, string_null, 1 / (1 + d), !Fire_IsBurning(e)); + RandomSelection_AddEnt(e, 1 / (1 + d), !Fire_IsBurning(e)); } } if(RandomSelection_chosen_ent) diff --git a/qcsrc/common/mutators/mutator/nix/sv_nix.qc b/qcsrc/common/mutators/mutator/nix/sv_nix.qc index 97ed4361b..39072cefc 100644 --- a/qcsrc/common/mutators/mutator/nix/sv_nix.qc +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qc @@ -96,7 +96,7 @@ void NIX_ChooseNextWeapon() RandomSelection_Init(); FOREACH(Weapons, it != WEP_Null, LAMBDA( if(NIX_CanChooseWeapon(it.m_id)) - RandomSelection_Add(NULL, it.m_id, string_null, 1, (it.m_id != nix_weapon)); + RandomSelection_AddFloat(it.m_id, 1, (it.m_id != nix_weapon)); )); nix_nextweapon = RandomSelection_chosen_float; } 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 fb14f27db..123b8caa0 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 @@ -38,7 +38,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score) continue; if(!checkpvs(spawn_spot.origin, it)) continue; - RandomSelection_Add(it, 0, string_null, 1, 1); + RandomSelection_AddEnt(it, 1, 1); )); if(RandomSelection_chosen_ent) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index f9f89a73f..7424d695a 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -840,7 +840,7 @@ LABEL(pickup) if(it.classname != "item_flag_team" && it.classname != "item_kh_key") { Item_Show(it, -1); - RandomSelection_Add(it, 0, string_null, it.cnt, 0); + RandomSelection_AddEnt(it, it.cnt, 0); } }); e = RandomSelection_chosen_ent; @@ -882,7 +882,7 @@ void Item_FindTeam(entity this) IL_EACH(g_items, it.team == this.team, { if(it.classname != "item_flag_team" && it.classname != "item_kh_key") - RandomSelection_Add(it, 0, string_null, it.cnt, 0); + RandomSelection_AddEnt(it, it.cnt, 0); }); e = RandomSelection_chosen_ent; diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index b5e97b1fc..949f478fd 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -92,7 +92,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle RandomSelection_Init(); FOREACH_WORD(teleporter.noise, true, { - RandomSelection_Add(NULL, 0, it, 1, 1); + RandomSelection_AddString(it, 1, 1); }); thesound = RandomSelection_chosen_string; } @@ -198,7 +198,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player) if(check_tdeath(player, locout, '0 0 0', '0 0 0')) p = 0; } - RandomSelection_Add(it, 0, string_null, (it.cnt ? it.cnt : 1), p); + RandomSelection_AddEnt(it, (it.cnt ? it.cnt : 1), p); }); e = RandomSelection_chosen_ent; } diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index ef13dd5be..498f0ff2d 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -155,9 +155,9 @@ void trigger_push_touch(entity this, entity toucher) for(e = NULL; (e = find(e, targetname, this.target)); ) { if(e.cnt) - RandomSelection_Add(e, 0, string_null, e.cnt, 1); + RandomSelection_AddEnt(e, e.cnt, 1); else - RandomSelection_Add(e, 0, string_null, 1, 1); + RandomSelection_AddEnt(e, 1, 1); } toucher.velocity = trigger_push_calculatevelocity(toucher.origin, RandomSelection_chosen_ent, this.height); } diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index 54e1e0991..8a63e3b68 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -260,7 +260,7 @@ void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventRe { if(this.target_random) { - RandomSelection_Add(t, 0, string_null, 1, 0); + RandomSelection_AddEnt(t, 1, 0); } else { diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index cf55aa652..763dd6e8d 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -204,7 +204,7 @@ void W_RandomWeapons(entity e, float n) RandomSelection_Init(); FOREACH(Weapons, it != WEP_Null, { if (remaining & (it.m_wepset)) - RandomSelection_Add(it, 0, string_null, 1, 1); + RandomSelection_AddEnt(it, 1, 1); }); Weapon w = RandomSelection_chosen_ent; result |= WepSet_FromWeapon(w); diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index c2b93747c..ae1e48bb2 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -150,7 +150,7 @@ void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float if(d < dist) { e.fireball_impactvec = p; - RandomSelection_Add(e, 0, string_null, 1 / (1 + d), !Fire_IsBurning(e)); + RandomSelection_AddEnt(e, 1 / (1 + d), !Fire_IsBurning(e)); } } if(RandomSelection_chosen_ent) diff --git a/qcsrc/lib/random.qc b/qcsrc/lib/random.qc index 2287d869d..627fec11a 100644 --- a/qcsrc/lib/random.qc +++ b/qcsrc/lib/random.qc @@ -9,7 +9,7 @@ void RandomSelection_Init() RandomSelection_best_priority = -1; } -void RandomSelection_Add(entity e, float f, string s, float weight, float priority) +void RandomSelection_Add(entity e, float f, string s, vector v, float weight, float priority) { if (priority > RandomSelection_best_priority) { @@ -17,6 +17,7 @@ void RandomSelection_Add(entity e, float f, string s, float weight, float priori RandomSelection_chosen_ent = e; RandomSelection_chosen_float = f; RandomSelection_chosen_string = s; + RandomSelection_chosen_vec = v; RandomSelection_totalweight = weight; } else if (priority == RandomSelection_best_priority) @@ -27,6 +28,7 @@ void RandomSelection_Add(entity e, float f, string s, float weight, float priori RandomSelection_chosen_ent = e; RandomSelection_chosen_float = f; RandomSelection_chosen_string = s; + RandomSelection_chosen_vec = v; } } } diff --git a/qcsrc/lib/random.qh b/qcsrc/lib/random.qh index 1834a97a3..b2fc53f0c 100644 --- a/qcsrc/lib/random.qh +++ b/qcsrc/lib/random.qh @@ -5,9 +5,14 @@ float RandomSelection_best_priority; entity RandomSelection_chosen_ent; float RandomSelection_chosen_float; string RandomSelection_chosen_string; +vector RandomSelection_chosen_vec; void RandomSelection_Init(); -void RandomSelection_Add(entity e, float f, string s, float weight, float priority); +void RandomSelection_Add(entity e, float f, string s, vector v, float weight, float priority); +#define RandomSelection_AddEnt(e, weight, priority) RandomSelection_Add(e, 0, string_null, '0 0 0', weight, priority) +#define RandomSelection_AddFloat(f, weight, priority) RandomSelection_Add(NULL, f, string_null, '0 0 0', weight, priority) +#define RandomSelection_AddString(s, weight, priority) RandomSelection_Add(NULL, 0, s, '0 0 0', weight, priority) +#define RandomSelection_AddVec(v, weight, priority) RandomSelection_Add(NULL, 0, string_null, v, weight, priority) // prandom - PREDICTABLE random number generator diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index ca12d0d65..bdde55b9a 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -177,7 +177,7 @@ void bot_setnameandstuff(entity this) break; } )); - RandomSelection_Add(NULL, 0, readfile, 1, prio); + RandomSelection_AddString(readfile, 1, prio); } readfile = RandomSelection_chosen_string; fclose(file); diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 9f763a886..543a3f98d 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -262,7 +262,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_Add(it, 0, string_null, 1, 1))); + FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), LAMBDA(RandomSelection_AddEnt(it, 1, 1))); if(RandomSelection_chosen_ent) e = RandomSelection_chosen_ent; else @@ -475,9 +475,9 @@ float CheatCommand(entity this, int argc) RandomSelection_Init(); crosshair_trace(this); for(entity e = NULL; (e = find(e, classname, "dragbox_box")); ) - RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); + RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); for(entity e = NULL; (e = find(e, classname, "dragpoint")); ) - RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); + RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); if(RandomSelection_chosen_ent) { delete(RandomSelection_chosen_ent.killindicator.killindicator); @@ -497,9 +497,9 @@ float CheatCommand(entity this, int argc) RandomSelection_Init(); crosshair_trace(this); for(entity e = NULL; (e = find(e, classname, "dragbox_box")); ) - RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); + RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); for(entity e = NULL; (e = find(e, classname, "dragpoint")); ) - RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); + RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); if(RandomSelection_chosen_ent) { if(substring(argv(1), 0, 1) == "*") diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index fe7822bc1..be21020d4 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1503,7 +1503,7 @@ void FixIntermissionClient(entity e) stuffcmd(e, "\nscr_printspeed 1000000\n"); RandomSelection_Init(); FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, LAMBDA( - RandomSelection_Add(NULL, 0, it, 1, 1); + RandomSelection_AddString(it, 1, 1); )); if (RandomSelection_chosen_string != "") { diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index 29768893a..7c7c02018 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -522,7 +522,7 @@ float MapVote_CheckRules_2() for(i = 0; i < mapvote_count_real; ++i) if ( mapvote_maps_flags[i] & GTV_AVAILABLE ) { - RandomSelection_Add(NULL, i, string_null, 1, mapvote_selections[i]); + RandomSelection_AddFloat(i, 1, mapvote_selections[i]); if ( gametypevote && mapvote_maps[i] == MapInfo_Type_ToString(MapInfo_CurrentGametype()) ) { currentVotes = mapvote_selections[i]; @@ -542,7 +542,7 @@ float MapVote_CheckRules_2() for(i = 0; i < mapvote_count_real; ++i) if(i != firstPlace) if ( mapvote_maps_flags[i] & GTV_AVAILABLE ) - RandomSelection_Add(NULL, i, string_null, 1, mapvote_selections[i]); + RandomSelection_AddFloat(i, 1, mapvote_selections[i]); secondPlace = RandomSelection_chosen_float; secondPlaceVotes = RandomSelection_best_priority; //dprint("Second place: ", ftos(secondPlace), "\n"); diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 61fe75ea4..a057408b9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -45,7 +45,7 @@ int invasion_PickMonster(int supermonster_count) { if((it.spawnflags & MONSTER_TYPE_FLY) || (it.spawnflags & MONSTER_TYPE_SWIM) || (it.spawnflags & MONSTER_SIZE_QUAKE) || ((it.spawnflags & MON_FLAG_SUPERMONSTER) && supermonster_count >= 1)) continue; - RandomSelection_Add(NULL, it.monsterid, string_null, 1, 1); + RandomSelection_AddFloat(it.monsterid, 1, 1); }); return RandomSelection_chosen_float; @@ -57,7 +57,7 @@ entity invasion_PickSpawn() IL_EACH(g_invasion_spawns, true, { - RandomSelection_Add(it, 0, string_null, 1, ((time >= it.spawnshieldtime) ? 0.2 : 1)); // give recently used spawnpoints a very low rating + RandomSelection_AddEnt(it, 1, ((time >= it.spawnshieldtime) ? 0.2 : 1)); // give recently used spawnpoints a very low rating it.spawnshieldtime = time + autocvar_g_invasion_spawnpoint_spawn_delay; }); @@ -96,10 +96,10 @@ void invasion_SpawnChosenMonster(int mon) else { RandomSelection_Init(); - if(inv_monsters_perteam[NUM_TEAM_1] > 0) RandomSelection_Add(NULL, NUM_TEAM_1, string_null, 1, 1); - if(inv_monsters_perteam[NUM_TEAM_2] > 0) RandomSelection_Add(NULL, NUM_TEAM_2, string_null, 1, 1); - if(invasion_teams >= 3) if(inv_monsters_perteam[NUM_TEAM_3] > 0) { RandomSelection_Add(NULL, NUM_TEAM_3, string_null, 1, 1); } - if(invasion_teams >= 4) if(inv_monsters_perteam[NUM_TEAM_4] > 0) { RandomSelection_Add(NULL, NUM_TEAM_4, string_null, 1, 1); } + if(inv_monsters_perteam[NUM_TEAM_1] > 0) RandomSelection_AddFloat(NUM_TEAM_1, 1, 1); + if(inv_monsters_perteam[NUM_TEAM_2] > 0) RandomSelection_AddFloat(NUM_TEAM_2, 1, 1); + if(invasion_teams >= 3) if(inv_monsters_perteam[NUM_TEAM_3] > 0) { RandomSelection_AddFloat(NUM_TEAM_3, 1, 1); } + if(invasion_teams >= 4) if(inv_monsters_perteam[NUM_TEAM_4] > 0) { RandomSelection_AddFloat(NUM_TEAM_4, 1, 1); } monster.team = RandomSelection_chosen_float; } diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 59cc052af..18d32c2f0 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -317,7 +317,7 @@ entity Spawn_WeightedPoint(entity firstspot, float lower, float upper, float exp RandomSelection_Init(); for(spot = firstspot; spot; spot = spot.chain) - RandomSelection_Add(spot, 0, string_null, pow(bound(lower, spot.spawnpoint_score.y, upper), exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x); + RandomSelection_AddEnt(spot, pow(bound(lower, spot.spawnpoint_score.y, upper), exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x); return RandomSelection_chosen_ent; } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 6ccb7d408..4632866b4 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -508,13 +508,13 @@ float FindSmallestTeam(entity pl, float ignore_pl) // now t is the minimum, or A minimum! if(t == 1 || TeamSmallerEqThanTeam(1, t, pl)) - RandomSelection_Add(NULL, 1, string_null, 1, 1); + RandomSelection_AddFloat(1, 1, 1); if(t == 2 || TeamSmallerEqThanTeam(2, t, pl)) - RandomSelection_Add(NULL, 2, string_null, 1, 1); + RandomSelection_AddFloat(2, 1, 1); if(t == 3 || TeamSmallerEqThanTeam(3, t, pl)) - RandomSelection_Add(NULL, 3, string_null, 1, 1); + RandomSelection_AddFloat(3, 1, 1); if(t == 4 || TeamSmallerEqThanTeam(4, t, pl)) - RandomSelection_Add(NULL, 4, string_null, 1, 1); + RandomSelection_AddFloat(4, 1, 1); return RandomSelection_chosen_float; } -- 2.39.2