| 577 | |
| 578 | |
| 579 | void Player::markTilesForDigging(bool marked, const std::vector<Tile*>& tiles, bool asyncMsg) |
| 580 | { |
| 581 | if(tiles.empty()) |
| 582 | return; |
| 583 | |
| 584 | std::vector<Tile*> tilesMark; |
| 585 | // If human player, we notify marked tiles |
| 586 | if(getIsHuman()) |
| 587 | { |
| 588 | for(Tile* tile : tiles) |
| 589 | { |
| 590 | if(!marked) |
| 591 | { |
| 592 | getSeat()->tileMarkedDiggingNotifiedToPlayer(tile, marked); |
| 593 | tile->setMarkedForDigging(marked, this); |
| 594 | tilesMark.push_back(tile); |
| 595 | |
| 596 | continue; |
| 597 | } |
| 598 | |
| 599 | // If the tile is diggable for the client, we mark it for him |
| 600 | if(getSeat()->isTileDiggableForClient(tile)) |
| 601 | { |
| 602 | getSeat()->tileMarkedDiggingNotifiedToPlayer(tile, marked); |
| 603 | tilesMark.push_back(tile); |
| 604 | } |
| 605 | |
| 606 | // If the tile can be marked on server side, we mark it |
| 607 | if(!tile->isDiggable(getSeat())) |
| 608 | continue; |
| 609 | |
| 610 | tile->setMarkedForDigging(marked, this); |
| 611 | } |
| 612 | } |
| 613 | else |
| 614 | { |
| 615 | for(Tile* tile : tiles) |
| 616 | { |
| 617 | if(!marked) |
| 618 | { |
| 619 | getSeat()->tileMarkedDiggingNotifiedToPlayer(tile, marked); |
| 620 | tile->setMarkedForDigging(marked, this); |
| 621 | continue; |
| 622 | } |
| 623 | |
| 624 | // If the tile can be marked on server side, we mark it |
| 625 | if(!tile->isDiggable(getSeat())) |
| 626 | continue; |
| 627 | |
| 628 | tile->setMarkedForDigging(marked, this); |
| 629 | } |
| 630 | return; |
| 631 | } |
| 632 | |
| 633 | // If no tile to mark, we do not send the message |
| 634 | if(tilesMark.empty()) |
| 635 | return; |
| 636 |
no test coverage detected