Squashed 'deps/nostalgia/' changes from e38b85b4..31b39982

31b39982 [keel] Fix AssetRef to call incRef on initial creation of ref, not just copy
5476417b [nostalgia] Add release notes for d2025.07.0
e03be694 Merge commit 'b67b95767b7bfcd5f618ebc8e14ddbc83edcbe36'
490c0368 [nostalgia/gfx] Add lists for file extensions
a24fc407 [ox/std] Fix MSVC build

git-subtree-dir: deps/nostalgia
git-subtree-split: 31b39982c5ead87da1727bc1f561b945e4d1e5fb
This commit is contained in:
2025-08-01 02:53:02 -05:00
parent b67b95767b
commit 6b0a56d5d6
4 changed files with 30 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ namespace ox {
*/
class StringLiteral: public detail::BaseStringView {
public:
consteval StringLiteral() noexcept = default;
constexpr StringLiteral() noexcept = default;
constexpr StringLiteral(StringLiteral const &sv) noexcept = default;

View File

@@ -1,3 +1,9 @@
# d2025.07.0
* Add sub-command for exporting TileSheets as PNG files.
* Add 'Reload Project' menu item under File.
* Fix opening a project to mark an unopenable file as closed in the config file on startup.
# d2025.06.0
* Add ability to remember recent projects in config

View File

@@ -21,9 +21,28 @@ constexpr ox::Array<ox::StringLiteral, 2> FileExts_TileSheet{
FileExt_ng,
};
constexpr ox::Array<ox::StringLiteral, 2> FileExts_Palette{
FileExt_npal,
};
[[nodiscard]]
constexpr bool isTileSheet(ox::StringViewCR path) noexcept {
return endsWith(path, FileExt_nts) || endsWith(path, FileExt_ng);
return ox::any_of(
FileExts_TileSheet.begin(),
FileExts_TileSheet.end(),
[path](ox::StringLiteral const &ext) {
return endsWith(path, ext);
});
}
[[nodiscard]]
constexpr bool isPalette(ox::StringViewCR path) noexcept {
return ox::any_of(
FileExts_Palette.begin(),
FileExts_Palette.end(),
[path](ox::StringLiteral const &ext) {
return endsWith(path, ext);
});
}
}

View File

@@ -64,11 +64,13 @@ class AssetContainer {
protected:
constexpr void incRefs() const noexcept {
oxAssert(m_references < ox::MaxValue<decltype(m_references)>, "reference count exceeds maximum");
++m_references;
}
constexpr void decRefs() const noexcept {
--m_references;
oxAssert(m_references >= 0, "negative references");
}
[[nodiscard]]
@@ -162,6 +164,7 @@ template<typename T>
constexpr AssetRef<T>::AssetRef(AssetContainer<T> const*c) noexcept: m_ctr(c) {
if (m_ctr) {
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
m_ctr->incRefs();
}
}