mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 03:23:24 -08:00
[Refactor] Move table row mapping from TableZone into TableZoneLogic
This commit is contained in:
parent
c02576b827
commit
c7605a51e2
5 changed files with 43 additions and 38 deletions
|
|
@ -40,4 +40,23 @@ CardItem *TableZoneLogic::takeCard(int position, int cardId, bool toNewZone)
|
|||
emit contentSizeChanged();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
int TableZoneLogic::clampValidTableRow(const int row)
|
||||
{
|
||||
if (row < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (row >= ROW_COUNT) {
|
||||
return ROW_COUNT - 1;
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
int TableZoneLogic::tableRowToGridY(int tableRow)
|
||||
{
|
||||
if (tableRow > 2) {
|
||||
tableRow = 1;
|
||||
}
|
||||
return clampValidTableRow(2 - tableRow);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue