コード例 #1
0
ファイル: CClientEntity.cpp プロジェクト: qaisjp/green-candy
// The_GTA: use childCall sparringly, because in Eir it's use does not make sense.
bool CClientEntity::CallEvent( const char *name, lua_State *callee, unsigned int argCount, bool childCall )
{
    lua_checkstack( m_lua, 1 );

    // Reference ourselves so we cannot be deleted during eventcalls
    lua_class_reference ref;
    Reference( ref );

    CEvents *pEvents = g_pClientGame->GetEvents();

    // Make sure our event-manager knows we're about to call an event
    pEvents->PrePulse();

    // Call the event on our parents/us
    CallParentEvent( callee, argCount, name, this );

    if ( childCall )
        CallEventNoParent( callee, argCount, name, this );

    // Remove the arguments from the stack
    lua_pop( callee, (int)argCount );

    // Tell the event manager that we're done calling the event
    pEvents->PostPulse();

    // Return whether it got cancelled or not
    return !pEvents->WasCancelled();
}