[nostalgia,keel] Make repair return ox::Error
This commit is contained in:
parent
0d7b89a025
commit
6cbafc75bf
@ -75,15 +75,12 @@ constexpr bool valid(Palette const&p) noexcept {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool repair(Palette &p) noexcept {
|
||||
constexpr ox::Error repair(Palette &p) noexcept {
|
||||
auto const colors = p.colorInfo.size();
|
||||
if (p.pages.size() == 0) {
|
||||
p.pages.emplace_back();
|
||||
}
|
||||
for (auto &page : p.pages) {
|
||||
page.resize(colors);
|
||||
}
|
||||
return true;
|
||||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
|
@ -28,8 +28,8 @@ constexpr bool valid(auto const&) noexcept {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool repair(auto const&) noexcept {
|
||||
return false;
|
||||
constexpr ox::Error repair(auto const&) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
#ifndef OX_BARE_METAL
|
||||
@ -226,7 +226,7 @@ class AssetManager {
|
||||
ox::Result<AssetRef<T>> loadAsset(ox::StringView const assetId) noexcept {
|
||||
auto &p = m_cache[assetId];
|
||||
oxRequireM(obj, m_loader(assetId));
|
||||
if (!valid(obj) && !repair(obj)) {
|
||||
if (!valid(obj) && repair(obj)) {
|
||||
return OxError(1, "asset is invalid state and could not be repaired");
|
||||
}
|
||||
if (!p) {
|
||||
|
Loading…
Reference in New Issue
Block a user