diff --git a/source/basecode.cpp b/source/basecode.cpp index eef8e8a..0c05df9 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -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"); diff --git a/source/interface.cpp b/source/interface.cpp index 6eaf7e8..cbf1b96 100644 --- a/source/interface.cpp +++ b/source/interface.cpp @@ -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 (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 (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); + } } } diff --git a/source/navigate.cpp b/source/navigate.cpp index 5bf580b..595cebb 100644 --- a/source/navigate.cpp +++ b/source/navigate.cpp @@ -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; } } diff --git a/source/waypoint.cpp b/source/waypoint.cpp index 2abe5ea..b7895db 100644 --- a/source/waypoint.cpp +++ b/source/waypoint.cpp @@ -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;