示例#1
0
void LoginHandler::chooseServer(const unsigned int server,
                                const bool persistentIp) const
{
    if (static_cast<size_t>(server) >= LoginRecv::mWorlds.size() ||
        !LoginRecv::mWorlds[server])
    {
        return;
    }

    ServerInfo *const charServer = getCharServer();
    if (charServer)
    {
        if (config.getBoolValue("usePersistentIP") || persistentIp)
        {
            charServer->hostname = settings.serverName;
        }
        else
        {
            charServer->hostname = ipToString(
                LoginRecv::mWorlds[server]->address);
        }
        charServer->port = LoginRecv::mWorlds[server]->port;
    }

    client->setState(STATE_UPDATE);
}
void LoginHandler::chooseServer(const unsigned int server) const
{
    if (server >= mWorlds.size() || !mWorlds[server])
        return;

    ServerInfo *const charServer = getCharServer();
    if (charServer)
    {
        if (config.getBoolValue("usePersistentIP"))
            charServer->hostname = client->getServerName();
        else
            charServer->hostname = ipToString(mWorlds[server]->address);
        charServer->port = mWorlds[server]->port;
    }

    client->setState(STATE_UPDATE);
}