refactor: change pointer parameters to references for Level and Content in various classes

This commit is contained in:
MihailRis
2024-12-25 18:53:53 +03:00
parent ef2c0b2370
commit c1b311f3c4
41 changed files with 258 additions and 251 deletions
+5 -10
View File
@@ -56,17 +56,17 @@ struct WorldInfo : public Serializable {
class World {
WorldInfo info {};
const Content* const content;
const Content& content;
std::vector<ContentPack> packs;
void writeResources(const Content* content);
void writeResources(const Content& content);
public:
std::shared_ptr<WorldFiles> wfile;
World(
WorldInfo info,
const std::shared_ptr<WorldFiles>& worldFiles,
const Content* content,
const Content& content,
const std::vector<ContentPack>& packs
);
@@ -103,7 +103,7 @@ public:
const fs::path& directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
const Content& content,
const std::vector<ContentPack>& packs
);
@@ -118,7 +118,7 @@ public:
static std::unique_ptr<Level> load(
const std::shared_ptr<WorldFiles>& worldFiles,
EngineSettings& settings,
const Content* content,
const Content& content,
const std::vector<ContentPack>& packs
);
@@ -156,9 +156,4 @@ public:
int64_t getNextInventoryId() {
return info.nextInventoryId++;
}
/// @brief Get current world Content instance
const Content* getContent() const {
return content;
}
};