Skip to content

Commit

Permalink
Attempt to silence a coverity issue yet again by splitting up an expr…
Browse files Browse the repository at this point in the history
…ession
  • Loading branch information
AI0867 authored and GregoryLundberg committed Nov 30, 2017
1 parent b0a897d commit ccce411
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/dialogs/statistics_dialog.cpp
Expand Up @@ -143,9 +143,10 @@ void statistics_dialog::add_damage_row(
const long long dsa = shift * damage - expected;
const long long dst = shift * turn_damage - turn_expected;

const long long shifted = ((expected * 20) + shift) / (2 * shift);
std::ostringstream str;
str << damage << " / "
<< (((expected * 20) + shift) / (2 * shift)) * 0.1
<< static_cast<double>(shifted) * 0.1
<< " " // TODO: should probably make this two columns
<< ((dsa < 0) ^ (expected < 0) ? "" : "+")
<< (expected == 0 ? 0 : 100 * dsa / expected) << '%';
Expand All @@ -156,8 +157,9 @@ void statistics_dialog::add_damage_row(
str.str("");

if(show_this_turn) {
const long long turn_shifted = ((turn_expected * 20) + shift) / (2 * shift);
str << turn_damage << " / "
<< (((turn_expected * 20) + shift) / (2 * shift)) * 0.1
<< static_cast<double>(turn_shifted) * 0.1
<< " " // TODO: should probably make this two columns
<< ((dst < 0) ^ (turn_expected < 0) ? "" : "+")
<< (turn_expected == 0 ? 0 : 100 * dst / turn_expected) << '%';
Expand Down

0 comments on commit ccce411

Please sign in to comment.