mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
* fixed handling second horde building in Rampart/Inferno
* garrisoned hero can buy a spellbook if he is selected or if there is no visiting hero * minor fixes
This commit is contained in:
parent
1c2ac579d5
commit
527ec27ef5
@ -301,11 +301,11 @@ void CHeroGSlot::clickLeft(boost::logic::tribool down)
|
||||
}
|
||||
hover(false);hover(true); //refresh statusbar
|
||||
}
|
||||
if(indeterminate(down) && !isItIn(&other->pos,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
||||
{
|
||||
other->highlight = highlight = false;
|
||||
show(screen2);
|
||||
}
|
||||
//if(indeterminate(down) && !isItIn(&other->pos,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
||||
//{
|
||||
// other->highlight = highlight = false;
|
||||
// show(screen2);
|
||||
//}
|
||||
}
|
||||
|
||||
void CHeroGSlot::activate()
|
||||
@ -539,7 +539,18 @@ void CCastleInterface::buildingClicked(int building)
|
||||
{
|
||||
case 0: case 1: case 2: case 3: case 4: //mage guild
|
||||
{
|
||||
if(town->visitingHero && !vstd::contains(town->visitingHero->artifWorn,ui16(17))) //visiting hero doesn't have spellboks
|
||||
const CGHeroInstance *h = NULL; //hero that "enters" mage guild
|
||||
|
||||
if(!town->garrisonHero && !town->visitingHero) //no heroes in town
|
||||
h = NULL;
|
||||
else if(!town->garrisonHero) //only visiting hero
|
||||
h = town->visitingHero;
|
||||
else if(!town->visitingHero || hslotup.highlight) //only garrisoned hero OR both heroes present, garrisoned hero selected
|
||||
h = town->garrisonHero;
|
||||
else //both heroes present, use the visiting one
|
||||
h = town->visitingHero;
|
||||
|
||||
if(h && !vstd::contains(h->artifWorn,ui16(17))) //hero doesn't have spellbok
|
||||
{
|
||||
if(LOCPLINT->cb->getResourceAmount(6) < 500) //not enough gold to buy spellbook
|
||||
{
|
||||
@ -547,7 +558,7 @@ void CCastleInterface::buildingClicked(int building)
|
||||
}
|
||||
else
|
||||
{
|
||||
CFunctionList<void()> fl = boost::bind(&CCallback::buyArtifact,LOCPLINT->cb,town->visitingHero,0);
|
||||
CFunctionList<void()> fl = boost::bind(&CCallback::buyArtifact,LOCPLINT->cb,h,0);
|
||||
fl += boost::bind(&CCastleInterface::enterMageGuild,this);
|
||||
std::vector<SComponent*> vvv(1,new SComponent(SComponent::artifact,0,0));
|
||||
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[214],vvv,fl,0,true);
|
||||
|
@ -1725,6 +1725,7 @@ void CPlayerInterface::requestRealized( PackageApplied *pa )
|
||||
|
||||
void CPlayerInterface::recreateWanderingHeroes()
|
||||
{
|
||||
wanderingHeroes.clear();
|
||||
std::vector<const CGHeroInstance*> heroes = cb->getHeroesInfo();
|
||||
for(size_t i = 0; i < heroes.size(); i++)
|
||||
if(!heroes[i]->inTownGarrison)
|
||||
|
12
lib/map.cpp
12
lib/map.cpp
@ -40,14 +40,14 @@ static std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID)
|
||||
int level = (-mapa[*i]);
|
||||
if(h3m.find(20+(level*3)) != h3m.end()) //upgraded creature horde building
|
||||
{
|
||||
if(((castleID==1) || (castleID==3)) && ((level==3) || (level==5)))
|
||||
if(((castleID==1 && level==5) || (castleID==3 && level==3)))
|
||||
ret.insert(25);
|
||||
else
|
||||
ret.insert(19);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
if(((castleID==1) || (castleID==3)) && ((level==3) || (level==5)))
|
||||
if(((castleID==1 && level==5) || (castleID==3 && level==3)))
|
||||
ret.insert(24);
|
||||
else
|
||||
ret.insert(18);
|
||||
@ -729,7 +729,7 @@ int Mapa::loadSeerHut( unsigned char * bufor, int i, CGObjectInstance *& nobj )
|
||||
return i;
|
||||
}
|
||||
|
||||
void Mapa::loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i )
|
||||
void Mapa::loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i, int subid)
|
||||
{
|
||||
CGTownInstance * nt = new CGTownInstance();
|
||||
//(*(static_cast<CGObjectInstance*>(nt))) = *nobj;
|
||||
@ -764,8 +764,8 @@ void Mapa::loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i )
|
||||
nt->forbiddenBuildings.insert((byte-6)*8+bit);
|
||||
i++;
|
||||
}
|
||||
nt->builtBuildings = convertBuildings(nt->builtBuildings,nt->subID);
|
||||
nt->forbiddenBuildings = convertBuildings(nt->forbiddenBuildings,nt->subID);
|
||||
nt->builtBuildings = convertBuildings(nt->builtBuildings,subid);
|
||||
nt->forbiddenBuildings = convertBuildings(nt->forbiddenBuildings,subid);
|
||||
}
|
||||
else //standard buildings
|
||||
{
|
||||
@ -1652,7 +1652,7 @@ void Mapa::readObjects( unsigned char * bufor, int &i)
|
||||
}
|
||||
case 77: case 98: //random town; town
|
||||
{
|
||||
loadTown(nobj, bufor, i);
|
||||
loadTown(nobj, bufor, i, defInfo->subid);
|
||||
break;
|
||||
}
|
||||
case 53:
|
||||
|
@ -325,7 +325,7 @@ struct DLL_EXPORT Mapa : public CMapHeader
|
||||
void readHeader( unsigned char * bufor, int &i);
|
||||
void readRumors( unsigned char * bufor, int &i);
|
||||
void loadHero( CGObjectInstance * &nobj, unsigned char * bufor, int &i);
|
||||
void loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i);
|
||||
void loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i, int subid);
|
||||
int loadSeerHut( unsigned char * bufor, int i, CGObjectInstance *& nobj);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user