file = fopen(autocvar_bot_config_file, FILE_READ);
if(file < 0)
+ {
print(strcat("Error: Can not open the bot configuration file '",autocvar_bot_config_file,"'\n"));
+ readfile = "";
+ }
else
{
RandomSelection_Init();
{
if(fabs(self.velocity_z)<50)
{
- entity head, newgoal;
- float distance, bestdistance;
+ entity head, newgoal = world;
+ float distance, bestdistance = 0;
for (head = findchain(classname, "waypoint"); head; head = head.chain)
{
self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- for(;;)
+ for(i = 0; ; ++i)
{
while (head)
{
self.dphitcontentsmask |= DPCONTENTS_OPAQUE;
head = head2;
- ++i;
}
// Restore hit flags
// if this weapon is scheduled for reloading, don't switch to it during combat
if (self.weapon_load[new_weapon] < 0)
{
- float i, other_weapon_available;
+ float i, other_weapon_available = FALSE;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
// if we are out of ammo for all other weapons, it's an emergency to switch to anything else
if not(teamplay)
return 0;
- float c;
+ float c = 0;
entity head;
FOR_EACH_PLAYER(head)
navigation_goalrating_start();
// if enemies are closer to our base, go there
- entity head, closestplayer;
- float distance, bestdistance;
- distance = 10000;
+ entity head, closestplayer = world;
+ float distance, bestdistance = 10000;
FOR_EACH_PLAYER(head)
{
if(head.deadflag!=DEAD_NO)
void havocbot_calculate_middlepoint()
{
entity f;
- vector p1, p2;
+ vector s = '0 0 0';
+ vector fo = '0 0 0';
+ float n = 0;
f = ctf_worldflaglist;
while (f)
{
- if(p1)
- p2 = f.origin;
- else
- p1 = f.origin;
-
+ fo = f.origin;
+ s = s + fo;
f = f.ctf_worldflagnext;
}
- havocbot_ctf_middlepoint = p1 + ((p2-p1) * 0.5);
- havocbot_ctf_middlepoint_radius = vlen(p2-p1) * 0.5;
+ if(!n)
+ return;
+ havocbot_ctf_middlepoint = s * (1.0 / n);
+ havocbot_ctf_middlepoint_radius = vlen(fo - havocbot_ctf_middlepoint);
}
void havocbot_ctf_reset_role(entity bot)
void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius)
{
entity head;
- float t, i, c, needarmor, needweapons;
+ float t, i, c, needarmor = FALSE, needweapons = FALSE;
// Needs armor/health?
if(self.health<100)
needarmor = TRUE;
// Needs weapons?
+ c = 0;
for(i = WEP_FIRST; i <= WEP_LAST ; ++i)
{
// Find weapon
float havocbot_ons_teamcount(entity bot, float role)
{
- float c;
+ float c = 0;
entity head;
FOR_EACH_PLAYER(head)
// We'll consider only the best case
bestvalue = 99999999999;
+ cp = world;
for (; cp1; cp1 = cp1.chain)
{
if not(cp1.wpconsidered)
dir = normalize(move);
stepdist = 32;
ignorehazards = FALSE;
+ swimming = FALSE;
// Analyze starting point
traceline(start, start, MOVE_NORMAL, e);
else if(self.goalcounter==29)goal=self.goalstack29;
else if(self.goalcounter==30)goal=self.goalstack30;
else if(self.goalcounter==31)goal=self.goalstack31;
+ else goal=world;
if(goal==world)
{
{
parm = substring(cmdstr, sp + 1, -1);
cmdstr = substring(cmdstr, 0, sp);
+ if(cmdstr == "sound")
+ precache_sound(cmdstr);
}
- if(cmdstr == "sound")
- precache_sound(cmdstr);
}
bot.bot_cmdqueuebuf_end += 1;
entity find_bot_by_number(float number)
{
entity bot;
- float c;
+ float c = 0;
if(!number)
return world;
// TODO simplify this
entity e;
- float totalClients;
+ float totalClients = 0;
FOR_EACH_CLIENT(e)
if(e != ignore)
totalClients += 1;
if (!autocvar_g_maxplayers)
return maxclients - totalClients;
- float currentlyPlaying;
+ float currentlyPlaying = 0;
FOR_EACH_REALPLAYER(e)
currentlyPlaying += 1;
{
float rec = 0, r, i;
string h, s;
+
+ s = "";
if (g_ctf)
{
map = GetMapname();
+ s = "";
for (i = 1; i <= RANKINGS_CNT; ++i)
{
t = race_readTime(map, i);
string getladder()
{
- float i, j, k, uidcnt, thiscnt;
+ float i, j, k, uidcnt = 0, thiscnt;
string s, temp_s, rr, myuid, thisuid;
if(g_cts)
return "No ladder on this server!\n";
else
return strcat("Top ", ftos(LADDER_SIZE), " ladder rankings:\n", s);
-}
\ No newline at end of file
+}
lag = 0; // only antilag for clients
// change shooter to SOLID_BBOX so the shot can hit corpses
+ oldsolid = source.dphitcontentsmask;
if(source)
- {
- oldsolid = source.dphitcontentsmask;
source.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- }
if (lag)
{
return;
}
+ str = min(self.radius, vlen(self.origin - other.origin));
+
if(self.falloff == 1)
str = (str / self.radius) * self.strength;
else if(self.falloff == 2)
if ((keylist & (keylist-1)) != 0)
return strcat("the ", item_keys_names[lowestbit(keylist)]);
+ n = "";
+ base = 0;
while (keylist) {
l = lowestbit(keylist);
if (n)
break;
default:
+ _netname = "FLUFFY PINK keycard";
+ _colormod = '1 1 1';
+
if (!self.netname) {
objerror("item_key doesn't have a default name for this key and a custom one was not specified!");
remove(self);
return;
- } else if (!self.colormod) {
- _colormod = '1 1 1';
}
break;
g_weaponarena = 1;
g_weaponarena_list = "All Weapons";
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
+ {
+ e = get_weaponinfo(j);
if not(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
WEPSET_OR_AW(g_weaponarena_weapons, j);
+ }
}
else if (s == "most")
{
warmup_start_health = cvar("g_warmup_start_health");
warmup_start_armorvalue = cvar("g_warmup_start_armor");
WEPSET_CLEAR_A(warmup_start_weapons);
+ WEPSET_CLEAR_A(warmup_start_weapons_default);
+ WEPSET_CLEAR_A(warmup_start_weapons_defaultmask);
for (i = WEP_FIRST; i <= WEP_LAST; ++i)
{
e = get_weaponinfo(i);
{
if (e.initialize_entity)
{
- entity ent, prev;
+ entity ent, prev = world;
for (ent = initialize_entity_first; ent; )
{
if ((ent == e) || ((ent.classname == "initialize_entity") && (ent.enemy == e)))
float newpos;
newpos = race_readPos(map, t);
- float i, prevpos;
+ float i, prevpos = 0;
for(i = 1; i <= RANKINGS_CNT; ++i)
{
if(race_readUID(map, i) == myuid)
if (attacker.classname == "player")
{
+ nag = FALSE;
if(self.team == COLOR_TEAM1)
{
if(time - ons_notification_time_team1 > 10)
first = TRUE;
midpoint = '0 0 0';
+ firstorigin = '0 0 0';
+ lastorigin = '0 0 0';
FOR_EACH_KH_KEY(key)
{
vector thisorigin;
{
teem = kh_Team_ByID(i);
players = 0;
- entity my_player;
+ entity my_player = world;
FOR_EACH_PLAYER(player)
if(player.deadflag == DEAD_NO)
if(!player.BUTTON_CHAT)
void nb_spawnteams(void)
{
- float t_r, t_b, t_y, t_p;
+ float t_r = 0, t_b = 0, t_y = 0, t_p = 0;
entity e;
for(e = world; (e = find(e, classname, "nexball_goal"));)
{
string sandbox_ObjectPort_Save(entity e, float database)
{
// save object properties, and return them as a string
- float i;
+ float i = 0;
string s;
entity head;
}
// now apply the array to a simple string, with the ; symbol separating objects
+ s = "";
for(i = 0; i <= MAX_STORAGE_ATTACHMENTS; ++i)
{
if(port_string[i])
{
pathlib_expandnode = pathlib_expandnode_box;
pathlib_movenode = pathlib_swimnode;
+ doedge = 0;
}
else
{
{
pathlib_expandnode = pathlib_expandnode_box;
pathlib_movenode = pathlib_swimnode;
+ doedge = 0;
}
else
{
plib_points2[0] = plib_points[0];
vector bp;
bp = plib_points[0];
+ fc2 = 0;
for(i = 0; i < 8; ++i)
{
c = 0;
float tile_check_plus2(vector where)
{
vector p,f,r;
- float i,e;
+ float i = 0, e = 0;
f = PLIB_FORWARD * pathlib_gridsize;
r = PLIB_RIGHT * pathlib_gridsize;
newpos = race_readPos(map, t);
float i;
+ player_prevpos = 0;
for(i = 1; i <= RANKINGS_CNT; ++i)
{
if(race_readUID(map, i) == myuid)
self.race_checkpoint = other.race_checkpoint;
}
- float largest_cp_id;
- float cp_amount;
+ float largest_cp_id = 0;
+ float cp_amount = 0;
for(cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
cp_amount += 1;
if(cp.race_checkpoint > largest_cp_id) // update the finish id if someone hit a new checkpoint
g_race_qualifying = 1;
self.race_place = race_lowest_place_spawn;
if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE))
- error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
+ error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
}
else
{
}
if(defragcpexists != -1){
- float largest_cp_id;
+ float largest_cp_id = 0;
for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
if(cp.race_checkpoint > largest_cp_id)
largest_cp_id = cp.race_checkpoint;
vector steerlib_flock(float radius, float standoff,float separation_force,float flock_force)
{
entity flock_member;
- vector push,pull;
- float ccount;
+ vector push = '0 0 0', pull = '0 0 0';
+ float ccount = 0;
flock_member = findradius(self.origin,radius);
while(flock_member)
vector steerlib_flock2d(float radius, float standoff,float separation_force,float flock_force)
{
entity flock_member;
- vector push,pull;
- float ccount;
+ vector push = '0 0 0', pull = '0 0 0';
+ float ccount = 0;
flock_member = findradius(self.origin,radius);
while(flock_member)
vector steerlib_swarm(float radius, float standoff,float separation_force,float swarm_force)
{
entity swarm_member;
- vector force,center;
- float ccount;
+ vector force = '0 0 0', center = '0 0 0';
+ float ccount = 0;
swarm_member = findradius(self.origin,radius);
float commodity_pickupevalfunc(entity player, entity item)
{
- float c, i, need_shells, need_nails, need_rockets, need_cells, need_fuel;
+ float c, i;
+ float need_shells = FALSE, need_nails = FALSE, need_rockets = FALSE, need_cells = FALSE, need_fuel = FALSE;
entity wi;
c = 0;
else if(argv(i) == "jetpack") self.items |= IT_JETPACK;
else if(argv(i) == "fuel_regen") self.items |= IT_FUEL_REGEN;
else
- for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- e = get_weaponinfo(j);
- if(argv(i) == e.netname)
+ for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- WEPSET_OR_EW(self, j);
- if(self.spawnflags == 0 || self.spawnflags == 2)
- weapon_action(e.weapon, WR_PRECACHE);
- break;
+ e = get_weaponinfo(j);
+ if(argv(i) == e.netname)
+ {
+ WEPSET_OR_EW(self, j);
+ if(self.spawnflags == 0 || self.spawnflags == 2)
+ weapon_action(e.weapon, WR_PRECACHE);
+ break;
+ }
}
+ if(j > WEP_LAST)
+ print("target_items: invalid item ", argv(i), "\n");
}
- if(j > WEP_LAST)
- print("target_items: invalid item ", argv(i), "\n");
}
string itemprefix, valueprefix;
else if(n == 1)
{
// exactly one dest - bots love that
- self.enemy = find(e, targetname, self.target);
+ self.enemy = find(world, targetname, self.target);
}
else
{
m_score = self.turret_score_target(self,e_enemy) * self.target_select_samebias;
}
else
- self.enemy = world;
+ e_enemy = self.enemy = world;
e = findradius(self.origin, self.target_range);
vector real_origin(entity ent)
{
entity e;
- vector v;
+ vector v = ((ent.absmin + ent.absmax) * 0.5);
e = ent.tag_entity;
while(e)
v = v + ((e.absmin + e.absmax) * 0.5);
e = e.tag_entity;
}
- v = v + ((ent.absmin + ent.absmax) * 0.5);
+
return v;
}
}
else
{
+ edist = 0;
+ ve = '0 0 0';
fe = 0;
}
entity toast(entity from, float range, float damage)
{
entity e;
- entity etarget;
+ entity etarget = world;
float d,dd;
float r;
float raptor_frame()
{
entity player, raptor;
- float ftmp, ftmp2;
+ float ftmp = 0, ftmp2;
vector df;
if(intermission_running)