chore(pathfinder): Cleanup formatting and fix an incomplete optimization in PathfindZoneManager:calculateZones()#2360
Conversation
| m_groundRubbleZones[i] = i; | ||
| m_terrainZones[i] = i; | ||
| m_crusherZones[i] = i; | ||
| m_hierarchicalZones[i] = i; |
There was a problem hiding this comment.
Note - This change is how it was implemented in generals, it makes comparissons in winmerge easier and is far cleaner than the refactor zero hour introduced
| } | ||
| for (i=1; i<m_maxZone; i++) { | ||
| Int zone = m_hierarchicalZones[i]; | ||
| m_hierarchicalZones[i] = m_hierarchicalZones[zone]; |
There was a problem hiding this comment.
Note - This change is how it was implemented in generals, minus the comment being removed. I left the zero hour comment above the for loop instead to keep the code block clearer.
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp | Formatting cleanup (tabs, for loops, K&R braces) and logic fix to add missing notTerrainOrCrusher check for top cell comparisons |
Last reviewed commit: 2b8e7fd
| applyZone(r_thisCell, r_topCell, m_groundRubbleZones, m_maxZone); | ||
| else if (groundCliff(r_thisCell, r_topCell)) | ||
| applyZone(r_thisCell, r_topCell, m_groundCliffZones, m_maxZone); | ||
| } |
There was a problem hiding this comment.
Note - This change is why the PR wants to be merged by rebase. It will make the dif cleaner in the unification PR as well.
This is a small optimisation overall and wants to be seperate in case we needed to revert it.
| m_hierarchicalZones[i] = i; | ||
| } | ||
|
|
||
| REGISTER UnsignedInt maxZone = m_maxZone; |
There was a problem hiding this comment.
Note - This was removed to make the code more in line with the generals implementation. Helping make the Diff clearer in the unification.
The register keyword is also deprecated in c++17 and beyond and using the class variable is of no issue. There should be little to no performance difference.
71e94a9 to
1910557
Compare
…oneManager:calculateZones() (#2360)
…Manager::calculateZones() (#2360)
…ager::calculateZones() (#2360)
…irectly in PathfindZoneManager::calculateZones() (#2360)
… in PathfindZoneManager::calculateZones() (#2360)
1910557 to
2b8e7fd
Compare
…oneManager:calculateZones() (#2360)
…Manager::calculateZones() (#2360)
…ager::calculateZones() (#2360)
…irectly in PathfindZoneManager::calculateZones() (#2360)
…oneManager:calculateZones() (TheSuperHackers#2360)
…Manager::calculateZones() (TheSuperHackers#2360)
…ager::calculateZones() (TheSuperHackers#2360)
…irectly in PathfindZoneManager::calculateZones() (TheSuperHackers#2360)
… in PathfindZoneManager::calculateZones() (TheSuperHackers#2360)
… in PathfindZoneManager::calculateZones() (TheSuperHackers#2360) fix(logic): Validate playerindex for retaliation
merge by rebase
This PR is split out from the AiPathfind unification PR to reduce the difference in the merge between Generals and Zero Hours AiPathfind.cpp files.
It also contains a fix for an optimization that was missed in the zero hour code, this fix does not cause any mismatching and is why this PR should be merged by rebase.
There was extensive changes made to
PathfindZoneManager:calculateZones()which introduced a large number of formatting differences relative to the rest of the code.This PR more closely aligns Zero Hours PathfindZoneManager:calculateZones() with Generals implementation by doing the following: