1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-23 21:29:13 +02:00

vcmiartifacts fixed

This commit is contained in:
SoundSSGood 2023-04-08 01:54:19 +03:00
parent ea7dd14d8b
commit e58be8e7f7
4 changed files with 11 additions and 2 deletions

@ -1912,7 +1912,6 @@ void CPlayerInterface::artifactPut(const ArtifactLocation &al)
EVENT_HANDLER_CALLED_BY_CLIENT;
auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder);
updateInfo(hero);
askToAssembleArtifact(al);
}
void CPlayerInterface::artifactRemoved(const ArtifactLocation &al)

@ -255,6 +255,8 @@ void ApplyClientNetPackVisitor::visitBulkSmartRebalanceStacks(BulkSmartRebalance
void ApplyClientNetPackVisitor::visitPutArtifact(PutArtifact & pack)
{
callInterfaceIfPresent(cl, pack.al.owningPlayer(), &IGameEventsReceiver::artifactPut, pack.al);
if(pack.askAssemble)
callInterfaceIfPresent(cl, pack.al.owningPlayer(), &IGameEventsReceiver::askToAssembleArtifact, pack.al);
}
void ApplyClientNetPackVisitor::visitEraseArtifact(EraseArtifact & pack)

@ -950,7 +950,14 @@ struct DLL_LINKAGE CArtifactOperationPack : CPackForClient
struct DLL_LINKAGE PutArtifact : CArtifactOperationPack
{
PutArtifact() = default;
PutArtifact(ArtifactLocation * dst, bool askAssemble = true)
: al(*dst), askAssemble(askAssemble)
{
}
ArtifactLocation al;
bool askAssemble = false;
ConstTransitivePtr<CArtifactInstance> art;
void applyGs(CGameState * gs);
@ -959,6 +966,7 @@ struct DLL_LINKAGE PutArtifact : CArtifactOperationPack
template <typename Handler> void serialize(Handler & h, const int version)
{
h & al;
h & askAssemble;
h & art;
}
};

@ -4074,7 +4074,7 @@ bool CGameHandler::eraseArtifactByClient(const ArtifactLocation & al)
COMPLAIN_RET("Cannot remove artifact!");
if(al.getArt()->artType->canBePutAt(hero) || al.slot != ArtifactPosition::TRANSITION_POS)
COMPLAIN_RET("Unlegal removing artifact");
COMPLAIN_RET("Illegal artifact removal request");
removeArtifact(al);
return true;