Skip to content

Commit 48e7f51

Browse files
FlamefireFlow86
authored andcommitted
Add TODOs for Replay breaking enhancements
The point can be considered invalid if it is too far and the attacker would abort on the next event handling. Defenders with now missing attackers will still come out of the building and go right back in which looks weird.
1 parent 4c7ed68 commit 48e7f51

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

libs/s25main/buildings/nobBaseMilitary.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,16 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const
173173
const bool capturing =
174174
BuildingProperties::IsMilitary(bldType_) && static_cast<nobMilitary*>(this)->IsBeingCaptured();
175175

176-
// Also check if we can reach this.
177-
// If not, still consider the other points as the flag could become reachable by then.
178-
if(!capturing && world->IsValidPointForFighting(flagPos, soldier, false)
179-
&& (soldierPos == flagPos || world->FindHumanPath(soldierPos, flagPos) != boost::none))
176+
if(!capturing && world->IsValidPointForFighting(flagPos, soldier, false))
180177
{
181-
ret_radius = 0;
182-
return flagPos;
178+
// Also check if we can reach this.
179+
// If not, still consider the other points as the flag could become reachable by then.
180+
// TODO(Replay) Limit distance by MAX_ATTACKING_RUN_DISTANCE
181+
if(soldierPos == flagPos || world->FindHumanPath(soldierPos, flagPos) != boost::none)
182+
{
183+
ret_radius = 0;
184+
return flagPos;
185+
}
183186
}
184187

185188
// Check all points around the flag and take shortest
@@ -204,6 +207,7 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const
204207

205208
unsigned length = 0;
206209
// Is there a path at all?
210+
// TODO(Replay) Limit distance by MAX_ATTACKING_RUN_DISTANCE instead of 100
207211
if(world->FindHumanPath(soldierPos, node.first, 100, false, &length))
208212
{
209213
// Take if shorter

libs/s25main/figures/nofAggressiveDefender.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ void nofAggressiveDefender::AttackerLost()
248248
{
249249
RTTR_Assert(attacker);
250250
attacker = nullptr;
251+
// TODO(Replay) When still in leave queue abort to avoid going out and right back
251252
}
252253

253254
void nofAggressiveDefender::NeedForHomeDefence()

0 commit comments

Comments
 (0)