1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fixed #544. Final fix for #493.

This commit is contained in:
Michał W. Urbańczyk 2010-07-26 20:56:39 +00:00
parent dc936d5686
commit 2b899d5777
5 changed files with 33 additions and 24 deletions

View File

@ -591,6 +591,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
char msgBuf[500];
sprintf(msgBuf, CGI->generaltexth->allTexts[206].c_str(), spellCost, owner->myHero->mana);
owner->myInt->showInfoDialog(std::string(msgBuf));
return;
}
//battle spell on adv map or adventure map spell during combat => display infowindow, not cast

View File

@ -358,24 +358,24 @@ int CArtHandler::convertMachineID(int id, bool creToArt )
void CArtHandler::sortArts()
{
for (int i=0; i<allowedArtifacts.size(); ++i) //do 144, bo nie chcemy bzdurek
{
switch (allowedArtifacts[i]->aClass)
{
case CArtifact::ART_TREASURE:
treasures.push_back(allowedArtifacts[i]);
break;
case CArtifact::ART_MINOR:
minors.push_back(allowedArtifacts[i]);
break;
case CArtifact::ART_MAJOR:
majors.push_back(allowedArtifacts[i]);
break;
case CArtifact::ART_RELIC:
relics.push_back(allowedArtifacts[i]);
break;
}
}
// for (int i=0; i<allowedArtifacts.size(); ++i) //do 144, bo nie chcemy bzdurek
// {
// switch (allowedArtifacts[i]->aClass)
// {
// case CArtifact::ART_TREASURE:
// treasures.push_back(allowedArtifacts[i]);
// break;
// case CArtifact::ART_MINOR:
// minors.push_back(allowedArtifacts[i]);
// break;
// case CArtifact::ART_MAJOR:
// majors.push_back(allowedArtifacts[i]);
// break;
// case CArtifact::ART_RELIC:
// relics.push_back(allowedArtifacts[i]);
// break;
// }
// }
}
void CArtHandler::erasePickedArt (si32 id)
{
@ -703,10 +703,8 @@ void CArtHandler::clear()
delete art;
artifacts.clear();
treasures.clear();
minors.clear();
majors.clear();
relics.clear();
clearHlpLists();
}
/**
@ -795,3 +793,11 @@ void CArtHandler::unequipArtifact(std::map<ui16, ui32> &artifWorn, ui16 slotID)
}
}
}
void CArtHandler::clearHlpLists()
{
treasures.clear();
minors.clear();
majors.clear();
relics.clear();
}

View File

@ -65,6 +65,7 @@ public:
void sortArts();
void addBonuses();
void clear();
void clearHlpLists();
ui16 getRandomArt (int flags);
ui16 getArtSync (ui32 rand, int flags);
void getAllowedArts(std::vector<CArtifact*> &out, std::vector<CArtifact*> *arts, int flag);

View File

@ -828,7 +828,7 @@ void CGHeroInstance::initArmy(CCreatureSet *dst /*= NULL*/)
else
howManyStacks = 3;
for(int stackNo=0; stackNo<3; stackNo++)
for(int stackNo=0; stackNo < howManyStacks; stackNo++)
{
int creID = (VLC->creh->nameToID[type->refTypeStack[stackNo]]);
int range = type->highStack[stackNo] - type->lowStack[stackNo];

View File

@ -1176,7 +1176,8 @@ CGameState::~CGameState()
}
void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
{
VLC->arth->allowedArtifacts.clear();
VLC->arth->clearHlpLists();
switch(si->mode)
{
case 0: