Exemplo n.º 1
0
void cAssetMgr::AddUrl(std::string path)
{
    if (mUrl->exists(GetResourceName(path)))
    {
        LogMgr->Write(VERBOSE, "cAssetMgr::AddUrl >>>> Duplicate: File path '" + path + "' already registered and aliased to '" + GetResourceName(path) + "'");
        return;
    }

    LogMgr->Write(VERBOSE, "cAssetMgr::AddUrl >>>> File path '" + path + "' registered and aliased to '" + GetResourceName(path) + "'");

    mUrl->add(GetResourceName(path), path);
}
Exemplo n.º 2
0
bool COptionsPage::CreatePage(COptions* pOptions, CSettingsDialog* pOwner, wxWindow* parent, wxSize& maxSize)
{
	m_pOwner = pOwner;
	m_pOptions = pOptions;

	if (!wxXmlResource::Get()->LoadPanel(this, parent, GetResourceName()))
		return false;

	wxSize size = GetSize();

#ifdef __WXGTK__
	// wxStaticBox draws its own border coords -1.
	// Adjust this window so that the left border is fully visible.
	Move(1, 0);
	size.x += 1;
#endif

	if (size.GetWidth() > maxSize.GetWidth())
		maxSize.SetWidth(size.GetWidth());
	if (size.GetHeight() > maxSize.GetHeight())
		maxSize.SetHeight(size.GetHeight());

	m_was_selected = false;

	return true;
}
Exemplo n.º 3
0
void CRegionWorld::r_Write( CScript &s )
{
	ADDTOCALLSTACK_INTENSIVE("CRegionWorld::r_Write");
	s.WriteSection( "AREADEF %s", GetResourceName());
	r_WriteBase( s );

}
Exemplo n.º 4
0
bool wxsResource::ReadConfig(const TiXmlElement* Node)
{
    m_ResourceName = cbC2U(Node->Attribute("name"));
    m_Language = wxsCodeMarks::Id(cbC2U(Node->Attribute("language")));
    if ( GetResourceName().empty() ) return false;
    return OnReadConfig(Node);
}
Exemplo n.º 5
0
int CLuaACLDefs::aclCreate ( lua_State* luaVM )
{
//  acl aclCreate ( string aclName )
    SString strACLName;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strACLName );
    
    if ( !argStream.HasErrors () )
    {
         // See that the name doesn't exist already
        CAccessControlList* pACL = m_pACLManager->GetACL ( strACLName );
        
        if ( !pACL )
        {
            // Create a new ACL with that name
            pACL = m_pACLManager->AddACL ( strACLName );
            CLogger::LogPrintf ( "ACL: %s: ACL '%s' created\n", GetResourceName ( luaVM ), pACL->GetName () );
            // Return the created ACL
            lua_pushacl ( luaVM, pACL );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 6
0
int CLuaACLDefs::aclCreate ( lua_State* luaVM )
{
    // Verify the argument types
    if ( lua_type ( luaVM, 1 ) == LUA_TSTRING )
    {
        // Grab the arguments
        const char* szACLName = lua_tostring ( luaVM, 1 );

        // See that the name doesn't exist already
        CAccessControlList* pACL = m_pACLManager->GetACL ( szACLName );
        if ( !pACL )
        {
            // Create a new ACL with that name
            pACL = m_pACLManager->AddACL ( szACLName );
            CLogger::LogPrintf ( "ACL: %s: ACL '%s' created\n", GetResourceName ( luaVM ), pACL->GetName () );

            // Return the created ACL
            lua_pushacl ( luaVM, pACL );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "aclCreate" );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 7
0
int CLuaACLDefs::aclGroupRemoveACL ( lua_State* luaVM )
{
    // Verify the arguents
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA &&
         lua_type ( luaVM, 2 ) == LUA_TLIGHTUSERDATA )
    {
        // Grab the arguments
        CAccessControlListGroup* pGroup = lua_toaclgroup ( luaVM, 1 );
        CAccessControlList* pACL = lua_toacl ( luaVM, 2 );

        // Verify the group and ACL
        if ( pGroup && pACL )
        {
            // Add the ACL to the group
            pGroup->RemoveACL ( pACL );
            CLogger::LogPrintf ( "ACL: %s: ACL '%s' removed from group '%s'\n", GetResourceName ( luaVM ), pACL->GetName (), pGroup->GetGroupName () );

            // Return success
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "aclGroupRemoveACL" );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 8
0
int CLuaACLDefs::aclCreateGroup ( lua_State* luaVM )
{
    // Verify the arguents
    if ( lua_type ( luaVM, 1 ) == LUA_TSTRING )
    {
        // Grab the argument strings
        char* szGroup = (char*) lua_tostring ( luaVM, 1 );

        // Find the ACL specified
        CAccessControlListGroup* pGroup = m_pACLManager->GetGroup ( szGroup );
        if ( !pGroup )
        {
            // Create the group
            pGroup = m_pACLManager->AddGroup ( szGroup );
            CLogger::LogPrintf ( "ACL: %s: Group '%s' created\n", GetResourceName ( luaVM ), pGroup->GetGroupName () );

            // And return it
            lua_pushaclgroup ( luaVM, pGroup );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "aclCreateGroup" );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 9
0
int CLuaACLDefs::aclDestroyGroup ( lua_State* luaVM )
{
    // Verify the arguents
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA )
    {
         // Grab the arguments
        CAccessControlListGroup* pGroup = lua_toaclgroup ( luaVM, 1 );

        // Verify the group
        if ( pGroup )
        {
            // Delete it
            CLogger::LogPrintf ( "ACL: %s: Group '%s' deleted\n", GetResourceName ( luaVM ), pGroup->GetGroupName () );
            m_pACLManager->DeleteGroup ( pGroup );

            // Return success
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "aclDestroyGroup" );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 10
0
int CLuaACLDefs::aclCreateGroup ( lua_State* luaVM )
{
//  aclgroup aclCreateGroup ( string groupName )
    SString strGroup;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strGroup );
    
    if ( !argStream.HasErrors () )
    {
        // Find the ACL specified
        CAccessControlListGroup* pGroup = m_pACLManager->GetGroup ( strGroup );
        if ( !pGroup )
        {
            // Create the group
            pGroup = m_pACLManager->AddGroup ( strGroup );
            CLogger::LogPrintf ( "ACL: %s: Group '%s' created\n", GetResourceName ( luaVM ), pGroup->GetGroupName () );
            // And return it
            lua_pushaclgroup ( luaVM, pGroup );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 11
0
bool CResourceLink::ResourceLock( CResourceLock &s )
{
    ADDTOCALLSTACK("CResourceLink::ResourceLock");
    // Find the definition of this item in the scripts.
    // Open a locked copy of this script
    // NOTE: How can we tell the file has changed since last open ?
    // RETURN: true = found it.
    if ( !IsLinked() )	// has already failed previously.
        return false;

    ASSERT(m_pScript);

    //	Give several tryes to lock the script while multithreading
    int iRet = s.OpenLock( m_pScript, m_Context );
    if ( ! iRet )
        return true;

    s.AttachObj( this );

    // ret = -2 or -3
    lpctstr pszName = GetResourceName();
    DEBUG_ERR(("ResourceLock '%s':%d id=%s FAILED\n", s.GetFilePath(), m_Context.m_iOffset, pszName));

    return false;
}
Exemplo n.º 12
0
const ResourceRefList& StaticModel::GetMaterialsAttr() const
{
    materialsAttr_.names_.Resize(batches_.Size());
    for (unsigned i = 0; i < batches_.Size(); ++i)
        materialsAttr_.names_[i] = GetResourceName(GetMaterial(i));

    return materialsAttr_;
}
Exemplo n.º 13
0
const ResourceRefList& CustomGeometry::GetMaterialsAttr() const
{
    materialsAttr_.names_.Resize(batches_.Size());
    for (unsigned i = 0; i < batches_.Size(); ++i)
        materialsAttr_.names_[i] = GetResourceName(batches_[i].material_);

    return materialsAttr_;
}
Exemplo n.º 14
0
void CResourceRefArray::r_Write( CScript & s, LPCTSTR pszKey ) const
{
	ADDTOCALLSTACK_INTENSIVE("CResourceRefArray::r_Write");
	for ( size_t j = 0; j < GetCount(); j++ )
	{
		s.WriteKey( pszKey, GetResourceName( j ));
	}
}
Exemplo n.º 15
0
void wxsResource::BuildTreeEntry(const wxsResourceItemId& Parent)
{
    m_TreeItemId = wxsTree()->AppendItem(
        Parent,
        GetResourceName(),
        OnGetTreeIcon(), OnGetTreeIcon(),
        new wxsResourceRootTreeItemData(this));
}
Exemplo n.º 16
0
int CLuaACLDefs::aclRemoveRight ( lua_State* luaVM )
{
//  bool aclRemoveRight ( acl theAcl, string rightName )
    CAccessControlList* pACL; SString strRight;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pACL );
    argStream.ReadString ( strRight );
    
    if ( !argStream.HasErrors () )
    {
        // Grab the type from the name passed
        const char* szRightAftedDot = strRight;
        CAccessControlListRight::ERightType eType;
        if ( StringBeginsWith ( strRight, "command." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_COMMAND;
            szRightAftedDot += 8;
        }
        else if ( StringBeginsWith ( strRight, "function." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_FUNCTION;
            szRightAftedDot += 9;
        }
        else if ( StringBeginsWith ( strRight, "resource." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_RESOURCE;
            szRightAftedDot += 9;
        }
        else if ( StringBeginsWith ( strRight, "general." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_GENERAL;
            szRightAftedDot += 8;
        }
        else
        {
            lua_pushboolean ( luaVM, false );
            return 1;
        }
        // Try removing the right
        CAccessControlListRight* pACLRight = pACL->GetRight ( szRightAftedDot, eType );
        bool bAccess = pACLRight && pACLRight->GetRightAccess ();
        if ( pACL->RemoveRight ( szRightAftedDot, eType ) )
        {
            CLogger::LogPrintf ( "ACL: %s: Right '%s' %s removed from ACL '%s'\n", GetResourceName ( luaVM ), strRight.c_str (), bAccess ? "ALLOW" : "DISALLOW", pACL->GetName () );
            // Return success
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 17
0
bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
    if ( eventType == EVENT_NULL )  eventType = GetUniqueEventType();

    CControl::Create(pos, dim, icon, eventType);

    std::string name = GetResourceName(eventType);
    SetName(name);

    return true;
}
Exemplo n.º 18
0
int CLuaACLDefs::aclGroupAddObject ( lua_State* luaVM )
{
    // Verify the arguents
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA &&
         lua_type ( luaVM, 2 ) == LUA_TSTRING )
    {
        // Grab the arguments
        CAccessControlListGroup* pGroup = lua_toaclgroup ( luaVM, 1 );
        const char* szObject = lua_tostring ( luaVM, 2 );

        // Verify the group and ACL
        if ( pGroup )
        {
            // Figure out what type of object this is
            const char* szObjectAfterDot = szObject;
            CAccessControlListGroupObject::EObjectType eType;
            if ( StringBeginsWith ( szObject, "resource." ) )
            {
                eType = CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE;
                szObjectAfterDot += 9;
            }
            else if ( StringBeginsWith ( szObject, "user." ) )
            {
                eType = CAccessControlListGroupObject::OBJECT_TYPE_USER;
                szObjectAfterDot += 5;
            }
            else
            {
                lua_pushboolean ( luaVM, false );
                return 1;
            }

            // Make sure it doesn't already exist
            if ( !pGroup->FindObjectMatch ( szObjectAfterDot, eType ) )
            {
                // Set it
                pGroup->AddObject ( szObjectAfterDot, eType );
                CLogger::LogPrintf ( "ACL: %s: Object '%s' added to group '%s'\n", GetResourceName ( luaVM ), szObject, pGroup->GetGroupName () );

                // Return success
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "aclGroupAddObject" );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 19
0
bool COptionsPage::CreatePage(COptions* pOptions, CSettingsDialog* pOwner, wxWindow* parent, wxSize& maxSize)
{
	m_pOwner = pOwner;
	m_pOptions = pOptions;

	if (!wxXmlResource::Get()->LoadPanel(this, parent, GetResourceName())) {
		return false;
	}

	m_was_selected = false;

	UpdateMaxPageSize(maxSize);

	return true;
}
Exemplo n.º 20
0
int CLuaACLDefs::aclGroupRemoveObject ( lua_State* luaVM )
{
//  bool aclGroupRemoveObject ( aclgroup theGroup, string theObjectString )
    CAccessControlListGroup* pGroup; SString strObject;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pGroup );
    argStream.ReadString ( strObject );
    
    if ( !argStream.HasErrors () )
    {
        // Figure out what type of object this is
        const char* szObjectAfterDot = strObject;
        CAccessControlListGroupObject::EObjectType eType;

        if ( StringBeginsWith ( strObject, "resource." ) )
        {
            eType = CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE;
            szObjectAfterDot += 9;
        }
        else if ( StringBeginsWith ( strObject, "user." ) )
        {
            eType = CAccessControlListGroupObject::OBJECT_TYPE_USER;
            szObjectAfterDot += 5;
        }
        else
        {
            lua_pushboolean ( luaVM, false );
            return 1;
        }

        // Remove it
        if ( pGroup->RemoveObject ( szObjectAfterDot, eType ) )
        {
            // Return success
            CLogger::LogPrintf ( "ACL: %s: Object '%s' removed from group '%s'\n", GetResourceName ( luaVM ), strObject.c_str (), pGroup->GetGroupName () );
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 21
0
bool CRegionWorld::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
	ADDTOCALLSTACK("CRegionWorld::r_WriteVal");
	EXC_TRY("WriteVal");
	//bool	fZero	= false;
	switch ( FindTableHeadSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
	{
		case RWC_DEFNAME: // "DEFNAME" = for the speech system.
			sVal = GetResourceName();
			break;
		case RWC_RESOURCES:
			m_Events.WriteResourceRefList( sVal );
			break;
		case RWC_REGION:
			{
				// Check that the syntax is correct.
				if ( pszKey[6] && pszKey[6] != '.' )
					return false;

				CRegionWorld * pRegionTemp = dynamic_cast <CRegionWorld*>(m_pt.GetRegion( REGION_TYPE_AREA ));

				if ( !pszKey[6] )
				{
					// We're just checking if the reference is valid.
					sVal.FormatVal( pRegionTemp? 1:0 );
					return true;
				}

				// ELSE - We're trying to retrieve a property from the region.
				pszKey += 7;
				if ( pRegionTemp && m_pt.GetRegion( REGION_TYPE_MULTI ) )
					return pRegionTemp->r_WriteVal( pszKey, sVal, pSrc );

				return( this->r_WriteVal( pszKey, sVal, pSrc ));
			}
		default:
			return( CRegionBase::r_WriteVal( pszKey, sVal, pSrc ));
	}
	return true;
	EXC_CATCH;

	EXC_DEBUG_START;
	g_Log.EventDebug("command '%s' ret '%s' [%p]\n", pszKey, static_cast<LPCTSTR>(sVal), static_cast<void *>(pSrc));
	EXC_DEBUG_END;
	return false;
}
Exemplo n.º 22
0
void Game::Step3BuyingResources2(int amount) {
    resourceAmount = amount;
    
    // Buy resources and check if allowed to do so
    bool allowed = currentPlayer->BuyResources(*rMarket, currentPlayer->GetPowerPlants()[powerPlantIndex], resourceIdentity, amount);
    if (!allowed) {
        SetErrorMessageTextBox("Amount Error", "You can't buy the amount of <b>" + std::to_string(amount) + " " +
                               GetResourceName(resourceIdentity) + "(s)</b> for this power plant!");
        return Step3BuyingResources1();
    }

    // Find next playing step
    // Check if there are other resources to iterate through
    vector<Resource> temp;
    auto rSet = currentPlayer->GetPowerPlants()[powerPlantIndex]->GetActiveResources();
    copy(rSet.begin(), rSet.end(), back_inserter(temp));
    resourceIndex++;
    
    if (resourceIndex >= temp.size()) {
        // If no more resources, go to next power plant
        powerPlantIndex++;
        resourceIndex = 0;
        resourceAmount = 0;

        if (powerPlantIndex >= currentPlayer->GetPowerPlants().size()) {
            // If no more power plants, go to next player
            currentPlayer = playerOrder[GetNextPlayerIndex()];
            powerPlantIndex = 0;

            if (currentPlayer.get() == playerOrder[0].get()) {
                // If we returned to the first player, then go to step 4
                return Step4Start();
            }

        }
    }

    // Get next resource to use
    temp.clear();
    rSet = currentPlayer->GetPowerPlants()[powerPlantIndex]->GetActiveResources();
    copy(rSet.begin(), rSet.end(), back_inserter(temp));
    resourceIdentity = temp[resourceIndex];
    resourceAmount = 0;

    return Step3BuyingResources1();
}
Exemplo n.º 23
0
wxsItemResData* wxsItemRes::BuildResData(wxsItemEditor* Editor)
{
    wxString ProjectPath = GetProjectPath();

    return new wxsItemResData(
        ProjectPath + GetWxsFileName(),
        ProjectPath + GetSrcFileName(),
        ProjectPath + GetHdrFileName(),
        GetXrcFileName().empty() ? _T("") : ProjectPath + GetXrcFileName(),
        GetResourceName(),
        GetResourceType(),
        GetLanguage(),
        m_UseForwardDeclarations,
        m_UseI18n,
        GetTreeItemId(),
        Editor,
        this);
}
Exemplo n.º 24
0
void CResourceRefArray::WriteResourceRefList( CGString & sVal ) const
{
	ADDTOCALLSTACK("CResourceRefArray::WriteResourceRefList");
	TemporaryString tsVal;
	TCHAR * pszVal = static_cast<TCHAR *>(tsVal);
	size_t len = 0;
	for ( size_t j = 0; j < GetCount(); j++ )
	{
		if ( j > 0 )
			pszVal[len++] = ',';

		len += strcpylen( pszVal + len, GetResourceName( j ));
		if ( len >= SCRIPT_MAX_LINE_LEN-1 )
			break;
	}
	pszVal[len] = '\0';
	sVal = pszVal;
}
Exemplo n.º 25
0
Resource* ResourceCache::GetResource(ShortStringHash type, StringHash nameHash)
{
    // If null hash, return null pointer immediately
    if (!nameHash)
        return 0;
    
    const SharedPtr<Resource>& existing = FindResource(type, nameHash);
    if (existing)
        return existing;
    
    SharedPtr<Resource> resource;
    const String& name = GetResourceName(nameHash);
    if (name.Empty())
    {
        LOGERROR("Could not load unknown resource " + String(nameHash));
        return 0;
    }
    
    // Make sure the pointer is non-null and is a Resource subclass
    resource = DynamicCast<Resource>(context_->CreateObject(type));
    if (!resource)
    {
        LOGERROR("Could not load unknown resource type " + String(type));
        return 0;
    }
    
    // Attempt to load the resource
    SharedPtr<File> file = GetFile(name);
    if (!file)
        return 0;
    
    LOGDEBUG("Loading resource " + name);
    resource->SetName(file->GetName());
    if (!resource->Load(*(file.Get())))
        return 0;
    
    // Store to cache
    resource->ResetUseTimer();
    resourceGroups_[type].resources_[nameHash] = resource;
    UpdateResourceGroup(type);
    
    return resource;
}
Exemplo n.º 26
0
int CLuaACLDefs::aclDestroyGroup ( lua_State* luaVM )
{
//  bool aclDestroyGroup ( aclgroup aclGroup )
    CAccessControlListGroup* pGroup;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pGroup );
    
    if ( !argStream.HasErrors () )
    {
        // Delete it
        CLogger::LogPrintf ( "ACL: %s: Group '%s' deleted\n", GetResourceName ( luaVM ), pGroup->GetGroupName () );
        m_pACLManager->DeleteGroup ( pGroup );
        // Return success
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 27
0
int CLuaACLDefs::aclDestroy ( lua_State* luaVM )
{
//  bool aclDestroy ( acl theACL )
    CAccessControlList* pACL;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pACL );
    
    if ( !argStream.HasErrors () )
    {
        // Delete it
        CLogger::LogPrintf ( "ACL: %s: ACL '%s' deleted\n", GetResourceName ( luaVM ), pACL->GetName () );
        m_pACLManager->DeleteACL ( pACL );
        // Return true
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 28
0
void Game::PrintRemainingResources() {
    std::map<Resource, int> total;

    for (int i = 0; i < res::total; i++) {
        total[static_cast<Resource>(i)] = rMarket->GetCapacityResource(static_cast<Resource>(i));
    }

    for (int i = 0; i < res::total; i++) {

        for (auto player : players) {
            total[static_cast<Resource>(i)] -= player->GetResources(static_cast<Resource>(i));
        }
    }

    for (int i = 0; i < res::total; i++) {
        total[static_cast<Resource>(i)] -= rMarket->GetNbResource(static_cast<Resource>(i));
    }

    cout << "\nRemaining resources:" << endl;
    for (auto mapData : total) {
        cout << GetResourceName(mapData.first) << ": " << mapData.second << endl;
    }
    cout << endl;
}
Exemplo n.º 29
0
int CLuaACLDefs::aclGroupRemoveACL ( lua_State* luaVM )
{
//  bool aclGroupRemoveACL ( aclgroup theGroup, acl theACL )
    CAccessControlListGroup* pGroup; CAccessControlList* pACL;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pGroup );
    argStream.ReadUserData ( pACL );
    
    if ( !argStream.HasErrors () )
    {
        // Add the ACL to the group
        pGroup->RemoveACL ( pACL );
        CLogger::LogPrintf ( "ACL: %s: ACL '%s' removed from group '%s'\n", GetResourceName ( luaVM ), pACL->GetName (), pGroup->GetGroupName () );
        // Return success
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 30
0
int CLuaACLDefs::aclDestroy ( lua_State* luaVM )
{
    // Verify the argument types
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA )
    {
        // Grab the arguments
        CAccessControlList* pACL = lua_toacl ( luaVM, 1 );
        if ( pACL )
        {
            // Delete it
            CLogger::LogPrintf ( "ACL: %s: ACL '%s' deleted\n", GetResourceName ( luaVM ), pACL->GetName () );
            m_pACLManager->DeleteACL ( pACL );

            // Return true
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "aclDestroy" );

    lua_pushboolean ( luaVM, false );
    return 1;
}