card dragging

This commit is contained in:
Asuro
2025-03-30 03:00:23 +02:00
parent e5076b0c3b
commit b006d14197
6 changed files with 76 additions and 48 deletions

View File

@@ -277,13 +277,16 @@ namespace Puzzle
bx::snprintf(buf, bufSize, "%s/%u.pzl", Puzzle::PuzzleFileDir, puzID);
}
// TODO: targetPos is of type CardPos
bool ReturnPlacedCard(PuzzleData& obj, PuzPos targetPos)
{
auto& placedCard = obj.PlacedCards[targetPos.Y * Config::MaxPuzzleSizeCards + targetPos.X];
if (IsValid(placedCard.RefCard))
{
if (placedCard.IsLocked) return false;
if (placedCard.IsLocked)
{
LOG_WARN("Card at %i %i is locked!", targetPos.X, targetPos.Y);
return false;
}
bool found = false;
for (int32_t i = 0; i < obj.AvailableCardCount; ++i)
{
@@ -304,7 +307,6 @@ namespace Puzzle
return true;
}
// TODO: targetPos is of type CardPos
bool DragAvailableCardTo(PuzzleData& obj, PuzPos targetPos, int32_t availIdx, uint8_t rotation)
{
if (availIdx >= obj.AvailableCardCount)