diff --git a/src/nostalgia/core/glfw/core.cpp b/src/nostalgia/core/glfw/core.cpp index 1125cd1f..ccfa8ddc 100644 --- a/src/nostalgia/core/glfw/core.cpp +++ b/src/nostalgia/core/glfw/core.cpp @@ -17,7 +17,7 @@ ox::Result> init(ox::UniquePtr fs, const auto ctx = ox::make_unique(); ctx->rom = std::move(fs); ctx->appName = appName; - const auto id = new GlfwImplData; + const auto id = ox::make(); ctx->setWindowerData(id); using namespace std::chrono; id->startTime = duration_cast(system_clock::now().time_since_epoch()).count(); diff --git a/src/nostalgia/core/studio/module.cpp b/src/nostalgia/core/studio/module.cpp index 0f687088..ae9cd595 100644 --- a/src/nostalgia/core/studio/module.cpp +++ b/src/nostalgia/core/studio/module.cpp @@ -16,7 +16,7 @@ ox::Vector Module::editors(core::Context *ctx) noexcept { {"ng"}, [ctx](const ox::String &path) -> ox::Result { try { - return new TileSheetEditorImGui(ctx, path); + return ox::make(ctx, path); } catch (const ox::Exception &ex) { return ex.toError(); } @@ -33,8 +33,8 @@ ox::Vector Module::editors(core::Context *ctx) noexcept { ox::Vector> Module::itemMakers(core::Context*) noexcept { ox::Vector> out; - out.emplace_back(new studio::ItemMakerT("Tile Sheet", "TileSheets", "ng")); - out.emplace_back(new studio::ItemMakerT("Palette", "Palettes", "npal")); + out.emplace_back(ox::make>("Tile Sheet", "TileSheets", "ng")); + out.emplace_back(ox::make>("Palette", "Palettes", "npal")); return out; } diff --git a/src/nostalgia/core/studio/tilesheeteditormodel.cpp b/src/nostalgia/core/studio/tilesheeteditormodel.cpp index 5a39f81b..cd42d185 100644 --- a/src/nostalgia/core/studio/tilesheeteditormodel.cpp +++ b/src/nostalgia/core/studio/tilesheeteditormodel.cpp @@ -565,7 +565,7 @@ void TileSheetEditorModel::cut() { const auto pt1 = m_selectionOrigin == geo::Point(-1, -1) ? geo::Point(0, 0) : m_selectionOrigin; const auto pt2 = geo::Point(s->columns * TileWidth, s->rows * TileHeight); setClipboardObject(m_ctx, std::move(cb)); - pushCommand(new CutPasteCommand(&m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb)); + pushCommand(ox::make>(&m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb)); } void TileSheetEditorModel::copy() { @@ -594,7 +594,7 @@ void TileSheetEditorModel::paste() { const auto s = activeSubSheet(); const auto pt1 = m_selectionOrigin == geo::Point(-1, -1) ? geo::Point(0, 0) : m_selectionOrigin; const auto pt2 = geo::Point(s->columns * TileWidth, s->rows * TileHeight); - pushCommand(new CutPasteCommand(&m_img, m_activeSubsSheetIdx, pt1, pt2, *cb)); + pushCommand(ox::make>(&m_img, m_activeSubsSheetIdx, pt1, pt2, *cb)); } const ox::FileAddress &TileSheetEditorModel::palPath() const noexcept { @@ -602,7 +602,7 @@ const ox::FileAddress &TileSheetEditorModel::palPath() const noexcept { } ox::Error TileSheetEditorModel::setPalette(const ox::String &path) noexcept { - pushCommand(new PaletteChangeCommand(activeSubSheetIdx(), &m_img, path)); + pushCommand(ox::make(activeSubSheetIdx(), &m_img, path)); return OxError(0); } @@ -615,7 +615,7 @@ void TileSheetEditorModel::drawCommand(const geo::Point &pt, std::size_t palIdx) if (m_ongoingDrawCommand) { m_updated = m_updated || m_ongoingDrawCommand->append(idx); } else if (activeSubSheet.getPixel(m_img.bpp, idx) != palIdx) { - pushCommand(new DrawCommand(&m_img, m_activeSubsSheetIdx, idx, static_cast(palIdx))); + pushCommand(ox::make(&m_img, m_activeSubsSheetIdx, idx, static_cast(palIdx))); } } @@ -624,23 +624,23 @@ void TileSheetEditorModel::endDrawCommand() noexcept { } void TileSheetEditorModel::addSubsheet(const TileSheet::SubSheetIdx &parentIdx) noexcept { - pushCommand(new AddSubSheetCommand(&m_img, parentIdx)); + pushCommand(ox::make(&m_img, parentIdx)); } void TileSheetEditorModel::rmSubsheet(const TileSheet::SubSheetIdx &idx) noexcept { - pushCommand(new RmSubSheetCommand(&m_img, idx)); + pushCommand(ox::make(&m_img, idx)); } void TileSheetEditorModel::insertTiles(const TileSheet::SubSheetIdx &idx, std::size_t tileIdx, std::size_t tileCnt) noexcept { - pushCommand(new InsertTilesCommand(&m_img, idx, tileIdx, tileCnt)); + pushCommand(ox::make(&m_img, idx, tileIdx, tileCnt)); } void TileSheetEditorModel::deleteTiles(const TileSheet::SubSheetIdx &idx, std::size_t tileIdx, std::size_t tileCnt) noexcept { - pushCommand(new DeleteTilesCommand(&m_img, idx, tileIdx, tileCnt)); + pushCommand(ox::make(&m_img, idx, tileIdx, tileCnt)); } ox::Error TileSheetEditorModel::updateSubsheet(const TileSheet::SubSheetIdx &idx, const ox::String &name, int cols, int rows) noexcept { - pushCommand(new UpdateSubSheetCommand(&m_img, idx, name, cols, rows)); + pushCommand(ox::make(&m_img, idx, name, cols, rows)); return OxError(0); } @@ -670,7 +670,7 @@ void TileSheetEditorModel::fill(const geo::Point &pt, int palIdx) noexcept { if (m_ongoingDrawCommand) { m_updated = m_updated || m_ongoingDrawCommand->append(idxList); } else if (s.getPixel(m_img.bpp, pt) != palIdx) { - pushCommand(new DrawCommand(&m_img, m_activeSubsSheetIdx, idxList, palIdx)); + pushCommand(ox::make(&m_img, m_activeSubsSheetIdx, idxList, palIdx)); } } diff --git a/src/nostalgia/core/typeconv.cpp b/src/nostalgia/core/typeconv.cpp index 2f89a167..1e7cc24a 100644 --- a/src/nostalgia/core/typeconv.cpp +++ b/src/nostalgia/core/typeconv.cpp @@ -42,9 +42,9 @@ struct TileSheetToCompactTileSheetConverter: public Converter, 3> converters; - converters.emplace_back(new NostalgiaGraphicToTileSheetConverter()); - converters.emplace_back(new NostalgiaPaletteToPaletteConverter()); - converters.emplace_back(new TileSheetToCompactTileSheetConverter()); + converters.emplace_back(ox::make()); + converters.emplace_back(ox::make()); + converters.emplace_back(ox::make()); return converters; }(); diff --git a/src/nostalgia/studio/newmenu.hpp b/src/nostalgia/studio/newmenu.hpp index 2f4c13e6..7505a89b 100644 --- a/src/nostalgia/studio/newmenu.hpp +++ b/src/nostalgia/studio/newmenu.hpp @@ -70,12 +70,12 @@ class NewMenu: public studio::Popup { template void NewMenu::addItemType(ox::String displayName, ox::String parentDir, ox::String fileExt, T itemTempl, ox::ClawFormat pFmt) noexcept { - m_types.emplace_back(new studio::ItemMakerT(std::move(displayName), std::move(parentDir), std::move(fileExt), std::move(itemTempl), pFmt)); + m_types.emplace_back(ox::make>(std::move(displayName), std::move(parentDir), std::move(fileExt), std::move(itemTempl), pFmt)); } template void NewMenu::addItemType(ox::String displayName, ox::String parentDir, ox::String fileExt, ox::ClawFormat pFmt) noexcept { - m_types.emplace_back(new studio::ItemMakerT(std::move(displayName), std::move(parentDir), std::move(fileExt), pFmt)); + m_types.emplace_back(ox::make>(std::move(displayName), std::move(parentDir), std::move(fileExt), pFmt)); } }