Commit 169b248b authored by Marius Pa's avatar Marius Pa
Browse files

kgrrulebook.cpp 'choice' variable is assigned values twice successively

Fix PVS-Studio issue "src/kgrrulebook.cpp:41: warning: V519
The 'choice' variable is assigned values twice successively.
Perhaps this is a mistake. Check lines: 40, 41.".
parent b788199b
Pipeline #211260 passed with stage
in 1 minute and 53 seconds
......@@ -27,7 +27,6 @@ KGrRuleBook::~KGrRuleBook()
void KGrRuleBook::setTiming (const int enemyCount)
{
int choice;
Timing varTiming[6] = {
{40, 58, 78, 88, 340, 23}, // No enemies.
{50, 68, 78, 88, 340, 32}, // 1 enemy.
......@@ -37,8 +36,7 @@ void KGrRuleBook::setTiming (const int enemyCount)
{70, 80, 189, 165, 920, 51} // >4 enemies.
};
if (mVariableTiming) {
choice = (enemyCount < 0) ? 0 : enemyCount;
choice = (enemyCount > 5) ? 5 : enemyCount;
int choice = std::clamp(enemyCount, 0, 5);
times = varTiming [choice];
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment