QTfrontend/net/hwmapoptimizer.cpp
author nemo
Fri, 13 Apr 2018 13:03:51 -0400
changeset 13322 b77a9380dd0f
parent 10256 b07288b729c4
child 14599 b86e6e4f3c58
permissions -rw-r--r--
QT for some reason messes with XCompose causing broken input (Qt 5 only - Qt 4 did not break anything). In Qt 5.2 and 5.3 this was causing an invalid conversion in chat messages containing these resulting in the bad bytes being stripped. In Qt 5.9 it is still broken, but you at least get a string with something in it. This checks for non-zero converted strings for room creation and chat lines.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10256
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     1
#include "hwmapoptimizer.h"
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     2
#include "hwconsts.h"
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     3
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     4
HWMapOptimizer::HWMapOptimizer(QObject *parent) :
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     5
    TCPBase(parent)
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     6
{
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     7
}
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     8
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
     9
bool HWMapOptimizer::couldBeRemoved()
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    10
{
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    11
    return !m_hasStarted;
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    12
}
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    13
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    14
void HWMapOptimizer::optimizeMap(const Paths &paths)
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    15
{
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    16
    m_paths = paths;
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    17
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    18
    Start(true);
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    19
}
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    20
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    21
QStringList HWMapOptimizer::getArguments()
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    22
{
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    23
    QStringList arguments;
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    24
    arguments << "--internal";
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    25
    arguments << "--port";
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    26
    arguments << QString("%1").arg(ipc_port);
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    27
    arguments << "--user-prefix";
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    28
    arguments << cfgdir->absolutePath();
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    29
    arguments << "--prefix";
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    30
    arguments << datadir->absolutePath();
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    31
    arguments << "--landpreview";
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    32
    return arguments;
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    33
}
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    34
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    35
void HWMapOptimizer::onClientDisconnect()
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    36
{
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    37
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    38
}
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    39
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    40
void HWMapOptimizer::SendToClientFirst()
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    41
{
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    42
    SendIPC("e$mapgen 4");
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    43
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    44
    /*QByteArray data = m_drawMapData;
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    45
    while(data.size() > 0)
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    46
    {
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    47
        QByteArray tmp = data;
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    48
        tmp.truncate(200);
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    49
        SendIPC("edraw " + tmp);
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    50
        data.remove(0, 200);
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    51
    }
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    52
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    53
    SendIPC("!");*/
b07288b729c4 Some further work on map optimizer
unc0rr
parents:
diff changeset
    54
}