mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +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:
parent
401d6816d1
commit
18e53a1717
@ -1033,6 +1033,10 @@ void VCAI::performObjectInteraction(const CGObjectInstance * obj, const CGHeroIn
|
||||
case Obj::CREATURE_GENERATOR1:
|
||||
recruitCreatures (dynamic_cast<const CGDwelling *>(obj));
|
||||
break;
|
||||
case GameConstants::TOWNI_TYPE:
|
||||
moveCreaturesToHero (dynamic_cast<const CGTownInstance *>(obj));
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user