1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Enabled commander artifacts. Don't work yet.

This commit is contained in:
DjWarmonger 2012-05-20 08:39:19 +00:00
parent a234b4c935
commit 88639be91b
3 changed files with 37 additions and 38 deletions

View File

@ -305,25 +305,25 @@ void CHeroWindow::questlog()
void CHeroWindow::commanderWindow()
{
//TODO: allow equipping commander artifacts by drag / drop
//bool artSelected = false;
//const CArtifactsOfHero::SCommonPart *commonInfo = artSets.front()->commonInfo;
bool artSelected = false;
const CArtifactsOfHero::SCommonPart *commonInfo = artSets.front()->commonInfo;
//if (const CArtifactInstance *art = commonInfo->src.art)
//{
// const CGHeroInstance *srcHero = commonInfo->src.AOH->getHero();
// artSelected = true;
// ArtifactLocation src (srcHero, commonInfo->src.slotID);
// ArtifactLocation dst (curHero->commander.get(), commonInfo->src.slotID);
// if (art->canBePutAt(dst, true))
// { //equip clicked stack
// if(dst.getArt())
// {
// LOCPLINT->cb->swapArtifacts (dst, ArtifactLocation(srcHero, dst.getArt()->firstBackpackSlot(srcHero)));
// }
// LOCPLINT->cb->swapArtifacts(src, dst);
// }
//}
//else
if (const CArtifactInstance *art = commonInfo->src.art)
{
const CGHeroInstance *srcHero = commonInfo->src.AOH->getHero();
artSelected = true;
ArtifactLocation src (srcHero, commonInfo->src.slotID);
ArtifactLocation dst (curHero->commander.get(), art->firstAvailableSlot (curHero->commander));
if (art->canBePutAt(dst, true))
{ //equip clicked stack
if(dst.getArt())
{
LOCPLINT->cb->swapArtifacts (dst, ArtifactLocation(srcHero, dst.getArt()->firstBackpackSlot(srcHero)));
}
LOCPLINT->cb->swapArtifacts(src, dst);
}
}
else
GH.pushInt(new CCreatureWindow (curHero->commander));
}

View File

@ -200,7 +200,6 @@ CArtHandler::CArtHandler()
// War machines are the default big artifacts.
for (ui32 i = 3; i <= 6; i++)
bigArtifacts.insert(i);
//modableArtifacts = boost::assign::map_list_of(1, 1)(146,3)(147,3)(148,3)(150,3)(151,3)(152,3)(154,3)(156,2);
}
CArtHandler::~CArtHandler()
@ -238,7 +237,7 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
nart.price=atoi(pom.c_str());
nart.possibleSlots[ArtBearer::HERO]; //we want to generate map entry even if it will be empty
nart.possibleSlots[ArtBearer::CREATURE]; //we want to generate map entry even if it will be empty
//nart.possibleSlots[ArtBearer::COMMANDER];
nart.possibleSlots[ArtBearer::COMMANDER];
for(int j=0;j<slots.size();j++)
{
loadToIt(pom,buf,it,4);
@ -512,21 +511,21 @@ void CArtHandler::makeItCreatureArt (int aid, bool onlyCreature /*=true*/)
if (onlyCreature)
{
a->possibleSlots[ArtBearer::HERO].clear();
//a->possibleSlots[ArtBearer::COMMANDER].clear();
a->possibleSlots[ArtBearer::COMMANDER].clear();
}
a->possibleSlots[ArtBearer::CREATURE].push_back(ArtifactPosition::CREATURE_SLOT);
};
void CArtHandler::makeItCommanderArt (int aid, bool onlyCommander /*=true*/)
{
//CArtifact *a = artifacts[aid];
//if (onlyCommander)
//{
// a->possibleSlots[ArtBearer::HERO].clear();
// a->possibleSlots[ArtBearer::CREATURE].clear();
//}
//for (int i = ArtifactPosition::COMMANDER1; i <= ArtifactPosition::COMMANDER6; ++i)
// a->possibleSlots[ArtBearer::COMMANDER].push_back(i);
CArtifact *a = artifacts[aid];
if (onlyCommander)
{
a->possibleSlots[ArtBearer::HERO].clear();
a->possibleSlots[ArtBearer::CREATURE].clear();
}
for (int i = ArtifactPosition::COMMANDER1; i <= ArtifactPosition::COMMANDER6; ++i)
a->possibleSlots[ArtBearer::COMMANDER].push_back(i);
};
void CArtHandler::addBonuses()
@ -941,13 +940,13 @@ void CArtHandler::initAllowedArtifactsList(const std::vector<ui8> &allowed)
if (allowed[i])
allowedArtifacts.push_back(artifacts[i]);
}
//if (GameConstants::COMMANDERS) //allow all commander artifacts for testing
//{
// for (int i = 146; i <= 155; ++i)
// {
// allowedArtifacts.push_back(artifacts[i]);
// }
//}
if (GameConstants::COMMANDERS) //allow all commander artifacts for testing
{
for (int i = 146; i <= 155; ++i)
{
allowedArtifacts.push_back(artifacts[i]);
}
}
}
CArtifactInstance::CArtifactInstance()

View File

@ -28,8 +28,8 @@ namespace ArtifactPosition
MACH1, MACH2, MACH3, MACH4, SPELLBOOK, MISC5,
AFTER_LAST,
//cres
CREATURE_SLOT = 0/*,
COMMANDER1 = 0, COMMANDER2, COMMANDER3, COMMANDER4, COMMANDER5, COMMANDER6*/
CREATURE_SLOT = 0,
COMMANDER1 = 0, COMMANDER2, COMMANDER3, COMMANDER4, COMMANDER5, COMMANDER6
};
}