Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for unintentional filename conflicts within raw_models in streaming #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/plugins/gta3/std.stream/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ std::string CAbstractStreaming::TryLoadNonStreamedResource(std::string filepath,

if(!this->bHasInitializedStreaming)
{
auto it = this->raw_models.find(filename);
auto it = std::find_if(this->raw_models.begin(), this->raw_models.end(),
[&filename](const std::pair<std::string, const modloader::file *>& pair) {
return std::string(pair.second->filename()) == filename;
});

if(it != this->raw_models.end())
{
// Log about non streamed resource and make sure it's unique
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/gta3/std.stream/streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ bool CAbstractStreaming::InstallFile(const modloader::file& file)
// Just push it to this list and it will get loaded when the streaming initializes
// At this point we don't know if this is a clothing item or an model, for that reason "raw"
// The initializer will take care of filtering clothes and models from the list
this->raw_models[file.filename()] = &file;
this->raw_models[file.filepath()] = &file;
return true;
}
else
Expand Down Expand Up @@ -242,7 +242,7 @@ bool CAbstractStreaming::UninstallFile(const modloader::file& file)
return false;

// Streaming hasn't initialized, just remove it from our raw list
raw_models.erase(file.filename());
raw_models.erase(file.filepath());
return true;
}
else
Expand Down