Replace strcmp() with string comparison operator

This isn't C.
This commit is contained in:
Jyrki Vesterinen 2019-05-11 15:09:21 +03:00
parent c56245958d
commit 6b0ef7e3ce
2 changed files with 3 additions and 2 deletions

View file

@ -126,8 +126,9 @@ void unit_create::pre_show(window& window)
row_data.emplace("race", column);
column["label"] = units_.back()->type_name();
if(strcmp(units_.back()->type_name().c_str(), units_.back()->id().c_str()))
if(units_.back()->type_name().str() != units_.back()->id()) {
column["label"] += " (" + units_.back()->id() + ")";
}
row_data.emplace("unit_type", column);
list.add_row(row_data);

View file

@ -934,7 +934,7 @@ std::vector<topic> generate_unit_topics(const bool sort_generated, const std::st
continue;
const std::string debug_suffix = (game_config::debug ? " (" + type.id() + ")" : "");
const std::string type_name = type.type_name() + (!strcmp(type.id().c_str(), type.type_name().c_str()) ? "" : debug_suffix);
const std::string type_name = type.type_name() + (type.id() == type.type_name().str() ? "" : debug_suffix);
const std::string real_prefix = type.show_variations_in_help() ? ".." : "";
const std::string ref_id = hidden_symbol(type.hide_help()) + real_prefix + unit_prefix + type.id();
topic unit_topic(type_name, ref_id, "");