Skip to content

Commit

Permalink
Put all observers before overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
psiberx committed Oct 2, 2021
1 parent 07e51c7 commit 3895e23
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/scripting/FunctionOverride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,16 @@ void FunctionOverride::Override(const std::string& acTypeName, const std::string
pContext->Environment = aEnvironment;
pContext->Forward = !aAbsolute;

pEntry->Calls.emplace_back(std::move(pContext));
if (aAbsolute || pEntry->Calls.empty())
{
pEntry->Calls.emplace_back(std::move(pContext));
}
else
{
auto pos = std::find_if(pEntry->Calls.rbegin(), pEntry->Calls.rend(),
[](TiltedPhoques::UniquePtr<Context>& aContext) { return aContext->Forward; });

pEntry->Calls.insert(pos.base(), std::move(pContext));
}
}
}

0 comments on commit 3895e23

Please sign in to comment.