1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-15 13:33:36 +02:00

* fixed support for custom hero portrait in the game

* fixed problems with non-hero/town defs not present in defobjinfo but present on map (occurring probably only in case of def substitution in map editor)
* fixed hopefully issues with picking bonus in pregame
* no arrows in options in pregame for fixed hero
This commit is contained in:
Michał W. Urbańczyk 2009-02-08 17:19:42 +00:00
parent a113a8d289
commit c847d56a96
2 changed files with 31 additions and 13 deletions

View File

@ -505,11 +505,11 @@ void Options::OptionSwitch::press(bool down)
ourOpt->hero=-1;
CPG->ourOptions->showIcon(0,serialID,false);
}
if(ourOpt->bonus==bresource)
if(nCas < 0 && ourOpt->bonus==bresource)
{
ourOpt->bonus = brandom;
CPG->ourOptions->showIcon(1,serialID,false);
}
CPG->ourOptions->showIcon(1,serialID,false);
}
break;
}
@ -538,23 +538,27 @@ void Options::OptionSwitch::press(bool down)
}
case 1: //bonus change
{
if (dir>0 && ourOpt->bonus==bresource)
ourOpt->bonus=brandom;
else if (dir<0 && ourOpt->bonus==brandom)
ourOpt->bonus=bresource;
else ourOpt->bonus=(Ebonus)(ourOpt->bonus+dir);
if (ourOpt->hero==-2 && ourOpt->bonus==bartifact) //no hero - can't be artifact
ourOpt->bonus += dir;
if (ourOpt->hero==-2 && !ourInf->heroesNames.size() && ourOpt->bonus==bartifact) //no hero - can't be artifact
{
if (dir>0)
if (dir<0)
ourOpt->bonus=brandom;
else ourOpt->bonus=bgold;
}
if (ourOpt->castle==-1 && ourOpt->bonus==bresource)
if(ourOpt->bonus > bresource)
ourOpt->bonus = brandom;
if(ourOpt->bonus < brandom)
ourOpt->bonus = bresource;
if (ourOpt->castle==-1 && ourOpt->bonus==bresource) //random castle - can't be resource
{
if (dir<0)
ourOpt->bonus=bgold;
else ourOpt->bonus=brandom;
}
break;
}
}
@ -769,7 +773,7 @@ void Options::show()
poptions[poptions.size()-1]->nr=playersSoFar;
poptions[poptions.size()-1]->color=(Ecolor)i;
if(CPG->ret.playerInfos[playersSoFar].hero != -2)
if(CPG->ret.playerInfos[playersSoFar].hero == -1)
{
poptions[poptions.size()-1]->Hleft.show();
poptions[poptions.size()-1]->Hright.show();

18
map.cpp
View File

@ -874,7 +874,7 @@ void Mapa::loadHero( CGObjectInstance * &nobj, unsigned char * bufor, int &i )
bool portrait=bufor[i]; ++i;
if (portrait)
nhi->portrait = readChar(bufor,i);
nhi->portrait = bufor[i++];
if(readChar(bufor,i))//true if hero has specified abilities
{
int howMany = readNormalNr(bufor,i); i+=4;
@ -1309,7 +1309,21 @@ void Mapa::readDefInfo( unsigned char * bufor, int &i)
}
i+=16;
if(vinya->id!=34 && vinya->id!=70)
vinya->visitDir = VLC->dobjinfo->gobjs[vinya->id][vinya->subid]->visitDir;
{
CGDefInfo *h = VLC->dobjinfo->gobjs[vinya->id][vinya->subid];
if(!h)
{
//remove fake entry
VLC->dobjinfo->gobjs[vinya->id].erase(vinya->subid);
if(VLC->dobjinfo->gobjs[vinya->id].size())
VLC->dobjinfo->gobjs.erase(vinya->id);
tlog2<<"\t\tWarning: no defobjinfo entry for object ID="<<vinya->id<<" subID=" << vinya->subid<<std::endl;
}
else
{
vinya->visitDir = VLC->dobjinfo->gobjs[vinya->id][vinya->subid]->visitDir;
}
}
else
vinya->visitDir = 0xff;
defy.push_back(vinya); // add this def to the vector