Skip to content

Commit

Permalink
Fixed discover-threat-issue
Browse files Browse the repository at this point in the history
When determining the likelyness of being discovered on a certain tile the AI looked at the potential paths their enemies could go from the locations they were assumed to be. However, the pathfinding that did this could sometimes fail due to the units actual position being in the way of the unit's assumed position and the unit not wanting to walk through itself.
This is fixed now. What this actually fixes is that AI units sometimes were very reckless and exposing themselves to be found by the player when they shouldn't. This was especally prevalent in narrow areas.
  • Loading branch information
Xilmi committed Oct 26, 2024
1 parent 372726f commit 065f997
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Battlescape/AIModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3938,7 +3938,7 @@ void AIModule::brutalThink(BattleAction* action)
//{
// tile->setMarkerColor(_unit->getId()%100);
// tile->setPreview(10);
// tile->setTUMarker(_save->getTileEngine()->isNextToDoor(tile));
// tile->setTUMarker(discoverThreat);
//}
}
if (_traceAI)
Expand Down
4 changes: 2 additions & 2 deletions src/Battlescape/Pathfinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ bool Pathfinding::isBlocked(const BattleUnit *unit, const Tile *tile, const int
}
if (part == O_FLOOR)
{
if (tile->getUnit())
if (tile->getUnit() && !_ignoreFriends)
{
BattleUnit *u = tile->getUnit();
if (u == unit || u == missileTarget || u->isOut())
Expand All @@ -872,7 +872,7 @@ bool Pathfinding::isBlocked(const BattleUnit *unit, const Tile *tile, const int
{
if (unit->getFaction() == FACTION_PLAYER && u->getVisible())
return true; // player know all visible units
if (unit->getFaction() == u->getFaction() && !_ignoreFriends)
if (unit->getFaction() == u->getFaction())
return true;
if (unit->getFaction() != FACTION_PLAYER &&
std::find(unit->getUnitsSpottedThisTurn().begin(), unit->getUnitsSpottedThisTurn().end(), u) != unit->getUnitsSpottedThisTurn().end())
Expand Down

0 comments on commit 065f997

Please sign in to comment.