another crash bug fix

some code style fixes
This commit is contained in:
jeefo 2015-08-03 12:36:57 +03:00
commit f3e583e057
3 changed files with 10 additions and 11 deletions

View file

@ -5411,13 +5411,13 @@ void Bot::CollectExperienceData (edict_t *attacker, int damage)
(g_experienceData + (victimIndex * g_numWaypoints) + victimIndex)->team1Damage = MAX_DAMAGE_VALUE; (g_experienceData + (victimIndex * g_numWaypoints) + victimIndex)->team1Damage = MAX_DAMAGE_VALUE;
} }
float fUpdate = IsValidBot (attacker) ? 10.0 : 7.0; float updateDamage = IsValidBot (attacker) ? 10.0 : 7.0;
// store away the damage done // store away the damage done
if (victimTeam == TEAM_TF) if (victimTeam == TEAM_TF)
{ {
int value = (g_experienceData + (victimIndex * g_numWaypoints) + attackerIndex)->team0Damage; int value = (g_experienceData + (victimIndex * g_numWaypoints) + attackerIndex)->team0Damage;
value += static_cast <int> (damage / fUpdate); value += static_cast <int> (damage / updateDamage);
if (value > MAX_DAMAGE_VALUE) if (value > MAX_DAMAGE_VALUE)
value = MAX_DAMAGE_VALUE; value = MAX_DAMAGE_VALUE;
@ -5430,7 +5430,7 @@ void Bot::CollectExperienceData (edict_t *attacker, int damage)
else else
{ {
int value = (g_experienceData + (victimIndex * g_numWaypoints) + attackerIndex)->team1Damage; int value = (g_experienceData + (victimIndex * g_numWaypoints) + attackerIndex)->team1Damage;
value += static_cast <int> (damage / fUpdate); value += static_cast <int> (damage / updateDamage);
if (value > MAX_DAMAGE_VALUE) if (value > MAX_DAMAGE_VALUE)
value = MAX_DAMAGE_VALUE; value = MAX_DAMAGE_VALUE;

View file

@ -1673,7 +1673,7 @@ void Bot::CheckReload (void)
break; break;
} }
if (m_ammoInClip[weaponIndex] < (maxClip * 0.8) && m_ammo[g_weaponDefs[weaponIndex].ammo1] > 0) if (m_ammoInClip[weaponIndex] < (maxClip * 0.8) && g_weaponDefs[m_currentWeapon].ammo1 != -1 && g_weaponDefs[m_currentWeapon].ammo1 < 32 && m_ammo[g_weaponDefs[weaponIndex].ammo1] > 0)
{ {
if (m_currentWeapon != weaponIndex) if (m_currentWeapon != weaponIndex)
SelectWeaponByName (g_weaponDefs[weaponIndex].className); SelectWeaponByName (g_weaponDefs[weaponIndex].className);

View file

@ -2016,11 +2016,12 @@ bool Waypoint::NodesValid (void)
if (visited[outgoingPaths[current->index][p]]) if (visited[outgoingPaths[current->index][p]])
continue; // skip this waypoint as it's already visited continue; // skip this waypoint as it's already visited
PathNode *pNewNode = new PathNode; PathNode *newNode = new PathNode;
pNewNode->next = stack; newNode->next = stack;
pNewNode->index = outgoingPaths[current->index][p]; newNode->index = outgoingPaths[current->index][p];
stack = pNewNode;
stack = newNode;
} }
delete current; delete current;
} }
@ -2566,9 +2567,7 @@ WaypointDownloadError WaypointDownloader::DoDownload (void)
timeout.tv_sec = 5; timeout.tv_sec = 5;
timeout.tv_usec = 0; timeout.tv_usec = 0;
int result = 0; int result = setsockopt (socketHandle, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof (timeout));
result = setsockopt (socketHandle, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof (timeout));
if (result < 0) if (result < 0)
{ {