1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- Fixed a scenario when AI could visit the town without picking troops, resulting in a lock

- Added ench0's patch for creature range tooltip (#948)
This commit is contained in:
DjWarmonger 2012-05-22 10:15:16 +00:00
parent 401d6816d1
commit 18e53a1717
3 changed files with 25 additions and 4 deletions

View File

@ -1031,7 +1031,11 @@ void VCAI::performObjectInteraction(const CGObjectInstance * obj, const CGHeroIn
switch (obj->ID)
{
case Obj::CREATURE_GENERATOR1:
recruitCreatures(dynamic_cast<const CGDwelling *>(obj));
recruitCreatures (dynamic_cast<const CGDwelling *>(obj));
break;
case GameConstants::TOWNI_TYPE:
moveCreaturesToHero (dynamic_cast<const CGTownInstance *>(obj));
break;
break;
}
}

View File

@ -632,6 +632,25 @@ void CBattleInterface::show(SDL_Surface * to)
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, to, &temp_rect);
}
}
//patch by ench0
const CStack * const shere = curInt->cb->battleGetStackByPos(b, false);
// display the movement shadow of the stack at b (i.e. stack under mouse)
if(shere && shere->alive())
{
// activeStack == NULL means it is opponent's turn...
if (activeStack && shere != activeStack)
{
std::vector<BattleHex> v = curInt->cb->battleGetAvailableHexes(shere, true );
BOOST_FOREACH (BattleHex hex, v)
{
int x = 14 + ((hex / GameConstants::BFIELD_WIDTH ) % 2 == 0 ? 22 : 0) + 44 * (hex % GameConstants::BFIELD_WIDTH) + pos.x;
int y = 86 + 42 * (hex / GameConstants::BFIELD_WIDTH) + pos.y;
SDL_Rect temp_rect = genRect (cellShade->h, cellShade->w, x, y);
CSDL_Ext::blit8bppAlphaTo24bpp (cellShade, NULL, to, &temp_rect);
}
}
}
//always highlight pointed hex
int x = 14 + ((b/GameConstants::BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(b%GameConstants::BFIELD_WIDTH) + pos.x;
int y = 86 + 42 * (b/GameConstants::BFIELD_WIDTH) + pos.y;

View File

@ -396,9 +396,7 @@ BattleHex BattleInfo::getClosestTile (bool attackerOwned, int initialPos, std::s
auto notClosest = [closestDistance, initialPos](const BattleHex here) -> bool
{
int debug = here.getDistance (initialPos, here);
bool debug2 = closestDistance < debug;
return debug2;
return closestDistance < here.getDistance (initialPos, here);
};
sortedTiles.erase (boost::remove_if (sortedTiles, notClosest), sortedTiles.end()); //only closest tiles are interesting