Exemple #1
0
void fsal_print_acl_int(log_components_t component, log_levels_t debug,
			fsal_acl_t *acl, char *file, int line,
			char *function)
{
	fsal_ace_t *ace = NULL;

	if (!isLevel(component, debug))
		return;

	DisplayLogComponentLevel(component, file, line, function, debug,
				 "ACL naces: %u aces:", acl->naces);
	for (ace = acl->aces; ace < acl->aces + acl->naces; ace++)
		fsal_print_ace_int(component, debug, ace, file, line, function);
}
Exemple #2
0
void fsal_print_ace_int(log_components_t component, log_levels_t debug,
			fsal_ace_t *ace, char *file, int line,
			char *function)
{
	char fbuf[16];
	char ibuf[16];

	if (!isLevel(component, debug))
		return;

	DisplayLogComponentLevel(component, file, line, function, debug,
				 "ACE %s:%s(%s):%u:%s",
				 fsal_ace_type(ace->type),
				 fsal_ace_flag(fbuf, ace->flag),
				 fsal_ace_flag(ibuf, ace->iflag),
				 ace->who.uid,
				 fsal_ace_perm(ace->perm));
}
Exemple #3
0
    // Saves the current level.
    void LevelManager::saveLevel() throw(GameException)
    {
        if(!isLevel())
            return;

        std::cout << "Saving level..." << std::endl;

        std::string levelPath = "worlds/world/" + m_level->getInfo().name;
        adaptFilePath(levelPath);
        std::ofstream ofs(levelPath.c_str(), std::ios::out | std::ios::trunc | std::ios::binary);

        if(!ofs.good())
            throw Exception("LevelManager::saveLevel: cannot open file " + levelPath);

        m_level->serialize(ofs);
        ofs.close();

        std::cout << "Level saved." << std::endl;
    }
Exemple #4
0
    // Loads the current level from its name.
    // If it already exist, it is erased and replaced.
    // Returns the loaded level (if loading succeeded).
    Level * LevelManager::openLevel(std::string name) throw(GameException)
    {
        std::cout << "Loading level..." << std::endl;

        std::string levelPath = "worlds/world/" + name;
        adaptFilePath(levelPath);
        std::ifstream ifs(levelPath.c_str(), std::ios::in | std::ios::binary);
        if(ifs.good())
        {
            if(isLevel())
                closeLevel();

            m_level = new Level();
            m_level->unserialize(ifs);

            ifs.close();
        }
        else
        {
            throw GameException("LevelManager::loadLevel: Cannot load level '" + levelPath + "'");
        }
        std::cout << "Level loaded" << std::endl;
        return getLevel();
    }
Exemple #5
0
 ~LevelManager()
 {
     if(isLevel())
         closeLevel();
 }