1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

client is able to erase artifact

This commit is contained in:
SoundSSGood
2023-04-08 00:41:55 +03:00
parent 307065a633
commit ea7dd14d8b
12 changed files with 65 additions and 1 deletions

View File

@@ -4063,6 +4063,23 @@ bool CGameHandler::assembleArtifacts (ObjectInstanceID heroID, ArtifactPosition
return true;
}
bool CGameHandler::eraseArtifactByClient(const ArtifactLocation & al)
{
const auto * hero = getHero(al.relatedObj()->id);
if(hero == nullptr)
COMPLAIN_RET("eraseArtifactByClient: wrong hero's ID");
const auto * art = al.getArt();
if(art == nullptr)
COMPLAIN_RET("Cannot remove artifact!");
if(al.getArt()->artType->canBePutAt(hero) || al.slot != ArtifactPosition::TRANSITION_POS)
COMPLAIN_RET("Unlegal removing artifact");
removeArtifact(al);
return true;
}
bool CGameHandler::buyArtifact(ObjectInstanceID hid, ArtifactID aid)
{
const CGHeroInstance * hero = getHero(hid);