forked from 0ad/0ad
Delay a distance computation in UnitMotion.
Minor optimisation to computing a point goal. Differential Revision: https://code.wildfiregames.com/D5035 This was SVN commit r27700.
This commit is contained in:
parent
61e932a890
commit
64efa0acf9
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2022 Wildfire Games.
|
/* Copyright (C) 2023 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@ -101,7 +101,6 @@ constexpr u8 KNOWN_IMPERFECT_PATH_RESET_COUNTDOWN = 12;
|
|||||||
* However, too high means units will look idle for a long time when they are failing to move.
|
* However, too high means units will look idle for a long time when they are failing to move.
|
||||||
* TODO: if UnitMotion could send differentiated "unreachable" and "currently stuck" failing messages,
|
* TODO: if UnitMotion could send differentiated "unreachable" and "currently stuck" failing messages,
|
||||||
* this could probably be lowered.
|
* this could probably be lowered.
|
||||||
* TODO: when unit pushing is implemented, this number can probably be lowered.
|
|
||||||
*/
|
*/
|
||||||
constexpr u8 MAX_FAILED_MOVEMENTS = 35;
|
constexpr u8 MAX_FAILED_MOVEMENTS = 35;
|
||||||
|
|
||||||
@ -1658,8 +1657,6 @@ bool CCmpUnitMotion::ComputeGoal(PathGoal& out, const MoveRequest& moveRequest)
|
|||||||
CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSystemEntity());
|
CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSystemEntity());
|
||||||
ENSURE(cmpObstructionManager);
|
ENSURE(cmpObstructionManager);
|
||||||
|
|
||||||
entity_pos_t distance = cmpObstructionManager->DistanceBetweenShapes(obstruction, targetObstruction);
|
|
||||||
|
|
||||||
out.x = targetObstruction.x;
|
out.x = targetObstruction.x;
|
||||||
out.z = targetObstruction.z;
|
out.z = targetObstruction.z;
|
||||||
out.hw = targetObstruction.hw;
|
out.hw = targetObstruction.hw;
|
||||||
@ -1676,6 +1673,8 @@ bool CCmpUnitMotion::ComputeGoal(PathGoal& out, const MoveRequest& moveRequest)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entity_pos_t distance = cmpObstructionManager->DistanceBetweenShapes(obstruction, targetObstruction);
|
||||||
|
|
||||||
entity_pos_t circleRadius = CFixedVector2D(targetObstruction.hw, targetObstruction.hh).Length();
|
entity_pos_t circleRadius = CFixedVector2D(targetObstruction.hw, targetObstruction.hh).Length();
|
||||||
|
|
||||||
// TODO: because we cannot move to rounded rectangles, we have to make conservative approximations.
|
// TODO: because we cannot move to rounded rectangles, we have to make conservative approximations.
|
||||||
|
Loading…
Reference in New Issue
Block a user