diff --git a/src/generators/map_create.cpp b/src/generators/map_create.cpp index 7e9e8c6d028..f84c364f066 100644 --- a/src/generators/map_create.cpp +++ b/src/generators/map_create.cpp @@ -22,6 +22,7 @@ #include "scoped_resource.hpp" #include "serialization/string_utils.hpp" +#include static lg::log_domain log_config("config"); #define ERR_CF LOG_STREAM(err, log_config) @@ -46,6 +47,7 @@ std::string random_generate_map(const std::string& parms, const config &cfg) //the first token is the name of the generator, tokens after //that are arguments to the generator std::vector parameters = utils::split(parms, ' '); + assert(!parameters.empty()); //we use parameters.front() in the next line. util::scoped_ptr generator(create_map_generator(parameters.front(),cfg)); if(generator == NULL) { ERR_CF << "could not find map generator '" << parameters.front() << "'" << std::endl; diff --git a/src/help.cpp b/src/help.cpp index ab3dae81197..2bb5321696f 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -958,7 +958,7 @@ void parse_config_internal(const config *help_cfg, const config *section_cfg, } else if ((*section_cfg)["sort_topics"] == "generated") { sort_topics = false; sort_generated = true; - } else if ((*section_cfg)["sort_topics"] != "") { + } else if (!(*section_cfg)["sort_topics"].empty()) { std::stringstream ss; ss << "Invalid sort option: '" << (*section_cfg)["sort_topics"] << "'"; throw parse_error(ss.str()); diff --git a/src/multiplayer_wait.cpp b/src/multiplayer_wait.cpp index 5dedbb0cfc5..3dd410f32be 100644 --- a/src/multiplayer_wait.cpp +++ b/src/multiplayer_wait.cpp @@ -463,7 +463,7 @@ void wait::process_network_data(const config& data, const network::connection so { ui::process_network_data(data, sock); - if(data["message"] != "") { + if(!data["message"].empty()) { gui2::show_transient_message(disp().video() , _("Response") , data["message"]); diff --git a/src/saved_game.cpp b/src/saved_game.cpp index 5fe07e1721f..51fdc680129 100644 --- a/src/saved_game.cpp +++ b/src/saved_game.cpp @@ -315,7 +315,7 @@ void saved_game::expand_random_scenario() if(this->starting_pos_type_ == STARTINGPOS_SCENARIO) { // If the entire scenario should be randomly generated - if(starting_pos_["scenario_generation"] != "") + if(!starting_pos_["scenario_generation"].empty()) { LOG_NG << "randomly generating scenario...\n"; const cursor::setter cursor_setter(cursor::WAIT); @@ -331,12 +331,12 @@ void saved_game::expand_random_scenario() update_label(); } //it looks like we support a map= where map=filename equals more or less map_data={filename} - if(starting_pos_["map_data"].empty() && starting_pos_["map"] != "") { + if(starting_pos_["map_data"].empty() && !starting_pos_["map"].empty()) { starting_pos_["map_data"] = read_map(starting_pos_["map"]); } // If the map should be randomly generated // We dont want that we accidently to this twice so we check for starting_pos_["map_data"].empty() - if(starting_pos_["map_data"].empty() && starting_pos_["map_generation"] != "") { + if(starting_pos_["map_data"].empty() && !starting_pos_["map_generation"].empty()) { LOG_NG << "randomly generating map...\n"; const cursor::setter cursor_setter(cursor::WAIT);