if (!PhysFs::removeFromSearchPath(path.c_str()))
    {
        logger->log("Error: %s: removeFromSearchPath failed: %s",
            path.c_str(),
            PHYSFS_getLastError());
        return false;
    }
    return true;
}

void ResourceManager::searchAndAddArchives(const std::string &restrict path,
                                           const std::string &restrict ext,
                                           const Append append) const
{
    const char *const dirSep = dirSeparator;
    char **list = PhysFs::enumerateFiles(path.c_str());

    for (char **i = list; *i; i++)
    {
        const size_t len = strlen(*i);

        if (len > ext.length() && !ext.compare((*i) + (len - ext.length())))
        {
            const std::string file = path + (*i);
            const std::string realPath = std::string(
                PhysFs::getRealDir(file.c_str()));
            addToSearchPath(std::string(realPath).append(
                dirSep).append(file), append);
        }
    }
Exemple #2
0
#include "debug.h"

namespace Ea
{

ChatHandler::ChatHandler()
{
    if (!ChatRecv::mSentWhispers.empty())
        ChatRecv::mSentWhispers.pop();
    ChatRecv::mMotdTime = -1;
    ChatRecv::mShowAllLang = serverConfig.getValue("showAllLang", 0);
    ChatRecv::mShowMotd = config.getBoolValue("showmotd");
    ChatRecv::mSkipping = true;
}

void ChatHandler::clear()
{
    ChatRecv::mShowMotd = config.getBoolValue("showmotd");
    ChatRecv::mSkipping = true;
}

void ChatHandler::me(const std::string &restrict text,
                     const std::string &restrict channel) const
{
    // here need string duplication
    std::string action = strprintf("*%s*", text.c_str());
    talk(action, channel);
}

}  // namespace Ea