mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-29 21:56:54 +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
|
hover(false);hover(true); //refresh statusbar
|
||||||
}
|
}
|
||||||
if(indeterminate(down) && !isItIn(&other->pos,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
//if(indeterminate(down) && !isItIn(&other->pos,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
||||||
{
|
//{
|
||||||
other->highlight = highlight = false;
|
// other->highlight = highlight = false;
|
||||||
show(screen2);
|
// show(screen2);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHeroGSlot::activate()
|
void CHeroGSlot::activate()
|
||||||
@ -539,7 +539,18 @@ void CCastleInterface::buildingClicked(int building)
|
|||||||
{
|
{
|
||||||
case 0: case 1: case 2: case 3: case 4: //mage guild
|
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
|
if(LOCPLINT->cb->getResourceAmount(6) < 500) //not enough gold to buy spellbook
|
||||||
{
|
{
|
||||||
@ -547,7 +558,7 @@ void CCastleInterface::buildingClicked(int building)
|
|||||||
}
|
}
|
||||||
else
|
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);
|
fl += boost::bind(&CCastleInterface::enterMageGuild,this);
|
||||||
std::vector<SComponent*> vvv(1,new SComponent(SComponent::artifact,0,0));
|
std::vector<SComponent*> vvv(1,new SComponent(SComponent::artifact,0,0));
|
||||||
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[214],vvv,fl,0,true);
|
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[214],vvv,fl,0,true);
|
||||||
|
@ -1725,6 +1725,7 @@ void CPlayerInterface::requestRealized( PackageApplied *pa )
|
|||||||
|
|
||||||
void CPlayerInterface::recreateWanderingHeroes()
|
void CPlayerInterface::recreateWanderingHeroes()
|
||||||
{
|
{
|
||||||
|
wanderingHeroes.clear();
|
||||||
std::vector<const CGHeroInstance*> heroes = cb->getHeroesInfo();
|
std::vector<const CGHeroInstance*> heroes = cb->getHeroesInfo();
|
||||||
for(size_t i = 0; i < heroes.size(); i++)
|
for(size_t i = 0; i < heroes.size(); i++)
|
||||||
if(!heroes[i]->inTownGarrison)
|
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]);
|
int level = (-mapa[*i]);
|
||||||
if(h3m.find(20+(level*3)) != h3m.end()) //upgraded creature horde building
|
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);
|
ret.insert(25);
|
||||||
else
|
else
|
||||||
ret.insert(19);
|
ret.insert(19);
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
if(((castleID==1) || (castleID==3)) && ((level==3) || (level==5)))
|
if(((castleID==1 && level==5) || (castleID==3 && level==3)))
|
||||||
ret.insert(24);
|
ret.insert(24);
|
||||||
else
|
else
|
||||||
ret.insert(18);
|
ret.insert(18);
|
||||||
@ -729,7 +729,7 @@ int Mapa::loadSeerHut( unsigned char * bufor, int i, CGObjectInstance *& nobj )
|
|||||||
return i;
|
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();
|
CGTownInstance * nt = new CGTownInstance();
|
||||||
//(*(static_cast<CGObjectInstance*>(nt))) = *nobj;
|
//(*(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);
|
nt->forbiddenBuildings.insert((byte-6)*8+bit);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
nt->builtBuildings = convertBuildings(nt->builtBuildings,nt->subID);
|
nt->builtBuildings = convertBuildings(nt->builtBuildings,subid);
|
||||||
nt->forbiddenBuildings = convertBuildings(nt->forbiddenBuildings,nt->subID);
|
nt->forbiddenBuildings = convertBuildings(nt->forbiddenBuildings,subid);
|
||||||
}
|
}
|
||||||
else //standard buildings
|
else //standard buildings
|
||||||
{
|
{
|
||||||
@ -1652,7 +1652,7 @@ void Mapa::readObjects( unsigned char * bufor, int &i)
|
|||||||
}
|
}
|
||||||
case 77: case 98: //random town; town
|
case 77: case 98: //random town; town
|
||||||
{
|
{
|
||||||
loadTown(nobj, bufor, i);
|
loadTown(nobj, bufor, i, defInfo->subid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 53:
|
case 53:
|
||||||
|
@ -325,7 +325,7 @@ struct DLL_EXPORT Mapa : public CMapHeader
|
|||||||
void readHeader( unsigned char * bufor, int &i);
|
void readHeader( unsigned char * bufor, int &i);
|
||||||
void readRumors( unsigned char * bufor, int &i);
|
void readRumors( unsigned char * bufor, int &i);
|
||||||
void loadHero( CGObjectInstance * &nobj, 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);
|
int loadSeerHut( unsigned char * bufor, int i, CGObjectInstance *& nobj);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user