mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-23 22:40:07 +02:00
Merge pull request #4445 from IvanSavenko/fix_ranged_attack
Do not try to shoot at 2nd hex of wide creatures
This commit is contained in:
commit
ac717d57ea
@ -245,7 +245,7 @@ AttackPossibility AttackPossibility::evaluate(
|
|||||||
|
|
||||||
std::vector<BattleHex> defenderHex;
|
std::vector<BattleHex> defenderHex;
|
||||||
if(attackInfo.shooting)
|
if(attackInfo.shooting)
|
||||||
defenderHex = defender->getHexes();
|
defenderHex.push_back(defender->getPosition());
|
||||||
else
|
else
|
||||||
defenderHex = CStack::meleeAttackHexes(attacker, defender, hex);
|
defenderHex = CStack::meleeAttackHexes(attacker, defender, hex);
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@ LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
[[noreturn]] static void onTerminate()
|
[[noreturn]] static void onTerminate()
|
||||||
{
|
{
|
||||||
logGlobal->error("Disaster happened.");
|
logGlobal->error("Disaster happened.");
|
||||||
@ -205,6 +206,7 @@ LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
|
|||||||
#endif
|
#endif
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CConsoleHandler::setColor(EConsoleTextColor::EConsoleTextColor color)
|
void CConsoleHandler::setColor(EConsoleTextColor::EConsoleTextColor color)
|
||||||
{
|
{
|
||||||
@ -296,14 +298,14 @@ CConsoleHandler::CConsoleHandler():
|
|||||||
|
|
||||||
GetConsoleScreenBufferInfo(handleErr, &csbi);
|
GetConsoleScreenBufferInfo(handleErr, &csbi);
|
||||||
defErrColor = csbi.wAttributes;
|
defErrColor = csbi.wAttributes;
|
||||||
#ifndef _DEBUG
|
#ifdef NDEBUG
|
||||||
SetUnhandledExceptionFilter(onUnhandledException);
|
SetUnhandledExceptionFilter(onUnhandledException);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
defColor = "\x1b[0m";
|
defColor = "\x1b[0m";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _DEBUG
|
#ifdef NDEBUG
|
||||||
std::set_terminate(onTerminate);
|
std::set_terminate(onTerminate);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,9 @@ bool CBattleInfoCallback::battleIsInsideWalls(BattleHex from) const
|
|||||||
|
|
||||||
bool CBattleInfoCallback::battleHasPenaltyOnLine(BattleHex from, BattleHex dest, bool checkWall, bool checkMoat) const
|
bool CBattleInfoCallback::battleHasPenaltyOnLine(BattleHex from, BattleHex dest, bool checkWall, bool checkMoat) const
|
||||||
{
|
{
|
||||||
|
if (!from.isAvailable() || !dest.isAvailable())
|
||||||
|
throw std::runtime_error("Invalid hex (" + std::to_string(from.hex) + " and " + std::to_string(dest.hex) + ") received in battleHasPenaltyOnLine!" );
|
||||||
|
|
||||||
auto isTileBlocked = [&](BattleHex tile)
|
auto isTileBlocked = [&](BattleHex tile)
|
||||||
{
|
{
|
||||||
EWallPart wallPart = battleHexToWallPart(tile);
|
EWallPart wallPart = battleHexToWallPart(tile);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user