mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
This commit is contained in:
@@ -1034,7 +1034,7 @@ void CCastleInterface::CCreaInfo::hover(bool on)
|
|||||||
}
|
}
|
||||||
void CCastleInterface::CCreaInfo::clickLeft(tribool down, bool previousState)
|
void CCastleInterface::CCreaInfo::clickLeft(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
if(down)
|
if(previousState && (!down))
|
||||||
{
|
{
|
||||||
LOCPLINT->castleInt->showRecruitmentWindow(bid);
|
LOCPLINT->castleInt->showRecruitmentWindow(bid);
|
||||||
}
|
}
|
||||||
@@ -1169,7 +1169,7 @@ void CCastleInterface::CTownInfo::hover(bool on)
|
|||||||
}
|
}
|
||||||
void CCastleInterface::CTownInfo::clickLeft(tribool down, bool previousState)
|
void CCastleInterface::CTownInfo::clickLeft(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
if(down)
|
if(previousState && (!down))
|
||||||
if (LOCPLINT->castleInt->town->builtBuildings.find(bid)!=LOCPLINT->castleInt->town->builtBuildings.end())
|
if (LOCPLINT->castleInt->town->builtBuildings.find(bid)!=LOCPLINT->castleInt->town->builtBuildings.end())
|
||||||
LOCPLINT->castleInt->buildingClicked(bid);//activate building
|
LOCPLINT->castleInt->buildingClicked(bid);//activate building
|
||||||
}
|
}
|
||||||
@@ -1321,7 +1321,11 @@ void CHallInterface::CBuildingBox::clickRight(tribool down, bool previousState)
|
|||||||
void CHallInterface::CBuildingBox::show(SDL_Surface * to)
|
void CHallInterface::CBuildingBox::show(SDL_Surface * to)
|
||||||
{
|
{
|
||||||
CCastleInterface *ci = LOCPLINT->castleInt;
|
CCastleInterface *ci = LOCPLINT->castleInt;
|
||||||
blitAt(ci->bicons->ourImages[BID].bitmap,pos.x,pos.y,to);
|
if (( (BID == 18) && (vstd::contains(ci->town->builtBuildings,(ci->town->town->hordeLvl[0]+37))))
|
||||||
|
|| ( (BID == 24) && (vstd::contains(ci->town->builtBuildings,(ci->town->town->hordeLvl[1]+37)))) )
|
||||||
|
blitAt(ci->bicons->ourImages[BID+1].bitmap,pos.x,pos.y,to);
|
||||||
|
else
|
||||||
|
blitAt(ci->bicons->ourImages[BID].bitmap,pos.x,pos.y,to);
|
||||||
int pom, pom2=-1;
|
int pom, pom2=-1;
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
@@ -1349,30 +1353,20 @@ void CHallInterface::CBuildingBox::show(SDL_Surface * to)
|
|||||||
blitAt(ci->status->ourImages[pom2].bitmap,pos.x+135, pos.y+54,to);
|
blitAt(ci->status->ourImages[pom2].bitmap,pos.x+135, pos.y+54,to);
|
||||||
CSDL_Ext::printAtMiddle(CGI->buildh->buildings[ci->town->subID][BID]->Name(),pos.x-1+ci->bars->ourImages[0].bitmap->w/2,pos.y+71+ci->bars->ourImages[0].bitmap->h/2, GEOR13,zwykly,to);
|
CSDL_Ext::printAtMiddle(CGI->buildh->buildings[ci->town->subID][BID]->Name(),pos.x-1+ci->bars->ourImages[0].bitmap->w/2,pos.y+71+ci->bars->ourImages[0].bitmap->h/2, GEOR13,zwykly,to);
|
||||||
}
|
}
|
||||||
void CHallInterface::CBuildingBox::activate()
|
|
||||||
{
|
|
||||||
activateHover();
|
|
||||||
activateLClick();
|
|
||||||
activateRClick();
|
|
||||||
}
|
|
||||||
void CHallInterface::CBuildingBox::deactivate()
|
|
||||||
{
|
|
||||||
deactivateHover();
|
|
||||||
deactivateLClick();
|
|
||||||
deactivateRClick();
|
|
||||||
}
|
|
||||||
CHallInterface::CBuildingBox::~CBuildingBox()
|
CHallInterface::CBuildingBox::~CBuildingBox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
CHallInterface::CBuildingBox::CBuildingBox(int id)
|
CHallInterface::CBuildingBox::CBuildingBox(int id)
|
||||||
:BID(id)
|
:BID(id)
|
||||||
{
|
{
|
||||||
|
used = LCLICK | RCLICK | HOVER;
|
||||||
pos.w = 150;
|
pos.w = 150;
|
||||||
pos.h = 88;
|
pos.h = 88;
|
||||||
}
|
}
|
||||||
CHallInterface::CBuildingBox::CBuildingBox(int id, int x, int y)
|
CHallInterface::CBuildingBox::CBuildingBox(int id, int x, int y)
|
||||||
:BID(id)
|
:BID(id)
|
||||||
{
|
{
|
||||||
|
used = LCLICK | RCLICK | HOVER;
|
||||||
pos.x = x;
|
pos.x = x;
|
||||||
pos.y = y;
|
pos.y = y;
|
||||||
pos.w = 150;
|
pos.w = 150;
|
||||||
@@ -1797,16 +1791,6 @@ void CFortScreen::RecArea::clickLeft(tribool down, bool previousState)
|
|||||||
}
|
}
|
||||||
//ClickableL::clickLeft(down);
|
//ClickableL::clickLeft(down);
|
||||||
}
|
}
|
||||||
void CFortScreen::RecArea::activate()
|
|
||||||
{
|
|
||||||
activateLClick();
|
|
||||||
activateRClick();
|
|
||||||
}
|
|
||||||
void CFortScreen::RecArea::deactivate()
|
|
||||||
{
|
|
||||||
deactivateLClick();
|
|
||||||
deactivateRClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFortScreen::RecArea::clickRight(tribool down, bool previousState)
|
void CFortScreen::RecArea::clickRight(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
@@ -1933,20 +1917,6 @@ void CMageGuildScreen::Scroll::hover(bool on)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMageGuildScreen::Scroll::activate()
|
|
||||||
{
|
|
||||||
activateLClick();
|
|
||||||
activateRClick();
|
|
||||||
activateHover();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMageGuildScreen::Scroll::deactivate()
|
|
||||||
{
|
|
||||||
deactivateLClick();
|
|
||||||
deactivateRClick();
|
|
||||||
deactivateHover();
|
|
||||||
}
|
|
||||||
|
|
||||||
CBlacksmithDialog::CBlacksmithDialog(bool possible, int creMachineID, int aid, int hid)
|
CBlacksmithDialog::CBlacksmithDialog(bool possible, int creMachineID, int aid, int hid)
|
||||||
{
|
{
|
||||||
SDL_Surface *bg2 = BitmapHandler::loadBitmap("TPSMITH.bmp");
|
SDL_Surface *bg2 = BitmapHandler::loadBitmap("TPSMITH.bmp");
|
||||||
|
@@ -160,8 +160,6 @@ public:
|
|||||||
void clickLeft(tribool down, bool previousState);
|
void clickLeft(tribool down, bool previousState);
|
||||||
void clickRight(tribool down, bool previousState);
|
void clickRight(tribool down, bool previousState);
|
||||||
void show(SDL_Surface * to);
|
void show(SDL_Surface * to);
|
||||||
void activate();
|
|
||||||
void deactivate();
|
|
||||||
CBuildingBox(int id); //c-tor
|
CBuildingBox(int id); //c-tor
|
||||||
CBuildingBox(int id, int x, int y); //c-tor
|
CBuildingBox(int id, int x, int y); //c-tor
|
||||||
~CBuildingBox(); //d-tor
|
~CBuildingBox(); //d-tor
|
||||||
@@ -207,11 +205,9 @@ class CFortScreen : public CIntObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int bid;
|
int bid;
|
||||||
RecArea(int BID):bid(BID){}; //c-tor
|
RecArea(int BID):bid(BID){used = LCLICK | RCLICK;}; //c-tor
|
||||||
void clickLeft(tribool down, bool previousState);
|
void clickLeft(tribool down, bool previousState);
|
||||||
void clickRight(tribool down, bool previousState);
|
void clickRight(tribool down, bool previousState);
|
||||||
void activate();
|
|
||||||
void deactivate();
|
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
CMinorResDataBar * resdatabar;
|
CMinorResDataBar * resdatabar;
|
||||||
@@ -239,12 +235,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
CSpell *spell;
|
CSpell *spell;
|
||||||
|
|
||||||
Scroll(CSpell *Spell):spell(Spell){};
|
Scroll(CSpell *Spell):spell(Spell){used = LCLICK | RCLICK | HOVER;};
|
||||||
void clickLeft(tribool down, bool previousState);
|
void clickLeft(tribool down, bool previousState);
|
||||||
void clickRight(tribool down, bool previousState);
|
void clickRight(tribool down, bool previousState);
|
||||||
void hover(bool on);
|
void hover(bool on);
|
||||||
void activate();
|
|
||||||
void deactivate();
|
|
||||||
};
|
};
|
||||||
std::vector<std::vector<SDL_Rect> > positions;
|
std::vector<std::vector<SDL_Rect> > positions;
|
||||||
|
|
||||||
|
@@ -1124,6 +1124,28 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
|||||||
}
|
}
|
||||||
return std::pair<int,int>(-1,-1);
|
return std::pair<int,int>(-1,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void convertHordes(CGTownInstance * town)//converting hordes from -36..-30 to 18 & 24
|
||||||
|
{
|
||||||
|
for (int i = 0; i<CREATURES_PER_TOWN; i++)
|
||||||
|
if (vstd::contains(town->builtBuildings,(-31-i))) //if we have horde for this level
|
||||||
|
{
|
||||||
|
town->builtBuildings.erase(-31-i);//remove old ID
|
||||||
|
if (town->town->hordeLvl[0] == i)//if town first horde is this one
|
||||||
|
{
|
||||||
|
town->builtBuildings.insert(18);//add it
|
||||||
|
if (vstd::contains(town->builtBuildings,(37+i)))//if we have upgraded dwelling as well
|
||||||
|
town->builtBuildings.insert(19);//add it as well
|
||||||
|
}
|
||||||
|
if (town->town->hordeLvl[1] == i)//if town second horde is this one
|
||||||
|
{
|
||||||
|
town->builtBuildings.insert(24);//add it
|
||||||
|
if (vstd::contains(town->builtBuildings,(37+i)))//if we have upgraded dwelling as well
|
||||||
|
town->builtBuildings.insert(25);//add it as well
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CGameState::randomizeObject(CGObjectInstance *cur)
|
void CGameState::randomizeObject(CGObjectInstance *cur)
|
||||||
{
|
{
|
||||||
std::pair<int,int> ran = pickObject(cur);
|
std::pair<int,int> ran = pickObject(cur);
|
||||||
@@ -1138,6 +1160,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
t->defInfo = forts[t->subID];
|
t->defInfo = forts[t->subID];
|
||||||
else
|
else
|
||||||
t->defInfo = villages[t->subID];
|
t->defInfo = villages[t->subID];
|
||||||
|
convertHordes(t);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1164,6 +1187,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
t->defInfo = forts[t->subID];
|
t->defInfo = forts[t->subID];
|
||||||
else
|
else
|
||||||
t->defInfo = villages[t->subID];
|
t->defInfo = villages[t->subID];
|
||||||
|
convertHordes(t);
|
||||||
map->towns.push_back(t);
|
map->towns.push_back(t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
17
lib/map.cpp
17
lib/map.cpp
@@ -39,21 +39,8 @@ static std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID)
|
|||||||
ret.insert(mapa[*i]);
|
ret.insert(mapa[*i]);
|
||||||
else if(mapa[*i] >= (-CREATURES_PER_TOWN)) // horde buildings
|
else if(mapa[*i] >= (-CREATURES_PER_TOWN)) // horde buildings
|
||||||
{
|
{
|
||||||
int level = (-mapa[*i]);
|
int level = (mapa[*i]);
|
||||||
if(h3m.find(20+(level*3)) != h3m.end()) //upgraded creature horde building
|
ret.insert(level-30);//(-30)..(-36) - horde buildings (for game loading only), don't see other way to handle hordes in random towns
|
||||||
{
|
|
||||||
if(((castleID==1 && level==5) || (castleID==3 && level==3)))
|
|
||||||
ret.insert(25);
|
|
||||||
else
|
|
||||||
ret.insert(19);
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
if(((castleID==1 && level==5) || (castleID==3 && level==3)))
|
|
||||||
ret.insert(24);
|
|
||||||
else
|
|
||||||
ret.insert(18);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -2018,11 +2018,15 @@ bool CGameHandler::buildStructure( si32 tid, si32 bid )
|
|||||||
|
|
||||||
NewStructures ns;
|
NewStructures ns;
|
||||||
ns.tid = tid;
|
ns.tid = tid;
|
||||||
if(bid>36) //upg dwelling
|
if ( (bid == 18) && (vstd::contains(t->builtBuildings,(t->town->hordeLvl[0]+37))) )
|
||||||
|
ns.bid.insert(19);//we have upgr. dwelling, upgr. horde will be builded as well
|
||||||
|
else if ( (bid == 24) && (vstd::contains(t->builtBuildings,(t->town->hordeLvl[1]+37))) )
|
||||||
|
ns.bid.insert(25);
|
||||||
|
else if(bid>36) //upg dwelling
|
||||||
{
|
{
|
||||||
if(t->getHordeLevel(0) == (bid-37))
|
if ( (bid-37 == t->town->hordeLvl[0]) && (vstd::contains(t->builtBuildings,18)) )
|
||||||
ns.bid.insert(19);
|
ns.bid.insert(19);//we have horde, will be upgraded as well as dwelling
|
||||||
else if(t->getHordeLevel(1) == (bid-37))
|
if ( (bid-37 == t->town->hordeLvl[1]) && (vstd::contains(t->builtBuildings,24)) )
|
||||||
ns.bid.insert(25);
|
ns.bid.insert(25);
|
||||||
|
|
||||||
SetAvailableCreatures ssi;
|
SetAvailableCreatures ssi;
|
||||||
|
Reference in New Issue
Block a user