QTfrontend/net/hwmapoptimizer.cpp
author Wuzzy <almikes@aol.com>
Wed, 18 Oct 2017 02:17:03 +0200
changeset 12712 18941b52c8d7
parent 10256 b07288b729c4
child 14604 b86e6e4f3c58
permissions -rw-r--r--
Add air mine, cleaver to Highlander ammo scheme, and remove resurrector
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
}