Skip to content

Added missing CallFor and InvokeFor templated functions #9

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Pools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ namespace rage
}
}

template<typename ...Args>
void CallFor(std::vector<rage::IPlayer*> const& players, const std::string& eventName, Args&&... args)
{
const int count = sizeof...(Args);

if (count == 0)
this->_CallFor(players, eventName);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_CallFor(players, eventName, arguments, count);
}
}

template<typename ...Args>
void Invoke(uint64_t hash, Args&&... args)
{
Expand Down Expand Up @@ -107,6 +121,20 @@ namespace rage
this->_InvokeInDimension(dimension, hash, arguments, count);
}
}

template<typename ...Args>
void InvokeFor(std::vector<rage::IPlayer*> const& players, uint64_t hash, Args&&... args)
{
const int count = sizeof...(Args);

if (count == 0)
this->_InvokeFor(players, hash);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_InvokeFor(players, hash, arguments, count);
}
}
};

class IVehiclePool
Expand Down