Add new register_event flags to filter humans and bots (bug 5768, r=me)

Former-commit-id: 15b0fba122d8c2ba7024b74aa07b78a877cc9d8c
This commit is contained in:
Vincent Herbet
2013-07-02 11:22:43 +02:00
parent 15572e2d61
commit 1026edec6c
3 changed files with 20 additions and 4 deletions

View File

@ -46,7 +46,7 @@ EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
m_FlagDead = true;
m_FlagWorld = (flags & 1) ? true : false; // flag a
m_FlagPlayer = (flags & 2) ? true : false; // flag b
m_FlagClient = (flags & 2) ? true : false; // flag b
m_FlagOnce = (flags & 4) ? true : false; // flag c
if (flags & 24)
@ -55,6 +55,18 @@ EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
m_FlagDead = (flags & 8) ? true : false; // flag d
}
if( m_FlagClient )
{
m_FlagPlayer = true;
m_FlagBot = true;
if( flags & 96 )
{
m_FlagPlayer = (flags & 32) ? true : false; // flag f
m_FlagBot = (flags & 64) ? true : false; // flag g
}
}
m_Stamp = 0.0f;
m_Done = false;
@ -237,7 +249,7 @@ void EventsMngr::parserInit(int msg_type, float* timer, CPlayer* pPlayer, int in
if (pPlayer)
{
if (!(*iter).m_FlagPlayer || (pPlayer->IsAlive() ? !(*iter).m_FlagAlive : !(*iter).m_FlagDead))
if (!(*iter).m_FlagClient || (pPlayer->IsBot() ? !(*iter).m_FlagBot : !(*iter).m_FlagPlayer) || (pPlayer->IsAlive() ? !(*iter).m_FlagAlive : !(*iter).m_FlagDead))
{
(*iter).m_Done = true;
continue;

View File

@ -74,11 +74,13 @@ public:
CPluginMngr::CPlugin *m_Plugin; // the plugin this ClEvent class is assigned to
// flags
bool m_FlagPlayer;
bool m_FlagClient;
bool m_FlagWorld;
bool m_FlagOnce;
bool m_FlagDead;
bool m_FlagAlive;
bool m_FlagPlayer;
bool m_FlagBot;
float m_Stamp; // for 'once' flag