1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

completed calls of functions during stack's move

This commit is contained in:
mateuszb
2008-03-24 19:04:30 +00:00
parent 500f55cd52
commit 137f62798b
4 changed files with 36 additions and 7 deletions

View File

@@ -81,6 +81,7 @@ CBattleInterface::CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, C
int y = 86 + 42 * (h/17);
bfield[h].pos = genRect(cellShade->h, cellShade->w, x, y);
bfield[h].accesible = true;
bfield[h].myInterface = this;
}
//locking occupied positions on batlefield
for(std::map<int, CStack>::iterator it = stacks.begin(); it!=stacks.end(); ++it) //stacks gained at top of this function
@@ -287,9 +288,15 @@ void CBattleInterface::stackMoved(int number, int destHex)
{
}
void CBattleInterface::hexLclicked(int whichOne)
{
if((whichOne%17)!=0 && (whichOne%17)!=16)
LOCPLINT->cb->battleMoveCreature(activeStack, whichOne);
}
void CBattleInterface::showRange(SDL_Surface * to, int initialPlace, int radius)
{
int * dists = new int[187]; //calculated distances
int dists[187]; //calculated distances
std::queue<int> hexq; //bfs queue
hexq.push(initialPlace);
for(int g=0; g<187; ++g)
@@ -446,7 +453,7 @@ void CBattleHex::hover(bool on)
Hoverable::hover(on);
}
CBattleHex::CBattleHex() : myNumber(-1), accesible(true), hovered(false), strictHovered(false)
CBattleHex::CBattleHex() : myNumber(-1), accesible(true), hovered(false), strictHovered(false), myInterface(NULL)
{
}
@@ -467,4 +474,8 @@ void CBattleHex::mouseMoved(SDL_MouseMotionEvent &sEvent)
void CBattleHex::clickLeft(boost::logic::tribool down)
{
if(!down && hovered && strictHovered) //we've been really clicked!
{
myInterface->hexLclicked(myNumber);
}
}