Replace utils::set_split with utils::split_set

They did the same thing.
This commit is contained in:
Charles Dang 2024-01-05 02:29:33 -05:00
parent 2de180a901
commit cdfeb73df6
3 changed files with 3 additions and 13 deletions

View file

@ -29,7 +29,7 @@ carryover::carryover(const config& side)
, current_player_(side["current_player"])
, gold_(!side["carryover_gold"].empty() ? side["carryover_gold"].to_int() : side["gold"].to_int())
// if we load it from a snapshot we need to read the recruits from "recruits" and not from "previous_recruits".
, previous_recruits_(side.has_attribute("recruit") ? utils::set_split(side["recruit"]) :utils::set_split(side["previous_recruits"]))
, previous_recruits_(side.has_attribute("recruit") ? utils::split_set(side["recruit"].str()) :utils::split_set(side["previous_recruits"].str()))
, recall_list_()
, save_id_(side["save_id"])
, variables_(side.child_or_empty("variables"))

View file

@ -316,7 +316,7 @@ void map_context::set_side_setup(editor_team_info& info)
team& t = teams_[info.side - 1];
t.change_team(info.id, info.name);
t.set_recruits(utils::set_split(info.recruit_list, ','));
t.set_recruits(utils::split_set(info.recruit_list, ','));
t.have_leader(!info.no_leader);
t.change_controller(info.controller);
t.set_gold(info.gold);
@ -485,7 +485,7 @@ void map_context::load_scenario()
teams_.emplace_back();
teams_.back().build(side, map_);
if(!side["recruit"].str().empty()) {
teams_.back().set_recruits(utils::set_split(side["recruit"], ','));
teams_.back().set_recruits(utils::split_set(side["recruit"].str(), ','));
}
}

View file

@ -110,16 +110,6 @@ std::set<std::string> split_set(std::string_view val, const char c = ',', const
*/
std::vector<std::string> quoted_split(const std::string& val, char c= ',', int flags = REMOVE_EMPTY | STRIP_SPACES, char quote = '\\');
/**
* Splits a (comma-)separated string into a set of pieces.
* See split() for the meanings of the parameters.
*/
inline std::set<std::string> set_split(const std::string& val, const char c = ',', const int flags = REMOVE_EMPTY | STRIP_SPACES)
{
std::vector<std::string> vec_split = split(val, c, flags);
return std::set< std::string >(vec_split.begin(), vec_split.end());
}
/**
* Splits a string based on two separators into a map.
*