Skip to content

Commit b1d01bc

Browse files
committed
Fix for unintentional filename conflicts within raw_models in streaming
1 parent 18f85c2 commit b1d01bc

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/plugins/gta3/std.stream/data.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ std::string CAbstractStreaming::TryLoadNonStreamedResource(std::string filepath,
8282

8383
if(!this->bHasInitializedStreaming)
8484
{
85-
auto it = this->raw_models.find(filename);
85+
auto it = std::find_if(this->raw_models.begin(), this->raw_models.end(),
86+
[&filename](const std::pair<std::string, const modloader::file *>& pair) {
87+
auto model_filename = std::string(pair.second->filename());
88+
return model_filename == filename;
89+
});
90+
8691
if(it != this->raw_models.end())
8792
{
8893
// Log about non streamed resource and make sure it's unique

src/plugins/gta3/std.stream/streaming.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ bool CAbstractStreaming::InstallFile(const modloader::file& file)
202202
// Just push it to this list and it will get loaded when the streaming initializes
203203
// At this point we don't know if this is a clothing item or an model, for that reason "raw"
204204
// The initializer will take care of filtering clothes and models from the list
205-
this->raw_models[file.filename()] = &file;
205+
this->raw_models[file.filepath()] = &file;
206206
return true;
207207
}
208208
else
@@ -242,7 +242,7 @@ bool CAbstractStreaming::UninstallFile(const modloader::file& file)
242242
return false;
243243

244244
// Streaming hasn't initialized, just remove it from our raw list
245-
raw_models.erase(file.filename());
245+
raw_models.erase(file.filepath());
246246
return true;
247247
}
248248
else

0 commit comments

Comments
 (0)