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

Mostly done combined artifacts.

[assembling, disassembling, moving, picking]
This commit is contained in:
Michał W. Urbańczyk
2011-01-23 23:49:17 +00:00
parent 3fde9e45df
commit e6d577c233
9 changed files with 83 additions and 29 deletions

View File

@@ -2572,17 +2572,28 @@ bool CGameHandler::assembleArtifacts (si32 heroID, ui16 artifactSlot, bool assem
if(!destArtifact)
COMPLAIN_RET("assembleArtifacts: there is no such artifact instance!");
CArtifact *combinedArt = VLC->arth->artifacts[assembleTo];
if(!combinedArt->constituents)
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to assemble is not a combined artifacts!");
if(!vstd::contains(destArtifact->assemblyPossibilities(hero), combinedArt))
COMPLAIN_RET("assembleArtifacts: It's impossible to assemble requested artifact!");
if(assemble)
{
CArtifact *combinedArt = VLC->arth->artifacts[assembleTo];
if(!combinedArt->constituents)
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to assemble is not a combined artifacts!");
if(!vstd::contains(destArtifact->assemblyPossibilities(hero), combinedArt))
COMPLAIN_RET("assembleArtifacts: It's impossible to assemble requested artifact!");
AssembledArtifact aa;
aa.al = ArtifactLocation(hero, artifactSlot);
aa.builtArt = combinedArt;
AssembledArtifact aa;
aa.al = ArtifactLocation(hero, artifactSlot);
aa.builtArt = combinedArt;
sendAndApply(&aa);
}
else
{
if(!destArtifact->artType->constituents)
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to disassemble is not a combined artifact!");
CCombinedArtifactInstance *assembliedArt = new CCombinedArtifactInstance();
DisassembledArtifact da;
da.al = ArtifactLocation(hero, artifactSlot);
sendAndApply(&da);
}
/*
SetHeroArtifacts sha;
sha.hid = heroID;