1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

getAllowedSpells fixed. Shrines will use it from now on.

This commit is contained in:
DjWarmonger 2009-09-24 19:28:26 +00:00
parent 55925e0eea
commit 0937653e0a
2 changed files with 7 additions and 13 deletions

View File

@ -3584,17 +3584,8 @@ void CGShrine::initObj()
if(spell == 255) //spell not set
{
int level = ID-87;
std::vector<ui32> possibilities;
//add all allowed spells of wanted level
for(int i=0; i<SPELLS_QUANTITY; i++)
{
if(VLC->spellh->spells[i].level == level
&& cb->isAllowed(0,VLC->spellh->spells[i].id))
{
possibilities.push_back(VLC->spellh->spells[i].id);
}
}
std::vector<ui16> possibilities;
cb->getAllowedSpells (possibilities, level);
if(!possibilities.size())
{

View File

@ -193,9 +193,12 @@ void IGameCallback::getAllowed(std::vector<CArtifact*> &out, int flags)
void IGameCallback::getAllowedSpells(std::vector<ui16> &out, ui16 level)
{
for (int i = 0; i < (VLC->spellh->spells).size(); i++)
CSpell *spell;
for (int i = 0; i < gs->map->allowedSpell.size(); i++) //spellh size appears to be greater (?)
{
if (isAllowed (1, i))
spell = &(VLC->spellh->spells[i]);
if (isAllowed (0, spell->id) && spell->level == level)
{
out.push_back(i);
}