mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-27 11:20:54 +00:00
Changed: #1301 Removed a hard coded value.
This commit is contained in:
parent
add8aa0450
commit
4768bb0b44
4 changed files with 25 additions and 14 deletions
|
@ -49,9 +49,10 @@ ZoneBuilder::~ZoneBuilder()
|
|||
delete m_pixmapDatabase;
|
||||
}
|
||||
|
||||
bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
||||
bool ZoneBuilder::init(const QString &pathName, bool displayProgress)
|
||||
{
|
||||
bool bRet = true;
|
||||
if (pathName.isEmpty())
|
||||
return false;
|
||||
if (pathName != m_lastPathName)
|
||||
{
|
||||
m_lastPathName = pathName;
|
||||
|
@ -59,25 +60,23 @@ bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
|||
zoneBankPath += "/zoneligos/";
|
||||
|
||||
// Init the ZoneBank
|
||||
m_zoneBank.reset ();
|
||||
m_zoneBank.reset();
|
||||
if (!initZoneBank (zoneBankPath))
|
||||
{
|
||||
m_zoneBank.reset ();
|
||||
m_zoneBank.reset();
|
||||
return false;
|
||||
}
|
||||
// Construct the DataBase from the ZoneBank
|
||||
QString zoneBitmapPath = pathName;
|
||||
zoneBitmapPath += "/zonebitmaps/";
|
||||
m_pixmapDatabase->reset();
|
||||
if (!m_pixmapDatabase->loadPixmaps(zoneBitmapPath, m_zoneBank))
|
||||
if (!m_pixmapDatabase->loadPixmaps(zoneBitmapPath, m_zoneBank, displayProgress))
|
||||
{
|
||||
m_zoneBank.reset();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ((makeAZone) && (bRet))
|
||||
createZoneRegion();
|
||||
return bRet;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zonePos)
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
~ZoneBuilder();
|
||||
|
||||
/// Init zoneBank and init zone pixmap database
|
||||
bool init(const QString &pathName, bool bMakeAZone);
|
||||
bool init(const QString &pathName, bool displayProgress = false);
|
||||
|
||||
void calcMask();
|
||||
bool getZoneMask (sint32 x, sint32 y);
|
||||
|
|
|
@ -28,6 +28,8 @@ const char * const LANDSCAPE_EDITOR_PLUGIN = "LandscapeEditor";
|
|||
const char * const LANDSCAPE_EDITOR_SECTION = "LandscapeEditor";
|
||||
const char * const LANDSCAPE_WINDOW_STATE = "LandscapeWindowState";
|
||||
const char * const LANDSCAPE_WINDOW_GEOMETRY = "LandscapeWindowGeometry";
|
||||
const char * const LANDSCAPE_DATA_DIRECTORY = "LandscapeDataDirectory";
|
||||
const char * const LANDSCAPE_USE_OPENGL = "LandscapeUseOpenGL";
|
||||
|
||||
//resources
|
||||
const char * const ICON_LANDSCAPE_ITEM = ":/icons/ic_nel_landscape_item.png";
|
||||
|
|
|
@ -58,14 +58,11 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
|
|||
m_landscapeScene = new LandscapeScene(this);
|
||||
|
||||
m_zoneBuilder = new ZoneBuilder(m_landscapeScene, m_ui.zoneListWidget, m_undoStack);
|
||||
m_zoneBuilder->init("e:/-nel-/install/continents/newbieland", false);
|
||||
m_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder);
|
||||
m_ui.zoneListWidget->updateUi();
|
||||
|
||||
m_landscapeScene->setZoneBuilder(m_zoneBuilder);
|
||||
m_ui.graphicsView->setScene(m_landscapeScene);
|
||||
//m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer));
|
||||
//m_ui.graphicsView->setViewport(m_oglWidget);
|
||||
|
||||
m_ui.newLandAction->setIcon(QIcon(Core::Constants::ICON_NEW));
|
||||
m_ui.saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
|
||||
|
@ -95,8 +92,8 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
|
|||
|
||||
LandscapeEditorWindow::~LandscapeEditorWindow()
|
||||
{
|
||||
delete m_zoneBuilder;
|
||||
writeSettings();
|
||||
delete m_zoneBuilder;
|
||||
}
|
||||
|
||||
QUndoStack *LandscapeEditorWindow::undoStack() const
|
||||
|
@ -137,7 +134,7 @@ void LandscapeEditorWindow::openProjectSettings()
|
|||
int ok = dialog->exec();
|
||||
if (ok == QDialog::Accepted)
|
||||
{
|
||||
m_zoneBuilder->init(dialog->dataPath(), false);
|
||||
m_zoneBuilder->init(dialog->dataPath(), true);
|
||||
m_ui.zoneListWidget->updateUi();
|
||||
}
|
||||
delete dialog;
|
||||
|
@ -358,6 +355,18 @@ void LandscapeEditorWindow::readSettings()
|
|||
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
||||
restoreState(settings->value(Constants::LANDSCAPE_WINDOW_STATE).toByteArray());
|
||||
restoreGeometry(settings->value(Constants::LANDSCAPE_WINDOW_GEOMETRY).toByteArray());
|
||||
|
||||
// Read landscape data directory (contains sub-paths: zone logos, zone bitmaps)
|
||||
m_zoneBuilder->init(settings->value(Constants::LANDSCAPE_DATA_DIRECTORY).toString());
|
||||
m_ui.zoneListWidget->updateUi();
|
||||
|
||||
// Use OpenGL graphics system instead raster graphics system
|
||||
if (settings->value(Constants::LANDSCAPE_USE_OPENGL, false).toBool())
|
||||
{
|
||||
m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer));
|
||||
m_ui.graphicsView->setViewport(m_oglWidget);
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
|
@ -367,6 +376,7 @@ void LandscapeEditorWindow::writeSettings()
|
|||
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
||||
settings->setValue(Constants::LANDSCAPE_WINDOW_STATE, saveState());
|
||||
settings->setValue(Constants::LANDSCAPE_WINDOW_GEOMETRY, saveGeometry());
|
||||
settings->setValue(Constants::LANDSCAPE_DATA_DIRECTORY, m_zoneBuilder->dataPath());
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue