1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Fixed #506. Some really weird issues caused it.

Also fixed #502 - eye radius is now 10.
This commit is contained in:
DjWarmonger
2010-06-21 04:43:10 +00:00
parent db2bde9ae2
commit 53d4b51b26
2 changed files with 14 additions and 2 deletions

View File

@ -185,6 +185,7 @@ void IGameCallback::getAllowedArts(std::vector<CArtifact*> &out, std::vector<CAr
(VLC->arth->*arts).push_back(&(VLC->arth->artifacts[i]));
}
}
for (int i = 0; i < (VLC->arth->*arts).size(); i++)
{
CArtifact *art = (VLC->arth->*arts)[i];
@ -205,6 +206,11 @@ void IGameCallback::getAllowed(std::vector<CArtifact*> &out, int flags)
getAllowedArts(out,&CArtHandler::majors, CArtifact::ART_MAJOR);
if(flags & CArtifact::ART_RELIC)
getAllowedArts(out,&CArtHandler::relics, CArtifact::ART_RELIC);
if (!out.size()) //no arts are avaliable
{
out.resize(64);
std::fill_n(out.begin(), 64, &(VLC->arth->artifacts[2])); //magic
}
}
ui16 IGameCallback::getRandomArt (int flags)
@ -227,6 +233,8 @@ ui16 IGameCallback::getRandomArt (int flags)
case CArtifact::ART_RELIC:
ptr = &VLC->arth->relics;
break;
default: //special artifacts should not be erased
return art->id;
}
ptr->erase (std::find(ptr->begin(), ptr->end(), art)); //remove the artifact from avaliable list
return art->id;