VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Precache.cpp
Go to the documentation of this file.
3#include <algorithm>
4#include <entity2/entitysystem.h>
5
6namespace VoltMod
7{
8
9void Precache::Add(std::string_view path)
10{
11 if (path.empty())
12 {
13 return;
14 }
15
16 if (std::ranges::find(_resources, path) != _resources.end())
17 {
18 return;
19 }
20
21 _resources.emplace_back(path);
22}
23
24void Precache::WriteTo(IEntityResourceManifest& manifest) const
25{
26 for (const auto& path : _resources)
27 {
28 manifest.AddResource(path.c_str());
29 }
30
31 if (!_resources.empty())
32 {
33 Log::Info("Precache: added {} resource(s) to the session manifest.", _resources.size());
34 }
35}
36
37} // namespace VoltMod
void Add(std::string_view path)
Definition Precache.cpp:9
void WriteTo(IEntityResourceManifest &manifest) const
Definition Precache.cpp:24
void Info(std::format_string< Args... > fmt, Args &&... args)
Definition Log.hpp:79