mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
getAllowedSpells fixed. Shrines will use it from now on.
This commit is contained in:
parent
55925e0eea
commit
0937653e0a
@ -3584,17 +3584,8 @@ void CGShrine::initObj()
|
|||||||
if(spell == 255) //spell not set
|
if(spell == 255) //spell not set
|
||||||
{
|
{
|
||||||
int level = ID-87;
|
int level = ID-87;
|
||||||
std::vector<ui32> possibilities;
|
std::vector<ui16> possibilities;
|
||||||
|
cb->getAllowedSpells (possibilities, level);
|
||||||
//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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!possibilities.size())
|
if(!possibilities.size())
|
||||||
{
|
{
|
||||||
|
@ -193,9 +193,12 @@ void IGameCallback::getAllowed(std::vector<CArtifact*> &out, int flags)
|
|||||||
|
|
||||||
void IGameCallback::getAllowedSpells(std::vector<ui16> &out, ui16 level)
|
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);
|
out.push_back(i);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user