feat: item models generation simple & remove core:item_models

This commit is contained in:
MihailRis
2024-10-26 18:42:21 +03:00
parent 7a5fe3b2b0
commit fae372d19f
16 changed files with 136 additions and 63 deletions
+11
View File
@@ -5,11 +5,13 @@
#include <optional>
#include <stdexcept>
#include <string>
#include <stdexcept>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <vector>
#include "util/stringutil.hpp"
#include "graphics/core/TextureAnimation.hpp"
class Assets;
@@ -84,6 +86,15 @@ public:
return static_cast<T*>(found->second.get());
}
template <class T>
T& require(const std::string& name) const {
T* asset = get<T>(name);
if (asset == nullptr) {
throw std::runtime_error(util::quote(name) + " not found");
}
return *asset;
}
template <class T>
std::optional<const assets_map*> getMap() const {
const auto& mapIter = assets.find(typeid(T));