fixed rare crashbug in ClientUserInfoChanged

fixed chatter ignores yb_communication_type
fixed waypoint display distance, when host entity is alive
fixed bomber choose most longest route to bombplant (in middle of round).
This commit is contained in:
jeefo 2016-01-05 20:29:34 +03:00
commit 4204f4e9f2
4 changed files with 34 additions and 31 deletions

View file

@ -1241,7 +1241,7 @@ void Bot::CheckMessageQueue (void)
}
}
if (m_radioSelect != Radio_ReportingIn || g_radioInsteadVoice || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || g_gameVersion == CSV_OLD)
if (m_radioSelect != Radio_ReportingIn && g_radioInsteadVoice || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || g_gameVersion == CSV_OLD)
{
if (m_radioSelect < Radio_GoGoGo)
FakeClientCommand (GetEntity (), "radio1");

View file

@ -1166,24 +1166,22 @@ void ClientUserInfoChanged (edict_t *ent, char *infobuffer)
// change their player model). But most commonly, this function is in charge of handling
// team changes, recounting the teams population, etc...
const char *passwordField = yb_password_key.GetString ();
const char *password = yb_password.GetString ();
if (IsNullString (passwordField) || IsNullString (password) || IsValidBot (ent))
if (IsDedicatedServer () && !IsValidBot (ent))
{
if (g_isMetamod)
RETURN_META (MRES_IGNORED);
const char *passwordField = yb_password_key.GetString ();
const char *password = yb_password.GetString ();
(*g_functionTable.pfnClientUserInfoChanged) (ent, infobuffer);
if (!IsNullString (passwordField) || !IsNullString (password))
{
int clientIndex = IndexOfEntity (ent) - 1;
if (strcmp (password, INFOKEY_VALUE (infobuffer, const_cast <char *> (passwordField))) == 0)
g_clients[clientIndex].flags |= CF_ADMIN;
else
g_clients[clientIndex].flags &= ~CF_ADMIN;
}
}
int clientIndex = IndexOfEntity (ent) - 1;
if (strcmp (password, INFOKEY_VALUE (infobuffer, const_cast <char *> (passwordField))) == 0)
g_clients[clientIndex].flags |= CF_ADMIN;
else
g_clients[clientIndex].flags &= ~CF_ADMIN;
if (g_isMetamod)
RETURN_META (MRES_IGNORED);
@ -3209,7 +3207,12 @@ void ConVarWrapper::PushRegisteredConVarsToEngine (bool gameVars)
}
}
else if (gameVars && ptr->type == VT_NOREGISTER)
{
ptr->self->m_eptr = g_engfuncs.pfnCVarGetPointer (ptr->reg.name);
// ensure game cvar exists
InternalAssert (ptr->self->m_eptr != NULL);
}
}
}

View file

@ -166,27 +166,27 @@ TacticChoosen:
else if (tactic == 3 && !waypoints.m_goalPoints.IsEmpty ()) // map goal waypoint
{
// force bomber to select closest goal, if round-start goal was reset by something
if (m_hasC4 && g_timeRoundStart + 20.0f < GetWorldTime ())
if (m_hasC4 && g_timeRoundStart + 10.0f < GetWorldTime ())
{
float minDist = 99999999.0f;
float minDist = 99999.0f;
int count = 0;
for (int i = 0; i < g_numWaypoints; i++)
FOR_EACH_AE (waypoints.m_goalPoints, i)
{
Path *path = waypoints.GetPath (i);
Path *path = waypoints.GetPath (waypoints.m_goalPoints[i]);
if (!(path->flags & FLAG_GOAL))
float distance = (path->origin - pev->origin).GetLength ();
if (distance > 1024.0f)
continue;
float distance = (path->origin - pev->origin).GetLengthSquared ();
if (distance < minDist)
{
if (count < 4)
{
goalChoices[count] = i;
count++;
}
goalChoices[count] = i;
if (++count > 3)
count = 0;
minDist = distance;
}
}

View file

@ -1557,15 +1557,15 @@ void Waypoint::Think (void)
m_facingAtIndex = GetFacingIndex ();
// reset the minimal distance changed before
nearestDistance = 99999.0f;
nearestDistance = 999999.0f;
// now iterate through all waypoints in a map, and draw required ones
for (int i = 0; i < g_numWaypoints; i++)
{
float distance = (m_paths[i]->origin - g_hostEntity->v.origin).GetLengthSquared ();
float distance = (m_paths[i]->origin - g_hostEntity->v.origin).GetLength ();
// check if waypoint is whitin a distance, and is visible
if (distance < GET_SQUARE (500.0f) && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 2500.0f))
if (distance < 1024.0f && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 512.0f))
{
// check the distance
if (distance < nearestDistance)
@ -1656,7 +1656,7 @@ void Waypoint::Think (void)
Path *path = m_paths[nearestIndex];
// draw a paths, camplines and danger directions for nearest waypoint
if (nearestDistance < 4096.0f && m_pathDisplayTime <= GetWorldTime ())
if (nearestDistance <= 56.0f && m_pathDisplayTime <= GetWorldTime ())
{
m_pathDisplayTime = GetWorldTime () + 1.0f;