Skip to content

Commit

Permalink
remove title from old cat when moved
Browse files Browse the repository at this point in the history
  • Loading branch information
cyee committed Oct 28, 2020
1 parent 61d334d commit af8fced
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,10 @@ namespace CONFIG {
WriteIniFile(CONFIG_INI_FILE);
CloseIniFile();
}

void RemoveFromMultiValues(std::vector<std::string> &multi_values, std::string value)
{
auto itr = std::find(multi_values.begin(), multi_values.end(), value);
if (itr != multi_values.end()) multi_values.erase(itr);
}
}
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ extern bool parental_control;

namespace CONFIG {
void LoadConfig();
void RemoveFromMultiValues(std::vector<std::string> &multi_values, std::string value);
void ParseMultiValueString(const char* prefix_list, std::vector<std::string> &prefixes, bool toLower);
std::string GetMultiValueString(std::vector<std::string> &multi_values);
void SetupCategory(GameCategory *category, int category_id, const char* category_name, const char* core,
Expand Down
2 changes: 2 additions & 0 deletions src/launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,8 +1211,10 @@ namespace Windows {
} else if (selected_game->type == TYPE_BUBBLE)
{
game_categories[i].valid_title_ids.push_back(selected_game->id);
CONFIG::RemoveFromMultiValues(current_category->valid_title_ids, selected_game->id);
OpenIniFile(CONFIG_INI_FILE);
WriteString(game_categories[i].title, CONFIG_TITLE_ID_PREFIXES, CONFIG::GetMultiValueString(game_categories[i].valid_title_ids).c_str());
WriteString(current_category->title, CONFIG_TITLE_ID_PREFIXES, CONFIG::GetMultiValueString(current_category->valid_title_ids).c_str());
WriteIniFile(CONFIG_INI_FILE);
CloseIniFile();
game_categories[i].games.push_back(*selected_game);
Expand Down

0 comments on commit af8fced

Please sign in to comment.