Skip to content

fix(Core/Movement): Remove duplicate functions PathEndReached - #27121

Open
PkllonG wants to merge 4 commits into
azerothcore:masterfrom
PkllonG:Remove-PathEndReached
Open

fix(Core/Movement): Remove duplicate functions PathEndReached#27121
PkllonG wants to merge 4 commits into
azerothcore:masterfrom
PkllonG:Remove-PathEndReached

Conversation

@PkllonG

@PkllonG PkllonG commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Changes Proposed:

This PR proposes changes to:

  • Core (units, players, creatures, game systems).
  • Scripts (bosses, spell scripts, creature scripts).
  • Database (SAI, creatures, etc).

AI-assisted Pull Requests

Important

Using AI tools to prepare pull requests is allowed, but it must be disclosed and it must follow our AC guidelines for AI Agentic Engineering (link below).

You are expected to fully understand the changes you submit and to be able to explain and justify them when maintainers ask.

  • AI tools (e.g. Claude, ChatGPT, or similar) were used entirely or partially to prepare this pull request. If checked, specify which tools and models below.
    • Tools/models used:
  • I have read and understood the AC guidelines for AI Agentic Engineering

Issues Addressed:

  • Closes

SOURCE:

The changes have been validated through:

  • Live research (checked on live servers, e.g Classic WotLK, Retail, etc.)
  • Sniffs (remember to share them with the open source community!)
  • Video evidence, knowledge databases or other public sources (e.g forums, Wowhead, etc.)
  • The changes promoted by this pull request come partially or entirely from another project (cherry-pick). Cherry-picks must be committed using the proper --author tag in order to be accepted, thus crediting the original authors, unless otherwise unable to be found

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

How to Test the Changes:

  • This pull request can be tested by following the reproduction steps provided in the linked issue
  • This pull request requires further testing. Provide steps to test your changes. If it requires any specific setup e.g multiple players please specify it as well.

Known Issues and TODO List:

  • [ ]
  • [ ]

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

@github-actions github-actions Bot added CORE Related to the core Script Refers to C++ Scripts for the Core file-cpp Used to trigger the matrix build labels Aug 13, 2026
@PkllonG PkllonG changed the title Delete PathEndReached fix(Core/Movement): Remove duplicate functions PathEndReached Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The obsolete PathEndReached callback was removed from AI and waypoint movement declarations and completion handling. SmartAI now processes waypoint-ended events and path unloading within WaypointReached. Script movement handlers were migrated to WaypointPathEnded(uint32 nodeId, uint32 pathId) without changing their existing path-specific behavior.

Mergeability Score: 🟡 Moderate · up to e4b0b

Waypoint-driven behavior may trigger completion handling too early and possibly trigger it again when the path actually ends, causing incorrect AI reactions or path state. The PR is not merge-ready until path-end processing occurs only in the path-completion callback.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: 46f1f6ad-fe58-4dbb-8cd6-064e326c47e8

📥 Commits

Reviewing files that changed from the base of the PR and between 9ad2424 and e4b0b42.

📒 Files selected for processing (18)
  • src/server/game/AI/CreatureAI.h
  • src/server/game/AI/SmartScripts/SmartAI.cpp
  • src/server/game/AI/SmartScripts/SmartAI.h
  • src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
  • src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp
  • src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
  • src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
  • src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
  • src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp
  • src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp
  • src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
  • src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
  • src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
  • src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
  • src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp
  • src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
  • src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
  • src/server/scripts/Outland/zone_shadowmoon_valley.cpp
💤 Files with no reviewable changes (3)
  • src/server/game/AI/CreatureAI.h
  • src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
  • src/server/game/AI/SmartScripts/SmartAI.h

Comment on lines +1342 to +1343
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, 0, me->GetWaypointPath());
me->LoadPath(0);

@coderabbitai coderabbitai Bot Aug 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
rg -n -A35 -B10 \
  'WaypointReached|WaypointPathEnded|pathEnded|LoadPath\(0\)' \
  src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp \
  src/server/game/AI/SmartScripts/SmartAI.cpp

Repository: azerothcore/azerothcore-wotlk

Length of output: 23972


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- changed SmartAI diff ---'
git diff -- src/server/game/AI/SmartScripts/SmartAI.cpp

printf '%s\n' '--- callback declarations and implementations ---'
rg -n -A12 -B8 \
  'WaypointPathEnded|WaypointReached|LoadPath\(uint32|LoadPath\(0\)|SMART_EVENT_WAYPOINT_ENDED|SMART_EVENT_WAYPOINT_REACHED' \
  src/server/game/AI src/server/game/Entities src/server/game/Movement

printf '%s\n' '--- relevant current source ---'
sed -n '1315,1365p' src/server/game/AI/SmartScripts/SmartAI.cpp
sed -n '125,205p' src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp

Repository: azerothcore/azerothcore-wotlk

Length of output: 46034


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- checkout state ---'
git status --short
git log -1 --oneline

printf '%s\n' '--- parent implementation ---'
git show HEAD^:src/server/game/AI/SmartScripts/SmartAI.cpp | sed -n '1328,1362p'
git show HEAD^:src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp | sed -n '135,202p'

printf '%s\n' '--- all Creature::LoadPath(0) callers ---'
rg -n -B8 -A8 'me->LoadPath\(0\)|LoadPath\(0\)' src

printf '%s\n' '--- event filter and path state ---'
sed -n '5018,5036p' src/server/game/AI/SmartScripts/SmartScript.cpp
sed -n '350,366p' src/server/game/Entities/Creature/Creature.h

Repository: azerothcore/azerothcore-wotlk

Length of output: 9425


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- merge commit parents ---'
git show -s --format='%H%n%P%n%B' HEAD

printf '%s\n' '--- file diff against first parent ---'
git diff --stat HEAD^1 HEAD -- src/server/game/AI/SmartScripts/SmartAI.cpp src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
git diff HEAD^1 HEAD -- src/server/game/AI/SmartScripts/SmartAI.cpp src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp

printf '%s\n' '--- file diff against second parent ---'
git diff --stat HEAD^2 HEAD -- src/server/game/AI/SmartScripts/SmartAI.cpp src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
git diff HEAD^2 HEAD -- src/server/game/AI/SmartScripts/SmartAI.cpp src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp

printf '%s\n' '--- combined diff for the target method ---'
git diff --cc HEAD -- src/server/game/AI/SmartScripts/SmartAI.cpp

Repository: azerothcore/azerothcore-wotlk

Length of output: 3153


Move path-end processing to WaypointPathEnded. WaypointReached runs for every waypoint, so these lines dispatch SMART_EVENT_WAYPOINT_ENDED and clear Creature::m_path_id before the path ends; the final callback can dispatch the event again. Remove both lines from WaypointReached and process the event and path reset once in WaypointPathEnded.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need help here, should I keep it like this or is there another way?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PkllonG Do not keep these lines in WaypointReached; that callback runs at every waypoint. Move both lines to WaypointPathEnded, before its return, so SMART_EVENT_WAYPOINT_ENDED dispatches once when the path ends and me->LoadPath(0) clears the completed path once.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No errors were found after testing, like .go c 139275

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PkllonG, the test result is useful, but it does not validate the callback timing. WaypointReached still runs at every node, so SMART_EVENT_WAYPOINT_ENDED and me->LoadPath(0) must remain in WaypointPathEnded to run once at path completion.

You are interacting with an AI system.

Comment thread src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE Related to the core file-cpp Used to trigger the matrix build Script Refers to C++ Scripts for the Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant