1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

Owned object in range of enemy heroes now break simturns

This commit is contained in:
Ivan Savenko 2024-05-19 20:03:24 +00:00
parent d5f32c27b0
commit e04c662bc9

View File

@ -17,6 +17,9 @@
#include "../CVCMIServer.h"
#include "../../lib/CPlayerState.h"
#include "../../lib/mapping/CMap.h"
#include "../../lib/mapObjects/CGObjectInstance.h"
#include "../../lib/gameState/CGameState.h"
#include "../../lib/pathfinder/CPathfinder.h"
#include "../../lib/pathfinder/PathfinderOptions.h"
@ -102,6 +105,18 @@ bool TurnOrderProcessor::playersInContact(PlayerColor left, PlayerColor right) c
const auto * leftInfo = gameHandler->getPlayerState(left, false);
const auto * rightInfo = gameHandler->getPlayerState(right, false);
for (auto obj : gameHandler->gameState()->map->objects)
{
if (obj && obj->isVisitable())
{
int3 pos = obj->visitablePos();
if (obj->tempOwner == left)
leftReachability[pos.z][pos.x][pos.y] = true;
if (obj->tempOwner == right)
rightReachability[pos.z][pos.x][pos.y] = true;
}
}
for(const auto & hero : leftInfo->heroes)
{
CPathsInfo out(mapSize, hero);