QTfrontend/net/hwmapoptimizer.cpp
author Wuzzy <Wuzzy2@mail.ru>
Wed, 07 Mar 2018 15:09:31 +0100
changeset 13089 c9cdbf630447
parent 10256 b07288b729c4
child 14599 b86e6e4f3c58
permissions -rw-r--r--
Stop SplitByChar also lowercasing the entire string. Fixes bug #581. It's weird that a function with this name would lowercase the whole string. Nemo and I have checked the history and code for any justifications of the lowercasing but we found none. I have checked in the code if anything actually depends on SplitByChar also lowercasing the string but I found nothing. It would surprise me since it's not obvious from the name IMO is bad coding practice anyway. Bug 581 is fixed by this because cLocale was (incorrectly) lowercased, which broke locale names like pt_BR to pt_br.

#include "hwmapoptimizer.h"
#include "hwconsts.h"

HWMapOptimizer::HWMapOptimizer(QObject *parent) :
    TCPBase(parent)
{
}

bool HWMapOptimizer::couldBeRemoved()
{
    return !m_hasStarted;
}

void HWMapOptimizer::optimizeMap(const Paths &paths)
{
    m_paths = paths;

    Start(true);
}

QStringList HWMapOptimizer::getArguments()
{
    QStringList arguments;
    arguments << "--internal";
    arguments << "--port";
    arguments << QString("%1").arg(ipc_port);
    arguments << "--user-prefix";
    arguments << cfgdir->absolutePath();
    arguments << "--prefix";
    arguments << datadir->absolutePath();
    arguments << "--landpreview";
    return arguments;
}

void HWMapOptimizer::onClientDisconnect()
{

}

void HWMapOptimizer::SendToClientFirst()
{
    SendIPC("e$mapgen 4");

    /*QByteArray data = m_drawMapData;
    while(data.size() > 0)
    {
        QByteArray tmp = data;
        tmp.truncate(200);
        SendIPC("edraw " + tmp);
        data.remove(0, 200);
    }

    SendIPC("!");*/
}