mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-26 00:23:55 -07:00
Fix segfault when creating token of opponent's card (#6144)
* Fix segfault when creating token of opponent's card * clean up code
This commit is contained in:
parent
a9cbd5a172
commit
f4fbe90a72
1 changed files with 7 additions and 3 deletions
|
|
@ -878,7 +878,12 @@ void PlayerActions::actCreateAnotherToken()
|
||||||
|
|
||||||
void PlayerActions::setLastToken(CardInfoPtr cardInfo)
|
void PlayerActions::setLastToken(CardInfoPtr cardInfo)
|
||||||
{
|
{
|
||||||
if (cardInfo == nullptr || !player->getPlayerMenu()->getUtilityMenu()->createAnotherTokenActionExists()) {
|
if (cardInfo == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilityMenu *utilityMenu = player->getPlayerMenu()->getUtilityMenu();
|
||||||
|
if (utilityMenu == nullptr || !utilityMenu->createAnotherTokenActionExists()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -892,8 +897,7 @@ void PlayerActions::setLastToken(CardInfoPtr cardInfo)
|
||||||
|
|
||||||
lastTokenTableRow = TableZone::clampValidTableRow(2 - cardInfo->getTableRow());
|
lastTokenTableRow = TableZone::clampValidTableRow(2 - cardInfo->getTableRow());
|
||||||
|
|
||||||
player->getPlayerMenu()->getUtilityMenu()->setAndEnableCreateAnotherTokenAction(
|
utilityMenu->setAndEnableCreateAnotherTokenAction(tr("C&reate another %1 token").arg(lastTokenInfo.name));
|
||||||
tr("C&reate another %1 token").arg(lastTokenInfo.name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerActions::actCreatePredefinedToken()
|
void PlayerActions::actCreatePredefinedToken()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue