QTfrontend/hwmap.cpp
changeset 4489 c4ca9ced258b
parent 3133 1ab5f18f4df8
child 4494 9585435e20f7
equal deleted inserted replaced
4487:dbf69c7c5e00 4489:c4ca9ced258b
    25 
    25 
    26 HWMap::~HWMap()
    26 HWMap::~HWMap()
    27 {
    27 {
    28 }
    28 }
    29 
    29 
    30 void HWMap::getImage(std::string seed, int filter, MapGenerator mapgen, int maze_size)
    30 void HWMap::getImage(std::string seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData)
    31 {
    31 {
    32     m_seed = seed;
    32     m_seed = seed;
    33     templateFilter = filter;
    33     templateFilter = filter;
    34     m_mapgen = mapgen;
    34     m_mapgen = mapgen;
    35     m_maze_size = maze_size;
    35     m_maze_size = maze_size;
       
    36     m_drawMapData = drawMapData;
    36     Start();
    37     Start();
    37 }
    38 }
    38 
    39 
    39 QStringList HWMap::setArguments()
    40 QStringList HWMap::setArguments()
    40 {
    41 {
    60 void HWMap::SendToClientFirst()
    61 void HWMap::SendToClientFirst()
    61 {
    62 {
    62     SendIPC(QString("eseed %1").arg(m_seed.c_str()).toLatin1());
    63     SendIPC(QString("eseed %1").arg(m_seed.c_str()).toLatin1());
    63     SendIPC(QString("e$template_filter %1").arg(templateFilter).toLatin1());
    64     SendIPC(QString("e$template_filter %1").arg(templateFilter).toLatin1());
    64     SendIPC(QString("e$mapgen %1").arg(m_mapgen).toLatin1());
    65     SendIPC(QString("e$mapgen %1").arg(m_mapgen).toLatin1());
    65     SendIPC(QString("e$maze_size %1").arg(m_maze_size).toLatin1());
    66 
       
    67     switch (m_mapgen)
       
    68     {
       
    69         case MAPGEN_MAZE:
       
    70             SendIPC(QString("e$maze_size %1").arg(m_maze_size).toLatin1());
       
    71 
       
    72         case MAPGEN_DRAWN:
       
    73         {
       
    74             QByteArray data = m_drawMapData;
       
    75             while(data.size() > 0)
       
    76             {
       
    77                 QByteArray tmp = data;
       
    78                 tmp.truncate(230);
       
    79                 SendIPC("edraw " + tmp);
       
    80                 data.remove(0, 230);
       
    81             }
       
    82         }
       
    83         default: ;
       
    84     }
       
    85 
    66     SendIPC("!");
    86     SendIPC("!");
    67 }
    87 }