diff options
| author | Bryan Hoyle <starfoxprime@gmail.com> | 2012-11-16 21:51:55 (GMT) |
|---|---|---|
| committer | Bryan Hoyle <starfoxprime@gmail.com> | 2012-11-16 21:51:55 (GMT) |
| commit | 874cd400093c38e67fde4a1861603bce83135539 (patch) | |
| tree | e9c8b31b7cc752133dd0e110c652ed9775e859d5 /src/interface/SaveButton.cpp | |
| parent | e0aa92b017a8d5602ce8b43f6e240ab42a25fac4 (diff) | |
| parent | d8be547c734cfaa3d121412b11381b4787380762 (diff) | |
| download | powder-874cd400093c38e67fde4a1861603bce83135539.zip powder-874cd400093c38e67fde4a1861603bce83135539.tar.gz | |
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/interface/SaveButton.cpp')
| -rw-r--r-- | src/interface/SaveButton.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/interface/SaveButton.cpp b/src/interface/SaveButton.cpp index 93a22f7..eb2640b 100644 --- a/src/interface/SaveButton.cpp +++ b/src/interface/SaveButton.cpp @@ -68,19 +68,27 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save): votesString = votes; int voteMax = std::max(save->GetVotesUp(),save->GetVotesDown()); - if (voteMax < 34) + if (voteMax) { - float ry = 33.0f/voteMax; - if (voteMax<8) - ry = ry/(8-voteMax); - voteBarHeightUp = (int)(save->GetVotesUp()*ry)-1; - voteBarHeightDown = (int)(save->GetVotesDown()*ry)-1; + if (voteMax < 34) + { + float ry = 33.0f/voteMax; + if (voteMax<8) + ry = ry/(8-voteMax); + voteBarHeightUp = (int)(save->GetVotesUp()*ry)-1; + voteBarHeightDown = (int)(save->GetVotesDown()*ry)-1; + } + else + { + float ry = voteMax/33.0f; + voteBarHeightUp = (int)(save->GetVotesUp()/ry)-1; + voteBarHeightDown = (int)(save->GetVotesDown()/ry)-1; + } } else { - float ry = voteMax/33.0f; - voteBarHeightUp = (int)(save->GetVotesUp()/ry)-1; - voteBarHeightDown = (int)(save->GetVotesDown()/ry)-1; + voteBarHeightUp = 0; + voteBarHeightDown = 0; } } } |
