mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fixes for handling starting spells / spellbook.
This commit is contained in:
parent
efb1049860
commit
670a408fab
@ -660,12 +660,16 @@ void CGHeroInstance::initHero()
|
||||
initHeroDefInfo();
|
||||
if(!type)
|
||||
type = VLC->heroh->heroes[subID];
|
||||
artifWorn[16] = 3;
|
||||
if(type->startingSpell >= 0) //hero starts with a spell
|
||||
{
|
||||
artifWorn[17] = 0; //give him spellbook
|
||||
if(!vstd::contains(spells, 0xffffffff) && type->startingSpell >= 0) //hero starts with a spell
|
||||
spells.insert(type->startingSpell);
|
||||
else //remove placeholder
|
||||
spells -= 0xffffffff;
|
||||
|
||||
if(!vstd::contains(artifWorn, 16) && type->startingSpell >= 0) //no catapult means we haven't read pre-existant set
|
||||
{
|
||||
artifWorn[17] = 0; //give spellbook
|
||||
}
|
||||
artifWorn[16] = 3; //everyone has a catapult
|
||||
|
||||
if(portrait < 0 || portrait == 255)
|
||||
portrait = subID;
|
||||
|
@ -981,6 +981,8 @@ void Mapa::loadHero( CGObjectInstance * &nobj, unsigned char * bufor, int &i )
|
||||
int id = readNormalNr(bufor,i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
nhi->artifWorn[16] = id;
|
||||
else
|
||||
nhi->artifWorn[16] = 3; //catapult by default
|
||||
}
|
||||
//spellbook
|
||||
int id = readNormalNr(bufor,i, artidlen); i+=artidlen;
|
||||
@ -1027,6 +1029,7 @@ void Mapa::loadHero( CGObjectInstance * &nobj, unsigned char * bufor, int &i )
|
||||
|
||||
if(areSpells) //TODO: sprawdziæ //seems to be ok - tow
|
||||
{
|
||||
nhi->spells.insert(0xffffffff); //placeholder "preset spells"
|
||||
int ist = i;
|
||||
for(i; i<ist+9; ++i)
|
||||
{
|
||||
@ -1045,9 +1048,11 @@ void Mapa::loadHero( CGObjectInstance * &nobj, unsigned char * bufor, int &i )
|
||||
else if(version==AB) //we can read one spell
|
||||
{
|
||||
unsigned char buff = bufor[i]; ++i;
|
||||
if(buff!=254)
|
||||
if(buff != 254)
|
||||
{
|
||||
nhi->spells.insert(buff);
|
||||
nhi->spells.insert(0xffffffff); //placeholder "preset spells"
|
||||
if(buff < 254) //255 means no spells
|
||||
nhi->spells.insert(buff);
|
||||
}
|
||||
}
|
||||
//spells loaded
|
||||
|
Loading…
Reference in New Issue
Block a user