mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 03:34:52 +01:00
Add a way to set subscribed groups.
This commit is contained in:
parent
beffb89bda
commit
a0648d454c
5 changed files with 37 additions and 0 deletions
|
|
@ -132,6 +132,9 @@ public:
|
|||
std::map<std::string, Stat_config> getStats() { return stats; }
|
||||
void setStatDefiniton(std::string name, struct Stat_config stat_config) {stats[name] = stat_config; }
|
||||
|
||||
//subscribed lobby/group ids
|
||||
std::set<uint64> subscribed_groups;
|
||||
|
||||
//images
|
||||
std::map<int, struct Image_Data> images;
|
||||
int add_image(std::string data, uint32 width, uint32 height);
|
||||
|
|
|
|||
|
|
@ -511,6 +511,28 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::string depots_config_path = Local_Storage::get_game_settings_path() + "subscribed_groups.txt";
|
||||
std::ifstream input( depots_config_path );
|
||||
if (input.is_open()) {
|
||||
consume_bom(input);
|
||||
for( std::string line; getline( input, line ); ) {
|
||||
if (!line.empty() && line[line.length()-1] == '\n') {
|
||||
line.pop_back();
|
||||
}
|
||||
|
||||
if (!line.empty() && line[line.length()-1] == '\r') {
|
||||
line.pop_back();
|
||||
}
|
||||
|
||||
uint64 source_id = stoull(line);
|
||||
settings_client->subscribed_groups.insert(source_id);
|
||||
settings_server->subscribed_groups.insert(source_id);
|
||||
PRINT_DEBUG("Added source %llu\n", source_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::string mod_path = Local_Storage::get_game_settings_path() + "mods";
|
||||
std::vector<std::string> paths = Local_Storage::get_filenames_path(mod_path);
|
||||
|
|
|
|||
|
|
@ -502,6 +502,10 @@ bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource )
|
|||
if (settings->get_lobby() == steamIDSource) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (settings->subscribed_groups.find(steamIDSource.ConvertToUint64()) != settings->subscribed_groups.end()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Friend *f = find_friend(steamIDUser);
|
||||
if (!f) return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue