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

* Fixed the artifact screen completely, hopefully. Structural overhaul of the CArtPlace and CArtifactsOfHero classes, and I had to add a new server message SetArtifact to deal with things properly. The only thing that differs from H3 now is that you can't have gaps of empty slots in the backpack.

* Preliminary work on bug #112, a bigArtifacts set is added to CArtHandler.
This commit is contained in:
OnionKnight
2009-12-01 23:19:43 +00:00
parent df3ef1c330
commit 0a96decf87
13 changed files with 236 additions and 125 deletions

View File

@@ -2326,6 +2326,7 @@ bool CGameHandler::swapArtifacts(si32 srcHeroID, si32 destHeroID, ui16 srcSlot,
return false;
}
// TODO: This relates to bug #112, fix later.
// Make sure the artifacts are not war machines.
if ((srcSlot>=13 && srcSlot<=16) || (destSlot>=13 && destSlot<=16)) {
complain("Cannot move war machine!");
@@ -2363,6 +2364,28 @@ bool CGameHandler::swapArtifacts(si32 srcHeroID, si32 destHeroID, ui16 srcSlot,
return true;
}
/**
* Sets a hero artifact slot to contain a specific artifact.
*
* @param artID ID of an artifact or -1 for no artifact.
*/
bool CGameHandler::setArtifact(si32 heroID, ui16 slot, int artID)
{
CGHeroInstance *hero = gs->getHero(heroID);
// TODO: Deal with war machine placement.
// Perform the exchange.
SetHeroArtifacts sha;
sha.hid = heroID;
sha.artifacts = hero->artifacts;
sha.artifWorn = hero->artifWorn;
sha.setArtAtPos(slot, artID);
sendAndApply(&sha);
return true;
}
bool CGameHandler::buyArtifact( ui32 hid, si32 aid )
{
CGHeroInstance *hero = gs->getHero(hid);