Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix reversed plan in GOAP #14

Merged
merged 1 commit into from
May 8, 2024
Merged

Conversation

thatslifebro
Copy link

@thatslifebro thatslifebro commented May 8, 2024

Actual Behavior

By using an std::queue for the plan, it ends up being reversed.

Desired Behavior

By using an std::stack instead, this fixes the issue.


Original Message

target file : "goap.hpp"

In class plan, m_plan should be stack not queue.

In line 347 at "goap.hpp", it pushes action_idx of current_node which is latest node.

Then, in queue, it pop latest action_idx first, so the order is reversed.

I changed it to stack to pop first node's action_idx.

Please check this out. Thanks.

@linkdd linkdd changed the title Fix goap.hpp logic error 🐛 Fix reversed plan in GOAP May 8, 2024
@linkdd linkdd changed the base branch from main to fix-goap May 8, 2024 14:08
@linkdd linkdd merged commit 4892423 into linkdd:fix-goap May 8, 2024
3 checks passed
@linkdd
Copy link
Owner

linkdd commented May 8, 2024

Thanks for noticing and the PR! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants