fix: potential division by zero

This commit is contained in:
jeefo 2023-04-25 09:12:06 +03:00
commit bb2e93a539
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
2 changed files with 1 additions and 10 deletions

View file

@ -398,7 +398,7 @@ public:
}
int getHighestDamageForTeam (int team) const {
return m_highestDamage[team];
return cr::max (1, m_highestDamage[team]);
}
void setHighestDamageForTeam (int team, int value) {

View file

@ -30,10 +30,6 @@ void BotGraph::reset () {
m_hasChanged = false;
m_narrowChecked = false;
// reset highest recorded damage
for (int team = Team::Terrorist; team < kGameTeamNum; ++team) {
m_highestDamage[team] = 1;
}
m_graphAuthor.clear ();
m_graphModified.clear ();
}
@ -1266,11 +1262,6 @@ void BotGraph::loadPractice () {
return;
}
// reset highest recorded damage
for (int team = Team::Terrorist; team < kGameTeamNum; ++team) {
m_highestDamage[team] = 1;
}
bool dataLoaded = loadStorage <Practice> ("Practice", StorageOption::Practice, StorageVersion::Practice, m_practice, nullptr, nullptr);
int count = length ();