unify(pathfinder): Merge AIPathfind and update dependencies#2341
unify(pathfinder): Merge AIPathfind and update dependencies#2341Mauller wants to merge 4 commits intoTheSuperHackers:mainfrom
Conversation
60286bd to
e20892a
Compare
|
e20892a to
180cc40
Compare
|
Had to fix a small dependency that i missed when building debug in generals |
| { | ||
| #if RTS_GENERALS | ||
| DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); | ||
| #else |
There was a problem hiding this comment.
If m_info is not initialized, this crashes in Generals when m_info->m_pos.x is called.
Therefore the 1.01 patch can be ported to Generals. Game would have crashed at this point anyways, so it will not mismatch.
There was a problem hiding this comment.
Perhaps just take Zero Hour code for both games?
| return; | ||
| } | ||
| } | ||
| #endif |
There was a problem hiding this comment.
I think this can be simplified to:
if (!ai->isDoingGroundMovement())
{
#if RTS_GENERALS
Bool isUnmannedHelicopter = false;
#else
// exception:sniped choppers are on ground
Bool isUnmannedHelicopter = ( obj->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) && obj->isDisabledByType( DISABLED_UNMANNED ) ) ;
#endif
if ( ! isUnmannedHelicopter )
{
updateAircraftGoal(obj, newGoalPos);
return;
}
}| } | ||
| #endif | ||
| #if RTS_GENERALS | ||
| m_needToCalculateZones = false; |
| #else | ||
| m_zoneManager.updateZonesForModify(m_map, m_layers, cellBounds, m_extent); | ||
|
|
||
| Int i, j; |
|
updated based on feedback |
75d3750 to
35a0d0a
Compare
35a0d0a to
dc18e3d
Compare
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h
Line: 659
Comment:
typo: `onlyk` should be `only`
```suggestion
Bool clientSafeQuickDoesPathExistForUI( const LocomotorSet& locomotorSet, const Coord3D *from, const Coord3D *to ); ///< Can we build any path at all between the locations (terrain only - fast)
```
How can I resolve this? If you propose a fix, please make it concise. |
dc18e3d to
87f4e50
Compare
|
Is this meant to be Merged with Rebase? The title says "Sanitize" and "Merge" which implies 2 distinct steps and commits. |
| { | ||
| #if RTS_GENERALS | ||
| DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); | ||
| #else |
There was a problem hiding this comment.
Perhaps just take Zero Hour code for both games?
It can be squash merged, the title can be changed, i just considered it a bit of a sanitising as well due to the fixing of a fair bit of formatting from refactored zero hour code. I split it into commits to make it easier to review changes |
83c85c8 to
da9b94b
Compare
da9b94b to
6ca4994
Compare
|
I do prefer committing small reviewable chunks to main branch. Makes it also easier to test later if something breaks. I think reviewability can be improved by doing merge in steps if some code has changed in more than one way. For example, if variables were renamed, formatting was changed, and code was added and removed, then edit these things in 3 separate commits. This will make the diffs much cleaner. |
well the biggest changes are due to pathfind zone manager, i could make a seperate PR just to cleanup the mess in that first before other unification and changes. |
6ca4994 to
55be278
Compare
55be278 to
7b3588d
Compare
xezon
left a comment
There was a problem hiding this comment.
This change looks risky.
Do Generals 1.08 Replays pass without mismatching? I think some Generals replays will already fail before this change because we do not test and fix it much.
I am skeptical of the use of #if RTS_ZEROHOUR instead of #if !RTS_GENERALS.
Some #if block are difficult to read and maintain when constructed like so:
if (...)
{
}
#if
else
{
...
}
#else
else
{
...
}
#endifConsider a cleaner separation of #if blocks with no sneaky branch carry overs.
The commits would be better organized as logical units, as opposed to fixed regions of the code. Do we need so many individual commits? Do all commits compile in succession?
I think i need to make one or two tweaks but they should compile and work when compiled in sequence. I considered doing this as individual commits in case something did mismatch and it could be tracked back. But it can always be merged as a single commit if i just make sure any possible blocks that could mismatch are kept for generals |
4e96c02 to
cdb1b68
Compare
|
Updated with the last of the Mergers needed for the Pathfinder |
…nd Pathfinder::clientSafeQuickDoesPathExistForUI() from Zero Hour (#2341)
cdb1b68 to
b1e0c04
Compare
…hfindQueue(), ::examineNeighboringCells(), ::buildHierarchicalPath() (#2341)
…:processHierarchicalCell, ::findClosestPath, ::updateGoal (#2341)
…ttackPath from Zero Hour (#2341)
b1e0c04 to
3fdd461
Compare
I grabbed a Dozen more replays from GameReplays for Generals to test this, they all ran fine. |


Merge by rebase
This PR merges the remainder of Aipathfind.h and Aipathfind.cpp
I split the original version of this unification into seperate PR's to make the merging easier, this now deals with the remaining parts of the merger.
The following functions are merged here:
Pathfinder::clientSafeQuickDoesPathExist <- A Safe reordering adds an earlier escape for generals
Pathfinder::clientSafeQuickDoesPathExistForUI <- Entirely new from Zero Hour
These two also required code changes at call sites in generals due to the change of function name
Pathfinder::checkForPossible
Pathfinder::processPathfindQueue
Pathfinder::examineNeighboringCells
Pathfinder::buildHierarchicalPath
Pathfinder::moveAlliesDestinationCallback
Pathfinder::processHierarchicalCell <- Generals gains a m_info Null check which would prevent a crash
Pathfinder::findClosestPath
Pathfinder::updateGoal <- Some formatting cleanup on the Zero Hour side when merging
Pathfinder::moveAllies
Pathfinder::findAttackPath