24 lines
454 B
C++
24 lines
454 B
C++
#pragma once
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include "Item.h"
|
|
|
|
namespace FRG {
|
|
|
|
class ItemRegistry {
|
|
public:
|
|
static ItemRegistry& instance();
|
|
|
|
void loadFromJson(const std::string& jsonPath, const std::string& zipPath = "");
|
|
|
|
// Returns nullptr if not found.
|
|
const Item* findById(const std::string& id) const;
|
|
|
|
private:
|
|
ItemRegistry() = default;
|
|
|
|
std::unordered_map<std::string, Item> items_;
|
|
};
|
|
|
|
} // namespace FRG
|