Files
BeamMP-Server/include/TResourceManager.h
20dka 468a6b340e add event 'onPlayerRequestMods', restructure modloading
now every player has their own list of allowed client mods, this can be modified by lua upon joining and is later used as a whitelist to ensure only those files can be sent to each client
2022-11-23 09:34:51 +01:00

22 lines
719 B
C++

#pragma once
#include "Common.h"
#include <optional>
using ModMap = HashMap<std::string, size_t>;
class TResourceManager {
public:
TResourceManager();
[[nodiscard]] size_t TotalModsSize() const { return mTotalModSize; }
[[nodiscard]] ModMap FileMap() const { return mMods; }
[[nodiscard]] static std::string FormatForBackend(const ModMap& mods);
[[nodiscard]] static std::string FormatForClient(const ModMap& mods);
[[nodiscard]] static std::optional<std::string> IsModValid(std::string& pathString, const ModMap& mods);
[[nodiscard]] int LoadedModCount() const { return mMods.size(); }
private:
size_t mTotalModSize = 0; // size of all mods
ModMap mMods; // map of mod names
};