1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added block for several more actions outside of our turn

This commit is contained in:
Ivan Savenko 2024-04-28 15:58:54 +03:00
parent d53082e1c1
commit 74d3b4ab43
9 changed files with 20 additions and 12 deletions

View File

@ -171,7 +171,7 @@ void CAltarArtifacts::updateAltarSlots()
}
calcExpAltarForHero();
deal->block(tradeSlotsMap.empty());
deal->block(tradeSlotsMap.empty() || !LOCPLINT->makingTurn);
}
void CAltarArtifacts::putBackArtifacts()
@ -205,7 +205,7 @@ void CAltarArtifacts::onSlotClickPressed(const std::shared_ptr<CTradeableItem> &
{
if(altarSlot->id == -1)
tradeSlotsMap.try_emplace(altarSlot, pickedArtInst);
deal->block(false);
deal->block(!LOCPLINT->makingTurn);
LOCPLINT->cb->swapArtifacts(ArtifactLocation(heroArts->getHero()->id, ArtifactPosition::TRANSITION_POS),
ArtifactLocation(altarId, ArtifactPosition::ALTAR));

View File

@ -205,7 +205,7 @@ void CAltarCreatures::sacrificeAll()
offerTradePanel->update();
updateShowcases();
deal->block(calcExpAltarForHero() == 0);
deal->block(calcExpAltarForHero() == 0 || !LOCPLINT->makingTurn);
}
void CAltarCreatures::updateAltarSlot(const std::shared_ptr<CTradeableItem> & slot)
@ -222,7 +222,7 @@ void CAltarCreatures::onOfferSliderMoved(int newVal)
unitsOnAltar[bidTradePanel->highlightedSlot->serial] = newVal;
if(offerTradePanel->isHighlighted())
updateAltarSlot(offerTradePanel->highlightedSlot);
deal->block(calcExpAltarForHero() == 0);
deal->block(calcExpAltarForHero() == 0 || !LOCPLINT->makingTurn);
highlightingChanged();
redraw();
}

View File

@ -102,7 +102,7 @@ void CArtifactsBuying::highlightingChanged()
if(bidTradePanel->isHighlighted() && offerTradePanel->isHighlighted())
{
market->getOffer(bidTradePanel->getSelectedItemId(), offerTradePanel->getSelectedItemId(), bidQty, offerQty, EMarketMode::RESOURCE_ARTIFACT);
deal->block(LOCPLINT->cb->getResourceAmount(GameResID(bidTradePanel->getSelectedItemId())) >= bidQty ? false : true);
deal->block(LOCPLINT->cb->getResourceAmount(GameResID(bidTradePanel->getSelectedItemId())) < bidQty || !LOCPLINT->makingTurn);
}
CMarketBase::highlightingChanged();
CMarketTraderText::highlightingChanged();

View File

@ -149,7 +149,7 @@ void CArtifactsSelling::highlightingChanged()
if(art && offerTradePanel->isHighlighted())
{
market->getOffer(art->getTypeId(), offerTradePanel->getSelectedItemId(), bidQty, offerQty, EMarketMode::ARTIFACT_RESOURCE);
deal->block(false);
deal->block(!LOCPLINT->makingTurn);
}
CMarketBase::highlightingChanged();
CMarketTraderText::highlightingChanged();

View File

@ -96,7 +96,7 @@ void CFreelancerGuild::highlightingChanged()
offerSlider->scrollTo(0);
offerSlider->block(false);
maxAmount->block(false);
deal->block(false);
deal->block(!LOCPLINT->makingTurn);
}
CMarketBase::highlightingChanged();
CMarketTraderText::highlightingChanged();

View File

@ -89,7 +89,7 @@ void CMarketResources::highlightingChanged()
const bool isControlsBlocked = bidTradePanel->getSelectedItemId() != offerTradePanel->getSelectedItemId() ? false : true;
offerSlider->block(isControlsBlocked);
maxAmount->block(isControlsBlocked);
deal->block(isControlsBlocked);
deal->block(isControlsBlocked || !LOCPLINT->makingTurn);
}
CMarketBase::highlightingChanged();
CMarketTraderText::highlightingChanged();

View File

@ -89,7 +89,7 @@ void CTransferResources::highlightingChanged()
offerSlider->scrollTo(0);
offerSlider->block(false);
maxAmount->block(false);
deal->block(false);
deal->block(!LOCPLINT->makingTurn);
}
CMarketBase::highlightingChanged();
CMarketTraderText::highlightingChanged();

View File

@ -787,7 +787,10 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
break;
case BuildingSubID::CASTLE_GATE:
if (LOCPLINT->makingTurn)
enterCastleGate();
else
enterBuilding(building);
break;
case BuildingSubID::CREATURE_TRANSFORMER: //Skeleton Transformer
@ -966,7 +969,9 @@ void CCastleBuildings::enterMagesGuild()
{
const CGHeroInstance *hero = getHero();
if(hero && !hero->hasSpellbook()) //hero doesn't have spellbok
// hero doesn't have spellbok
// or it is not our turn and we can't make actions
if(hero && !hero->hasSpellbook() && LOCPLINT->makingTurn)
{
if(hero->isCampaignYog())
{

View File

@ -89,6 +89,9 @@ void CWindowWithArtifacts::clickPressedArtPlaceHero(const CArtifactsOfHeroBase &
if(artPlace.isLocked())
return;
if (!LOCPLINT->makingTurn)
return;
std::visit(
[this, &artPlace](auto artSetWeak) -> void
{