mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-23 10:52:16 -07:00
use max/min
This commit is contained in:
parent
f7a7342344
commit
923240e956
1 changed files with 2 additions and 6 deletions
|
|
@ -161,12 +161,8 @@ ZoneViewZone::GridSize ZoneViewZone::positionCardsForDisplay(CardList &cards, bo
|
||||||
return GridSize{longestRow, qMax(col + 1, 3)};
|
return GridSize{longestRow, qMax(col + 1, 3)};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int cols = qFloor(qSqrt((double)cardCount / 2));
|
int cols = qMin(qFloor(qSqrt((double)cardCount / 2)), 7);
|
||||||
if (cols > 7)
|
int rows = qMax(qCeil((double)cardCount / cols), 1);
|
||||||
cols = 7;
|
|
||||||
int rows = qCeil((double)cardCount / cols);
|
|
||||||
if (rows < 1)
|
|
||||||
rows = 1;
|
|
||||||
if (minRows == 0)
|
if (minRows == 0)
|
||||||
minRows = rows;
|
minRows = rows;
|
||||||
else if (rows < minRows) {
|
else if (rows < minRows) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue