mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
parent
adf3c9fd4b
commit
8f217c5cdf
@ -126,11 +126,15 @@ void AdventureMapButton::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(blocked)
|
||||
return;
|
||||
if (down) {
|
||||
|
||||
if (down)
|
||||
{
|
||||
CGI->soundh->playSound(soundBase::button);
|
||||
state=1;
|
||||
} else
|
||||
}
|
||||
else
|
||||
state=0;
|
||||
|
||||
show(screenBuf);
|
||||
if (actOnDown && down)
|
||||
{
|
||||
@ -201,25 +205,6 @@ void AdventureMapButton::hover (bool on)
|
||||
}
|
||||
}
|
||||
|
||||
//void AdventureMapButton::activate()
|
||||
//{
|
||||
//// if (active) return;
|
||||
//// active=true;
|
||||
// activateLClick();
|
||||
// activateRClick();
|
||||
// activateHover();
|
||||
// activateKeys();
|
||||
//}
|
||||
//void AdventureMapButton::deactivate()
|
||||
//{
|
||||
//// if (!active) return;
|
||||
//// active=false;
|
||||
// deactivateLClick();
|
||||
// deactivateRClick();
|
||||
// deactivateHover();
|
||||
// deactivateKeys();
|
||||
//}
|
||||
|
||||
void AdventureMapButton::init(const CFunctionList<void()> &Callback, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key)
|
||||
{
|
||||
used = LCLICK | RCLICK | HOVER | KEYBOARD;
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <sstream>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#undef min;
|
||||
|
||||
/*
|
||||
* CHeroWindow.cpp, part of VCMI engine
|
||||
*
|
||||
@ -219,7 +221,7 @@ void CHeroWindow::setHero(const CGHeroInstance *hero)
|
||||
}
|
||||
|
||||
//secondary skills support
|
||||
for(size_t g=0; g<hero->secSkills.size(); ++g)
|
||||
for(size_t g=0; g<std::min(secSkillAreas.size(),hero->secSkills.size()); ++g)
|
||||
{
|
||||
int skill = hero->secSkills[g].first,
|
||||
level = hero->secSkills[g].second;
|
||||
@ -317,7 +319,7 @@ void CHeroWindow::activate()
|
||||
{
|
||||
primSkillAreas[v]->activate();
|
||||
}
|
||||
for(size_t v=0; v<curHero->secSkills.size(); ++v)
|
||||
for(size_t v=0; v<std::min(secSkillAreas.size(), curHero->secSkills.size()); ++v)
|
||||
{
|
||||
secSkillAreas[v]->activate();
|
||||
}
|
||||
@ -351,7 +353,7 @@ void CHeroWindow::deactivate()
|
||||
{
|
||||
primSkillAreas[v]->deactivate();
|
||||
}
|
||||
for(size_t v=0; v<curHero->secSkills.size(); ++v)
|
||||
for(size_t v=0; v<std::min(secSkillAreas.size(), curHero->secSkills.size()); ++v)
|
||||
{
|
||||
secSkillAreas[v]->deactivate();
|
||||
}
|
||||
|
@ -1250,6 +1250,8 @@ void CPlayerInterface::tileRevealed(const std::set<int3> &pos)
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
for(std::set<int3>::const_iterator i=pos.begin(); i!=pos.end();i++)
|
||||
adventureInt->minimap.showTile(*i);
|
||||
if(pos.size())
|
||||
GH.totalRedraw();
|
||||
}
|
||||
|
||||
void CPlayerInterface::tileHidden(const std::set<int3> &pos)
|
||||
|
@ -602,7 +602,7 @@ public:
|
||||
void initObj();
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this) & static_cast<CPlayersVisited&>(*this);;
|
||||
h & static_cast<CPlayersVisited&>(*this);
|
||||
h & allowedAbilities & ability;
|
||||
}
|
||||
};
|
||||
@ -702,7 +702,7 @@ public:
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this) & static_cast<CPlayersVisited&>(*this);;
|
||||
h & static_cast<CPlayersVisited&>(*this);;
|
||||
h & spell;
|
||||
}
|
||||
};
|
||||
@ -904,7 +904,7 @@ public:
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this) & static_cast<CPlayersVisited&>(*this);;
|
||||
h & static_cast<CPlayersVisited&>(*this);;
|
||||
h & bonusType & bonusVal;
|
||||
}
|
||||
};
|
||||
|
@ -2954,7 +2954,7 @@ void BattleInfo::getStackQueue( std::vector<const CStack *> &out, int howMany, i
|
||||
const CStack * const s = stacks[i];
|
||||
if(turn <= 0 && !s->willMove() //we are considering current round and stack won't move
|
||||
|| turn > 0 && !s->canMove(turn) //stack won't be able to move in later rounds
|
||||
|| turn <= 0 && s == active) //it's active stack already added at the beginning of queue
|
||||
|| turn <= 0 && s == active && out.size() && s == out.front()) //it's active stack already added at the beginning of queue
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -657,7 +657,6 @@ DLL_EXPORT void BattleSetActiveStack::applyGs( CGameState *gs )
|
||||
{
|
||||
gs->curB->activeStack = stack;
|
||||
CStack *st = gs->curB->getStack(stack);
|
||||
st->state -= WAITING; //if stack was waiting it'll now make move, so it won't be "waiting" anymore
|
||||
if(vstd::contains(st->state,MOVED)) //if stack is moving second time this turn it must had a high morale bonus
|
||||
st->state.insert(HAD_MORALE);
|
||||
}
|
||||
@ -743,11 +742,13 @@ DLL_EXPORT void StartAction::applyGs( CGameState *gs )
|
||||
break;
|
||||
case 8:
|
||||
st->state.insert(WAITING);
|
||||
break;
|
||||
return;
|
||||
case 2: case 6: case 7: case 9: case 10: case 11:
|
||||
st->state.insert(MOVED);
|
||||
break;
|
||||
}
|
||||
|
||||
st->state -= WAITING; //if stack was waiting it has made move, so it won't be "waiting" anymore (if the action was WAIT, then we have returned)
|
||||
}
|
||||
|
||||
DLL_EXPORT void SpellCast::applyGs( CGameState *gs )
|
||||
|
@ -2384,7 +2384,7 @@ bool CGameHandler::buyArtifact( ui32 hid, si32 aid )
|
||||
if(vstd::contains(hero->artifWorn,ui16(9+aid)) && complain("Hero already has this machine!")
|
||||
|| !vstd::contains(town->builtBuildings,si32(16)) && complain("No blackismith!")
|
||||
|| gs->getPlayer(hero->getOwner())->resources[6] < price && complain("Not enough gold!") //no gold
|
||||
|| town->town->warMachine!= aid && complain("This machine is unavailale here!") ) //TODO: ballista yard in Stronghold
|
||||
|| town->town->warMachine!= aid && complain("This machine is unavailable here!") ) //TODO: ballista yard in Stronghold
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user