mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 11:38:49 -07:00
[Game][Arrows] Don't request deletion on inbound arrow deletion signal again but react to it locally (#6927)
* [Game][Arrows] Deleting arrows has no acknowledgement command so we have to delete locally as well. Took 22 minutes * Fix properly. Took 15 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
09d817770e
commit
8751f0605d
4 changed files with 11 additions and 1 deletions
|
|
@ -93,6 +93,7 @@ void GameScene::addPlayer(PlayerLogic *player)
|
|||
rearrange();
|
||||
});
|
||||
|
||||
connect(player, &PlayerLogic::arrowDeleted, this, &GameScene::onArrowDeleted);
|
||||
connect(player, &PlayerLogic::arrowCreateRequested, this, &GameScene::onArrowCreateRequested);
|
||||
connect(player, &PlayerLogic::arrowDeleteRequested, this, &GameScene::onArrowDeleteRequested);
|
||||
connect(player, &PlayerLogic::arrowsCleared, this,
|
||||
|
|
@ -404,6 +405,13 @@ void GameScene::onArrowCreateRequested(const ArrowData &data)
|
|||
connect(arrow, &QObject::destroyed, this, [this, id = data.id]() { arrowRegistry.remove(id); });
|
||||
}
|
||||
|
||||
void GameScene::onArrowDeleted(int arrowId)
|
||||
{
|
||||
if (arrowRegistry.contains(arrowId)) {
|
||||
arrowRegistry.take(arrowId)->delArrow();
|
||||
}
|
||||
}
|
||||
|
||||
void GameScene::onArrowDeleteRequested(int arrowId)
|
||||
{
|
||||
if (arrowRegistry.contains(arrowId)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue