# HG changeset patch # User unc0rr # Date 1291835930 -10800 # Node ID c4ca9ced258b14a5d45d90632caa8e782a6cdce3 # Parent dbf69c7c5e0018bce5de8ca184d3e34dcf357ecc - Pass map drawing data to engine - Hardcode one map for test purposes diff -r dbf69c7c5e00 -r c4ca9ced258b QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Wed Dec 08 21:55:15 2010 +0300 +++ b/QTfrontend/gamecfgwidget.cpp Wed Dec 08 22:18:50 2010 +0300 @@ -173,6 +173,8 @@ QStringList GameCFGWidget::getFullConfig() const { QStringList sl; + int mapgen = pMapContainer->get_mapgen(); + sl.append("eseed " + pMapContainer->getCurrentSeed()); sl.append(QString("e$gmflags %1").arg(getGameFlags())); sl.append(QString("e$damagepct %1").arg(schemeData(24).toInt())); @@ -189,8 +191,26 @@ sl.append(QString("e$healthdec %1").arg(schemeData(36).toInt())); sl.append(QString("e$ropepct %1").arg(schemeData(37).toInt())); sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter())); - sl.append(QString("e$mapgen %1").arg(pMapContainer->get_mapgen())); - sl.append(QString("e$maze_size %1").arg(pMapContainer->get_maze_size())); + sl.append(QString("e$mapgen %1").arg(mapgen)); + + switch (mapgen) + { + case MAPGEN_MAZE: + sl.append(QString("e$maze_size %1").arg(pMapContainer->get_maze_size())); + + case MAPGEN_DRAWN: + { + QByteArray data = pMapContainer->getDrawnMapData(); + while(data.size() > 0) + { + QByteArray tmp = data; + tmp.truncate(230); + sl << QString("edraw %1").arg(QString(tmp)); + data.remove(0, 230); + } + } + default: ; + } QString currentMap = pMapContainer->getCurrentMap(); if (currentMap.size() > 0) diff -r dbf69c7c5e00 -r c4ca9ced258b QTfrontend/hwmap.cpp --- a/QTfrontend/hwmap.cpp Wed Dec 08 21:55:15 2010 +0300 +++ b/QTfrontend/hwmap.cpp Wed Dec 08 22:18:50 2010 +0300 @@ -27,12 +27,13 @@ { } -void HWMap::getImage(std::string seed, int filter, MapGenerator mapgen, int maze_size) +void HWMap::getImage(std::string seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData) { m_seed = seed; templateFilter = filter; m_mapgen = mapgen; m_maze_size = maze_size; + m_drawMapData = drawMapData; Start(); } @@ -62,6 +63,25 @@ SendIPC(QString("eseed %1").arg(m_seed.c_str()).toLatin1()); SendIPC(QString("e$template_filter %1").arg(templateFilter).toLatin1()); SendIPC(QString("e$mapgen %1").arg(m_mapgen).toLatin1()); - SendIPC(QString("e$maze_size %1").arg(m_maze_size).toLatin1()); + + switch (m_mapgen) + { + case MAPGEN_MAZE: + SendIPC(QString("e$maze_size %1").arg(m_maze_size).toLatin1()); + + case MAPGEN_DRAWN: + { + QByteArray data = m_drawMapData; + while(data.size() > 0) + { + QByteArray tmp = data; + tmp.truncate(230); + SendIPC("edraw " + tmp); + data.remove(0, 230); + } + } + default: ; + } + SendIPC("!"); } diff -r dbf69c7c5e00 -r c4ca9ced258b QTfrontend/hwmap.h --- a/QTfrontend/hwmap.h Wed Dec 08 21:55:15 2010 +0300 +++ b/QTfrontend/hwmap.h Wed Dec 08 22:18:50 2010 +0300 @@ -42,7 +42,7 @@ public: HWMap(); virtual ~HWMap(); - void getImage(std::string seed, int templateFilter, MapGenerator mapgen, int maze_size); + void getImage(std::string seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData); protected: virtual QStringList setArguments(); @@ -58,6 +58,7 @@ int templateFilter; MapGenerator m_mapgen; int m_maze_size; + QByteArray m_drawMapData; private slots: }; diff -r dbf69c7c5e00 -r c4ca9ced258b QTfrontend/mapContainer.cpp --- a/QTfrontend/mapContainer.cpp Wed Dec 08 21:55:15 2010 +0300 +++ b/QTfrontend/mapContainer.cpp Wed Dec 08 22:18:50 2010 +0300 @@ -39,7 +39,9 @@ mainLayout(this), pMap(0), mapgen(MAPGEN_REGULAR), - maze_size(0) + maze_size(0), + drawnMapData(QByteArray::fromBase64("BHoGw4IEegbjAgR6BuwCCnYEaIIJKwRIgglLBE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T(setImage(const QImage))); connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int))); - pMap->getImage(m_seed.toStdString(), getTemplateFilter(), mapgen, maze_size); + pMap->getImage(m_seed.toStdString(), getTemplateFilter(), mapgen, maze_size, drawnMapData); } void HWMapContainer::themeSelected(int currentRow) @@ -504,3 +506,8 @@ emit mapgenChanged(m); changeImage(); } + +QByteArray HWMapContainer::getDrawnMapData() +{ + return drawnMapData; +} \ No newline at end of file diff -r dbf69c7c5e00 -r c4ca9ced258b QTfrontend/mapContainer.h --- a/QTfrontend/mapContainer.h Wed Dec 08 21:55:15 2010 +0300 +++ b/QTfrontend/mapContainer.h Wed Dec 08 22:18:50 2010 +0300 @@ -23,6 +23,7 @@ #include #include #include +#include #include "hwmap.h" @@ -48,6 +49,7 @@ MapGenerator get_mapgen(void) const; int get_maze_size(void) const; bool getCurrentIsMission() const; + QByteArray getDrawnMapData(); public slots: void changeImage(); @@ -98,6 +100,7 @@ QLabel *maze_size_label; QComboBox *maze_size_selection; MapGenerator mapgen; + QByteArray drawnMapData; int numMissions; int maze_size;