Add new Zone wizard
This commit is contained in:
@@ -12,8 +12,6 @@ target_link_libraries(
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
NostalgiaStudio
|
||||
OxFS
|
||||
OxStd
|
||||
)
|
||||
|
||||
install(
|
||||
|
@@ -17,8 +17,6 @@ namespace world {
|
||||
using namespace studio;
|
||||
|
||||
const QString NewWorldWizard::FIELD_WORLD_PATH = "World.WorldPath";
|
||||
const QString NewWorldWizard::FIELD_WIDTH = "World.Width";
|
||||
const QString NewWorldWizard::FIELD_HEIGHT = "World.Height";
|
||||
|
||||
NewWorldWizard::NewWorldWizard(const Context *ctx) {
|
||||
addLineEdit(tr("&Name:"), FIELD_WORLD_PATH, "", [this, ctx](QString worldName) {
|
||||
@@ -31,28 +29,6 @@ NewWorldWizard::NewWorldWizard(const Context *ctx) {
|
||||
}
|
||||
}
|
||||
);
|
||||
addLineEdit(tr("&Width:"), FIELD_WIDTH, "", [this, ctx](QString widthStr) {
|
||||
bool ok = false;
|
||||
widthStr.toInt(&ok);
|
||||
if (ok) {
|
||||
return 0;
|
||||
} else {
|
||||
this->showValidationError(tr("Invalid width: \"%1\"").arg(widthStr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
);
|
||||
addLineEdit(tr("&Height:"), FIELD_HEIGHT, "", [this, ctx](QString widthStr) {
|
||||
bool ok = false;
|
||||
widthStr.toInt(&ok);
|
||||
if (ok) {
|
||||
return 0;
|
||||
} else {
|
||||
this->showValidationError(tr("Invalid height: \"%1\"").arg(widthStr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -18,8 +18,6 @@ namespace world {
|
||||
struct NewWorldWizard: public studio::WizardFormPage {
|
||||
|
||||
static const QString FIELD_WORLD_PATH;
|
||||
static const QString FIELD_WIDTH;
|
||||
static const QString FIELD_HEIGHT;
|
||||
|
||||
NewWorldWizard(const studio::Context *ctx);
|
||||
|
||||
|
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2016-2017 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "worldeditor.hpp"
|
||||
|
||||
|
@@ -29,10 +29,14 @@ QVector<WizardMaker> WorldEditorPlugin::newWizards(const Context *ctx) {
|
||||
return {new NewWorldWizard(ctx)};
|
||||
},
|
||||
[ctx](QWizard *w) {
|
||||
w->field(NewWorldWizard::FIELD_WORLD_PATH).toString();
|
||||
w->field(NewWorldWizard::FIELD_WIDTH).toInt();
|
||||
w->field(NewWorldWizard::FIELD_HEIGHT).toInt();
|
||||
return 0;
|
||||
qDebug() << "creating Region";
|
||||
auto path = PATH_ZONES + w->field(NewWorldWizard::FIELD_WORLD_PATH).toString();
|
||||
Region rgn;
|
||||
auto err = ctx->project->mkdir(PATH_ZONES);
|
||||
ctx->project->saveRomFs();
|
||||
qDebug() << "err:" << err;
|
||||
err |= ctx->project->writeObj(path, &rgn);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -15,7 +15,6 @@ using namespace common;
|
||||
using namespace core;
|
||||
|
||||
const int Zone::FIELDS = 1;
|
||||
const int Region::FIELDS = 0;
|
||||
|
||||
|
||||
Zone::Zone(Context *ctx, Bounds bnds, InodeId_t tileSheet) {
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ox/mc/mc.hpp>
|
||||
#include <ox/std/std.hpp>
|
||||
|
||||
#include <nostalgia/common/common.hpp>
|
||||
#include <nostalgia/core/core.hpp>
|
||||
@@ -83,9 +84,12 @@ struct Region {
|
||||
template<typename T>
|
||||
friend ox::Error ioOpWrite(T*, Region*);
|
||||
|
||||
enum {
|
||||
FIELDS = 1
|
||||
};
|
||||
|
||||
protected:
|
||||
static const int FIELDS;
|
||||
Zone *m_zones = nullptr;
|
||||
ox::Vector<Zone*> m_zones;
|
||||
|
||||
public:
|
||||
|
||||
|
Reference in New Issue
Block a user