[nostalgia/core] Remove TileSheet::SubSheet::size
This commit is contained in:
parent
778cb78f31
commit
294c4547d0
@ -62,10 +62,13 @@ struct TileSheet {
|
||||
static constexpr auto TypeVersion = 1;
|
||||
ox::BString<32> name;
|
||||
uint64_t begin = 0;
|
||||
uint64_t size = 0;
|
||||
int rows = 1;
|
||||
int columns = 1;
|
||||
int rows = 1;
|
||||
ox::Vector<SubSheet> subsheets;
|
||||
|
||||
constexpr SubSheet() noexcept = default;
|
||||
constexpr SubSheet(const char *pName, int pColumns, int pRows) noexcept: name(pName), columns(pColumns), rows(pRows) {
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.TileSheet";
|
||||
@ -76,7 +79,15 @@ struct TileSheet {
|
||||
SubSheet subsheet;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr const auto &getSubSheet(const SubSheetIdx &idx, std::size_t idxIt, const SubSheet *pSubsheet) const noexcept {
|
||||
constexpr static const auto &getSubSheet(const SubSheetIdx &idx, std::size_t idxIt, const SubSheet *pSubsheet) noexcept {
|
||||
if (idxIt == idx.size()) {
|
||||
return *pSubsheet;
|
||||
}
|
||||
return getSubSheet(idx, idxIt + 1, &pSubsheet->subsheets[idx[idxIt]]);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr static auto &getSubSheet(const SubSheetIdx &idx, std::size_t idxIt, SubSheet *pSubsheet) noexcept {
|
||||
if (idxIt == idx.size()) {
|
||||
return *pSubsheet;
|
||||
}
|
||||
@ -89,16 +100,21 @@ struct TileSheet {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto &getSubSheet(const SubSheetIdx &idx, std::size_t idxIt, const SubSheet *pSubsheet) noexcept {
|
||||
if (idxIt == idx.size()) {
|
||||
return *pSubsheet;
|
||||
}
|
||||
return getSubSheet(idx, idxIt + 1, &pSubsheet->subsheets[idx[idxIt]]);
|
||||
constexpr auto &getSubSheet(const SubSheetIdx &idx) noexcept {
|
||||
return getSubSheet(idx, 0, &subsheet);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto &getSubSheet(const SubSheetIdx &idx) noexcept {
|
||||
return getSubSheet(idx, 0, &subsheet);
|
||||
constexpr static auto rmSubSheet(const SubSheetIdx &idx, std::size_t idxIt, SubSheet *pSubsheet) noexcept {
|
||||
if (idxIt == idx.size() - 1) {
|
||||
return pSubsheet->subsheets.erase(idx[idxIt]).error;
|
||||
}
|
||||
return rmSubSheet(idx, idxIt + 1, &pSubsheet->subsheets[idx[idxIt]]);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto rmSubSheet(const SubSheetIdx &idx) noexcept {
|
||||
return rmSubSheet(idx, 0, &subsheet);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
@ -213,7 +229,6 @@ oxModelEnd()
|
||||
oxModelBegin(TileSheet::SubSheet)
|
||||
oxModelField(name);
|
||||
oxModelField(begin);
|
||||
oxModelField(size);
|
||||
oxModelField(rows);
|
||||
oxModelField(columns);
|
||||
oxModelField(subsheets)
|
||||
|
@ -14,7 +14,6 @@ struct NostalgiaGraphicToTileSheetConverter: public Converter<NostalgiaGraphic,
|
||||
dst->subsheet.name = "Root";
|
||||
dst->subsheet.rows = src->rows;
|
||||
dst->subsheet.columns = src->columns;
|
||||
dst->subsheet.size = src->pixels.size();
|
||||
dst->defaultPalette = std::move(src->defaultPalette);
|
||||
dst->pixels = std::move(src->pixels);
|
||||
return OxError(0);
|
||||
|
Loading…
Reference in New Issue
Block a user