Remove \n from log lines with it as suffix on the final string

This commit is contained in:
Tommy 2022-07-18 16:03:00 +12:00
parent 1fe87c4e24
commit a02709e0ff
157 changed files with 949 additions and 949 deletions

View file

@ -62,7 +62,7 @@ namespace
{ {
const auto u_it = resources::gameboard->units().find(loc); const auto u_it = resources::gameboard->units().find(loc);
if(!u_it) { if(!u_it) {
ERR_NG << "advance_unit_dialog: unit not found\n"; ERR_NG << "advance_unit_dialog: unit not found";
return 0; return 0;
} }
const unit& u = *u_it; const unit& u = *u_it;
@ -103,11 +103,11 @@ namespace
unit_map::iterator u = resources::gameboard->units().find(loc); unit_map::iterator u = resources::gameboard->units().find(loc);
if (u == resources::gameboard->units().end()) { if (u == resources::gameboard->units().end()) {
LOG_DP << "animate_unit_advancement suppressed: invalid unit\n"; LOG_DP << "animate_unit_advancement suppressed: invalid unit";
return false; return false;
} }
else if (!u->advances()) { else if (!u->advances()) {
LOG_DP << "animate_unit_advancement suppressed: unit does not advance\n"; LOG_DP << "animate_unit_advancement suppressed: unit does not advance";
return false; return false;
} }
@ -116,7 +116,7 @@ namespace
assert(options.size() + mod_options.size() > 0); assert(options.size() + mod_options.size() > 0);
if (choice >= options.size() + mod_options.size()) { if (choice >= options.size() + mod_options.size()) {
LOG_DP << "animate_unit_advancement: invalid option, using first option\n"; LOG_DP << "animate_unit_advancement: invalid option, using first option";
choice = 0; choice = 0;
} }
@ -217,7 +217,7 @@ namespace
//have no effect because get_advancements returns an empty list. //have no effect because get_advancements returns an empty list.
unit_map::iterator u = resources::gameboard->units().find(loc_); unit_map::iterator u = resources::gameboard->units().find(loc_);
if(!u) { if(!u) {
ERR_NG << "unit_advancement_choice: unit not found\n"; ERR_NG << "unit_advancement_choice: unit not found";
return config{}; return config{};
} }
@ -282,13 +282,13 @@ void advance_unit_at(const advance_unit_params& params)
if(params.fire_events_) if(params.fire_events_)
{ {
LOG_NG << "Firing pre advance event at " << params.loc_ <<".\n"; LOG_NG << "Firing pre advance event at " << params.loc_ <<".";
resources::game_events->pump().fire("pre_advance", params.loc_); resources::game_events->pump().fire("pre_advance", params.loc_);
//TODO: maybe use id instead of location here ?. //TODO: maybe use id instead of location here ?.
u = resources::gameboard->units().find(params.loc_); u = resources::gameboard->units().find(params.loc_);
if(!unit_helper::will_certainly_advance(u)) if(!unit_helper::will_certainly_advance(u))
{ {
LOG_NG << "pre advance event aborted advancing.\n"; LOG_NG << "pre advance event aborted advancing.";
return; return;
} }
} }
@ -354,13 +354,13 @@ void advance_unit(map_location loc, const advancement_option &advance_to, bool f
// "advance" event. // "advance" event.
if(fire_event) if(fire_event)
{ {
LOG_NG << "Firing advance event at " << loc <<".\n"; LOG_NG << "Firing advance event at " << loc <<".";
resources::game_events->pump().fire("advance",loc); resources::game_events->pump().fire("advance",loc);
if (!u.valid() || u->experience() < u->max_experience() || if (!u.valid() || u->experience() < u->max_experience() ||
u->type_id() != original_type) u->type_id() != original_type)
{ {
LOG_NG << "WML has invalidated the advancing unit. Aborting.\n"; LOG_NG << "WML has invalidated the advancing unit. Aborting.";
return; return;
} }
// In case WML moved the unit: // In case WML moved the unit:
@ -388,7 +388,7 @@ void advance_unit(map_location loc, const advancement_option &advance_to, bool f
{ {
statistics::advance_unit(*new_unit); statistics::advance_unit(*new_unit);
preferences::encountered_units().insert(new_unit->type_id()); preferences::encountered_units().insert(new_unit->type_id());
LOG_CF << "Added '" << new_unit->type_id() << "' to the encountered units.\n"; LOG_CF << "Added '" << new_unit->type_id() << "' to the encountered units.";
} }
u->anim_comp().clear_haloes(); u->anim_comp().clear_haloes();
resources::gameboard->units().erase(loc); resources::gameboard->units().erase(loc);
@ -402,7 +402,7 @@ void advance_unit(map_location loc, const advancement_option &advance_to, bool f
// "post_advance" event. // "post_advance" event.
if(fire_event) if(fire_event)
{ {
LOG_NG << "Firing post_advance event at " << loc << ".\n"; LOG_NG << "Firing post_advance event at " << loc << ".";
resources::game_events->pump().fire("post_advance",loc); resources::game_events->pump().fire("post_advance",loc);
} }

View file

@ -122,7 +122,7 @@ battle_context_unit_stats::battle_context_unit_stats(nonempty_unit_const_ptr up,
} }
if(u.hitpoints() < 0) { if(u.hitpoints() < 0) {
LOG_CF << "Unit with " << u.hitpoints() << " hitpoints found, set to 0 for damage calculations\n"; LOG_CF << "Unit with " << u.hitpoints() << " hitpoints found, set to 0 for damage calculations";
hp = 0; hp = 0;
} else if(u.hitpoints() > u.max_hitpoints()) { } else if(u.hitpoints() > u.max_hitpoints()) {
// If a unit has more hp than its maximum, the engine will fail with an // If a unit has more hp than its maximum, the engine will fail with an
@ -865,13 +865,13 @@ attack::attack(const map_location& attacker,
, prng_defender_() , prng_defender_()
{ {
if(use_prng_) { if(use_prng_) {
LOG_NG << "Using experimental PRNG for combat\n"; LOG_NG << "Using experimental PRNG for combat";
} }
} }
void attack::fire_event(const std::string& n) void attack::fire_event(const std::string& n)
{ {
LOG_NG << "attack: firing '" << n << "' event\n"; LOG_NG << "attack: firing '" << n << "' event";
// prepare the event data for weapon filtering // prepare the event data for weapon filtering
config ev_data; config ev_data;
@ -1194,14 +1194,14 @@ bool attack::perform_hit(bool attacker_turn, statistics::attack_context& stats)
if(attacker_stats->poisons && !defender_unit.get_state(unit::STATE_POISONED)) { if(attacker_stats->poisons && !defender_unit.get_state(unit::STATE_POISONED)) {
defender_unit.set_state(unit::STATE_POISONED, true); defender_unit.set_state(unit::STATE_POISONED, true);
LOG_NG << "defender poisoned\n"; LOG_NG << "defender poisoned";
} }
if(attacker_stats->slows && !defender_unit.get_state(unit::STATE_SLOWED)) { if(attacker_stats->slows && !defender_unit.get_state(unit::STATE_SLOWED)) {
defender_unit.set_state(unit::STATE_SLOWED, true); defender_unit.set_state(unit::STATE_SLOWED, true);
update_fog = true; update_fog = true;
defender.damage_ = defender_stats->slow_damage; defender.damage_ = defender_stats->slow_damage;
LOG_NG << "defender slowed\n"; LOG_NG << "defender slowed";
} }
// If the defender is petrified, the fight stops immediately // If the defender is petrified, the fight stops immediately
@ -1342,7 +1342,7 @@ void attack::unit_killed(unit_info& attacker,
} }
} }
} else { } else {
LOG_NG << "unit not reanimated\n"; LOG_NG << "unit not reanimated";
} }
} }
@ -1363,7 +1363,7 @@ void attack::perform()
} }
if(a_.get_unit().attacks_left() <= 0) { if(a_.get_unit().attacks_left() <= 0) {
LOG_NG << "attack::perform(): not enough ap.\n"; LOG_NG << "attack::perform(): not enough ap.";
return; return;
} }
@ -1389,7 +1389,7 @@ void attack::perform()
d_stats_ = &bc_->get_defender_stats(); d_stats_ = &bc_->get_defender_stats();
if(a_stats_->disable) { if(a_stats_->disable) {
LOG_NG << "attack::perform(): tried to attack with a disabled attack.\n"; LOG_NG << "attack::perform(): tried to attack with a disabled attack.";
return; return;
} }
@ -1409,7 +1409,7 @@ void attack::perform()
refresh_bc(); refresh_bc();
DBG_NG << "getting attack statistics\n"; DBG_NG << "getting attack statistics";
statistics::attack_context attack_stats( statistics::attack_context attack_stats(
a_.get_unit(), d_.get_unit(), a_stats_->chance_to_hit, d_stats_->chance_to_hit); a_.get_unit(), d_.get_unit(), a_stats_->chance_to_hit, d_stats_->chance_to_hit);
@ -1434,12 +1434,12 @@ void attack::perform()
unit_display::unit_draw_weapon(a_.loc_, a_.get_unit(), a_stats_->weapon, d_stats_->weapon, d_.loc_, d_.get_unit_ptr()); unit_display::unit_draw_weapon(a_.loc_, a_.get_unit(), a_stats_->weapon, d_stats_->weapon, d_.loc_, d_.get_unit_ptr());
while(true) { while(true) {
DBG_NG << "start of attack loop...\n"; DBG_NG << "start of attack loop...";
++abs_n_attack_; ++abs_n_attack_;
if(a_.n_attacks_ > 0 && !defender_strikes_first) { if(a_.n_attacks_ > 0 && !defender_strikes_first) {
if(!perform_hit(true, attack_stats)) { if(!perform_hit(true, attack_stats)) {
DBG_NG << "broke from attack loop on attacker turn\n"; DBG_NG << "broke from attack loop on attacker turn";
break; break;
} }
} }
@ -1450,7 +1450,7 @@ void attack::perform()
if(d_.n_attacks_ > 0) { if(d_.n_attacks_ > 0) {
if(!perform_hit(false, attack_stats)) { if(!perform_hit(false, attack_stats)) {
DBG_NG << "broke from attack loop on defender turn\n"; DBG_NG << "broke from attack loop on defender turn";
break; break;
} }
} }

View file

@ -337,19 +337,19 @@ std::string find_recall_location(const int side, map_location& recall_location,
switch ( check_recall_location(side, recall_location, recall_from, unit_recall) ) switch ( check_recall_location(side, recall_location, recall_from, unit_recall) )
{ {
case RECRUIT_NO_LEADER: case RECRUIT_NO_LEADER:
LOG_NG << "No leaders on side " << side << " when recalling " << unit_recall.id() << ".\n"; LOG_NG << "No leaders on side " << side << " when recalling " << unit_recall.id() << ".";
return _("You do not have a leader to recall with."); return _("You do not have a leader to recall with.");
case RECRUIT_NO_ABLE_LEADER: case RECRUIT_NO_ABLE_LEADER:
LOG_NG << "No leader is able to recall " << unit_recall.id() << " on side " << side << ".\n"; LOG_NG << "No leader is able to recall " << unit_recall.id() << " on side " << side << ".";
return _("None of your leaders are able to recall that unit."); return _("None of your leaders are able to recall that unit.");
case RECRUIT_NO_KEEP_LEADER: case RECRUIT_NO_KEEP_LEADER:
LOG_NG << "No leader able to recall " << unit_recall.id() << " is on a keep.\n"; LOG_NG << "No leader able to recall " << unit_recall.id() << " is on a keep.";
return _("You must have a leader on a keep who is able to recall that unit."); return _("You must have a leader on a keep who is able to recall that unit.");
case RECRUIT_NO_VACANCY: case RECRUIT_NO_VACANCY:
LOG_NG << "No vacant castle tiles around a keep are available for recalling " << unit_recall.id() << "; requested location is " << recall_location << ".\n"; LOG_NG << "No vacant castle tiles around a keep are available for recalling " << unit_recall.id() << "; requested location is " << recall_location << ".";
return _("There are no vacant castle tiles in which to recall the unit."); return _("There are no vacant castle tiles in which to recall the unit.");
case RECRUIT_ALTERNATE_LOCATION: case RECRUIT_ALTERNATE_LOCATION:
@ -473,19 +473,19 @@ std::string find_recruit_location(const int side, map_location& recruit_location
switch ( check_recruit_location(side, recruit_location, recruited_from, unit_type) ) switch ( check_recruit_location(side, recruit_location, recruited_from, unit_type) )
{ {
case RECRUIT_NO_LEADER: case RECRUIT_NO_LEADER:
LOG_NG << "No leaders on side " << side << " when recruiting '" << unit_type << "'.\n"; LOG_NG << "No leaders on side " << side << " when recruiting '" << unit_type << "'.";
return _("You do not have a leader to recruit with."); return _("You do not have a leader to recruit with.");
case RECRUIT_NO_ABLE_LEADER: case RECRUIT_NO_ABLE_LEADER:
LOG_NG << "No leader is able to recruit '" << unit_type << "' on side " << side << ".\n"; LOG_NG << "No leader is able to recruit '" << unit_type << "' on side " << side << ".";
return _("None of your leaders are able to recruit this unit."); return _("None of your leaders are able to recruit this unit.");
case RECRUIT_NO_KEEP_LEADER: case RECRUIT_NO_KEEP_LEADER:
LOG_NG << "No leader able to recruit '" << unit_type << "' is on a keep.\n"; LOG_NG << "No leader able to recruit '" << unit_type << "' is on a keep.";
return _("You must have a leader on a keep who is able to recruit the unit."); return _("You must have a leader on a keep who is able to recruit the unit.");
case RECRUIT_NO_VACANCY: case RECRUIT_NO_VACANCY:
LOG_NG << "No vacant castle tiles around a keep are available for recruiting '" << unit_type << "'; requested location is " << recruit_location << ".\n"; LOG_NG << "No vacant castle tiles around a keep are available for recruiting '" << unit_type << "'; requested location is " << recruit_location << ".";
return _("There are no vacant castle tiles in which to recruit the unit."); return _("There are no vacant castle tiles in which to recruit the unit.");
case RECRUIT_ALTERNATE_LOCATION: case RECRUIT_ALTERNATE_LOCATION:
@ -656,7 +656,7 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat
if ( fire_event ) { if ( fire_event ) {
const std::string event_name = is_recall ? "prerecall" : "prerecruit"; const std::string event_name = is_recall ? "prerecall" : "prerecruit";
LOG_NG << "firing " << event_name << " event\n"; LOG_NG << "firing " << event_name << " event";
{ {
std::get<0>(res) |= std::get<0>(resources::game_events->pump().fire(event_name, current_loc, recruited_from)); std::get<0>(res) |= std::get<0>(resources::game_events->pump().fire(event_name, current_loc, recruited_from));
} }
@ -692,7 +692,7 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat
if ( fire_event ) { if ( fire_event ) {
const std::string event_name = is_recall ? "recall" : "recruit"; const std::string event_name = is_recall ? "recall" : "recruit";
LOG_NG << "firing " << event_name << " event\n"; LOG_NG << "firing " << event_name << " event";
{ {
std::get<0>(res) |= std::get<0>(resources::game_events->pump().fire(event_name, current_loc, recruited_from)); std::get<0>(res) |= std::get<0>(resources::game_events->pump().fire(event_name, current_loc, recruited_from));
} }

View file

@ -220,7 +220,7 @@ namespace {
healers.push_back(&*units.find(heal.loc)); healers.push_back(&*units.find(heal.loc));
if ( !healers.empty() ) { if ( !healers.empty() ) {
DBG_NG << "Unit has " << healers.size() << " healers.\n"; DBG_NG << "Unit has " << healers.size() << " healers.";
} }
} }
@ -292,7 +292,7 @@ namespace {
// Simple algorithm: no maximum number of patients per healer. // Simple algorithm: no maximum number of patients per healer.
void calculate_healing(int side, bool update_display) void calculate_healing(int side, bool update_display)
{ {
DBG_NG << "beginning of healing calculations\n"; DBG_NG << "beginning of healing calculations";
std::list<heal_unit> unit_list; std::list<heal_unit> unit_list;
@ -303,7 +303,7 @@ void calculate_healing(int side, bool update_display)
continue; continue;
} }
DBG_NG << "found healable unit at (" << patient.get_location() << ")\n"; DBG_NG << "found healable unit at (" << patient.get_location() << ")";
POISON_STATUS curing = POISON_NORMAL; POISON_STATUS curing = POISON_NORMAL;
int healing = 0; int healing = 0;
@ -341,7 +341,7 @@ void calculate_healing(int side, bool update_display)
continue; continue;
if (!healers.empty()) { if (!healers.empty()) {
DBG_NG << "Just before healing animations, unit has " << healers.size() << " potential healers.\n"; DBG_NG << "Just before healing animations, unit has " << healers.size() << " potential healers.";
} }
if (!resources::controller->is_skipping_replay() && update_display) if (!resources::controller->is_skipping_replay() && update_display)
@ -357,5 +357,5 @@ void calculate_healing(int side, bool update_display)
animate_heals(unit_list); animate_heals(unit_list);
DBG_NG << "end of healing calculations\n"; DBG_NG << "end of healing calculations";
} }

View file

@ -461,7 +461,7 @@ bool undo_list::apply_shroud_changes() const
// Loop through the list of undo_actions. // Loop through the list of undo_actions.
for( std::size_t i = 0; i != list_size; ++i ) { for( std::size_t i = 0; i != list_size; ++i ) {
if (const shroud_clearing_action* action = dynamic_cast<const shroud_clearing_action*>(undos_[i].get())) { if (const shroud_clearing_action* action = dynamic_cast<const shroud_clearing_action*>(undos_[i].get())) {
LOG_NG << "Turning an undo...\n"; LOG_NG << "Turning an undo...";
// Clear the hexes this unit can see from each hex occupied during // Clear the hexes this unit can see from each hex occupied during
// the action. // the action.

View file

@ -540,7 +540,7 @@ bool shroud_clearer::clear_dest(const map_location &dest, const unit &viewer)
void shroud_clearer::drop_events() void shroud_clearer::drop_events()
{ {
if ( !sightings_.empty() ) { if ( !sightings_.empty() ) {
DBG_NG << sightings_.size() << " sighted events were dropped.\n"; DBG_NG << sightings_.size() << " sighted events were dropped.";
} }
sightings_.clear(); sightings_.clear();
} }

View file

@ -345,7 +345,7 @@ bool addons_client::install_addon(config& archive_cfg, const addon_info& info)
i18n_symbols["addon_title"] = font::escape_text(info.title); i18n_symbols["addon_title"] = font::escape_text(info.title);
if(archive_cfg.has_child("removelist") || archive_cfg.has_child("addlist")) { if(archive_cfg.has_child("removelist") || archive_cfg.has_child("addlist")) {
LOG_ADDONS << "Received an updatepack for the addon '" << info.id << "'\n"; LOG_ADDONS << "Received an updatepack for the addon '" << info.id << "'";
// A consistency check // A consistency check
for(const config::any_child entry : archive_cfg.all_children_range()) { for(const config::any_child entry : archive_cfg.all_children_range()) {
@ -370,11 +370,11 @@ bool addons_client::install_addon(config& archive_cfg, const addon_info& info)
} }
} }
LOG_ADDONS << "Update completed.\n"; LOG_ADDONS << "Update completed.";
//#TODO: hash verification ??? //#TODO: hash verification ???
} else { } else {
LOG_ADDONS << "Received a full pack for the addon '" << info.id << "'\n"; LOG_ADDONS << "Received a full pack for the addon '" << info.id << "'";
if(!check_names_legal(archive_cfg)) { if(!check_names_legal(archive_cfg)) {
gui2::show_error_message(VGETTEXT("The add-on <i>$addon_title</i> has an invalid file or directory " gui2::show_error_message(VGETTEXT("The add-on <i>$addon_title</i> has an invalid file or directory "
@ -390,11 +390,11 @@ bool addons_client::install_addon(config& archive_cfg, const addon_info& info)
// Remove any previously installed versions // Remove any previously installed versions
if(!remove_local_addon(info.id)) { if(!remove_local_addon(info.id)) {
WRN_ADDONS << "failed to uninstall previous version of " << info.id << "; the add-on may not work properly!\n"; WRN_ADDONS << "failed to uninstall previous version of " << info.id << "; the add-on may not work properly!";
} }
unarchive_addon(archive_cfg); unarchive_addon(archive_cfg);
LOG_ADDONS << "unpacking finished\n"; LOG_ADDONS << "unpacking finished";
} }
config info_cfg; config info_cfg;

View file

@ -32,7 +32,7 @@ namespace {
{ {
addons_list::const_iterator it = addons.find(base_id); addons_list::const_iterator it = addons.find(base_id);
if(it == addons.end()) { if(it == addons.end()) {
LOG_AC << "resolve_deps_recursive(): " << base_id << " not in add-ons list\n"; LOG_AC << "resolve_deps_recursive(): " << base_id << " not in add-ons list";
return; return;
} }
@ -44,10 +44,10 @@ namespace {
for(const std::string& dep : base_deps) { for(const std::string& dep : base_deps) {
if(base_id == dep) { if(base_id == dep) {
LOG_AC << dep << " depends upon itself; breaking circular dependency\n"; LOG_AC << dep << " depends upon itself; breaking circular dependency";
continue; continue;
} else if(dest.find(dep) != dest.end()) { } else if(dest.find(dep) != dest.end()) {
LOG_AC << dep << " already in dependency tree; breaking circular dependency\n"; LOG_AC << dep << " already in dependency tree; breaking circular dependency";
continue; continue;
} }
@ -239,7 +239,7 @@ std::string addon_info::display_icon() const
ERR_AC << "add-on '" << id << "' has an icon which cannot be found: '" << ret << "'"; ERR_AC << "add-on '" << id << "' has an icon which cannot be found: '" << ret << "'";
} else if(ret.find("units/") != std::string::npos && ret.find_first_of('~') == std::string::npos) { } else if(ret.find("units/") != std::string::npos && ret.find_first_of('~') == std::string::npos) {
// HACK: prevent magenta icons, because they look awful // HACK: prevent magenta icons, because they look awful
LOG_AC << "add-on '" << id << "' uses a unit baseframe as icon without TC/RC specifications\n"; LOG_AC << "add-on '" << id << "' uses a unit baseframe as icon without TC/RC specifications";
ret += "~RC(magenta>red)"; ret += "~RC(magenta>red)";
} }
@ -284,7 +284,7 @@ std::set<std::string> addon_info::resolve_dependencies(const addons_list& addons
resolve_deps_recursive(addons, id, deps); resolve_deps_recursive(addons, id, deps);
if(deps.find(id) != deps.end()) { if(deps.find(id) != deps.end()) {
LOG_AC << id << " depends upon itself; breaking circular dependency\n"; LOG_AC << id << " depends upon itself; breaking circular dependency";
deps.erase(id); deps.erase(id);
} }

View file

@ -112,7 +112,7 @@ void get_addon_install_info(const std::string& addon_name, config& cfg)
void write_addon_install_info(const std::string& addon_name, const config& cfg) void write_addon_install_info(const std::string& addon_name, const config& cfg)
{ {
LOG_CFG << "Writing version info for add-on '" << addon_name << "'\n"; LOG_CFG << "Writing version info for add-on '" << addon_name << "'";
const auto& info_path = get_info_file_path(addon_name); const auto& info_path = get_info_file_path(addon_name);
auto out = filesystem::ostream_file(info_path); auto out = filesystem::ostream_file(info_path);
@ -228,7 +228,7 @@ static filesystem::blacklist_pattern_list read_ignore_patterns(const std::string
const std::string ign_file = parentd + "/" + addon_name + "/_server.ign"; const std::string ign_file = parentd + "/" + addon_name + "/_server.ign";
filesystem::blacklist_pattern_list patterns; filesystem::blacklist_pattern_list patterns;
LOG_CFG << "searching for .ign file for '" << addon_name << "'...\n"; LOG_CFG << "searching for .ign file for '" << addon_name << "'...";
if (!filesystem::file_exists(ign_file)) { if (!filesystem::file_exists(ign_file)) {
LOG_CFG << "no .ign file found for '" << addon_name << "'\n" LOG_CFG << "no .ign file found for '" << addon_name << "'\n"
<< "using default ignore patterns...\n"; << "using default ignore patterns...\n";
@ -357,7 +357,7 @@ void refresh_addon_version_info_cache()
{ {
version_info_cache.clear(); version_info_cache.clear();
LOG_CFG << "refreshing add-on versions cache\n"; LOG_CFG << "refreshing add-on versions cache";
const std::vector<std::string>& addons = installed_addons(); const std::vector<std::string>& addons = installed_addons();
if(addons.empty()) { if(addons.empty()) {
@ -384,7 +384,7 @@ void refresh_addon_version_info_cache()
} }
const std::string& version = info_cfg["version"].str(); const std::string& version = info_cfg["version"].str();
LOG_CFG << "cached add-on version: " << addon << " [" << version << "]\n"; LOG_CFG << "cached add-on version: " << addon << " [" << version << "]";
version_info_cache[addon] = version; version_info_cache[addon] = version;
} else if (!have_addon_pbl_info(addon) && !have_addon_in_vcs_tree(addon)) { } else if (!have_addon_pbl_info(addon) && !have_addon_in_vcs_tree(addon)) {

View file

@ -101,9 +101,9 @@ bool addons_manager_ui(const std::string& remote_address)
} catch(const wml_exception& e) { } catch(const wml_exception& e) {
e.show(); e.show();
} catch(const addons_client::user_exit&) { } catch(const addons_client::user_exit&) {
LOG_AC << "initial connection canceled by user\n"; LOG_AC << "initial connection canceled by user";
} catch(const addons_client::user_disconnect&) { } catch(const addons_client::user_disconnect&) {
LOG_AC << "attempt to reconnect canceled by user\n"; LOG_AC << "attempt to reconnect canceled by user";
} catch(const addons_client::invalid_server_address&) { } catch(const addons_client::invalid_server_address&) {
gui2::show_error_message(_("The add-ons server address specified is not valid.")); gui2::show_error_message(_("The add-ons server address specified is not valid."));
} }
@ -342,7 +342,7 @@ bool ad_hoc_addon_fetch_session(const std::vector<std::string>& addon_ids)
} catch(const wml_exception& e) { } catch(const wml_exception& e) {
e.show(); e.show();
} catch(const addons_client::user_exit&) { } catch(const addons_client::user_exit&) {
LOG_AC << "initial connection canceled by user\n"; LOG_AC << "initial connection canceled by user";
} catch(const addons_client::invalid_server_address&) { } catch(const addons_client::invalid_server_address&) {
gui2::show_error_message(_("The add-ons server address specified is not valid.")); gui2::show_error_message(_("The add-ons server address specified is not valid."));
} }

View file

@ -187,58 +187,58 @@ void attack_result::do_check_before()
if(attacker==resources::gameboard->units().end()) if(attacker==resources::gameboard->units().end())
{ {
LOG_AI_ACTIONS << "attempt to attack without attacker\n"; LOG_AI_ACTIONS << "attempt to attack without attacker";
set_error(E_EMPTY_ATTACKER); set_error(E_EMPTY_ATTACKER);
return; return;
} }
if (defender==resources::gameboard->units().end()) if (defender==resources::gameboard->units().end())
{ {
LOG_AI_ACTIONS << "attempt to attack without defender\n"; LOG_AI_ACTIONS << "attempt to attack without defender";
set_error(E_EMPTY_DEFENDER); set_error(E_EMPTY_DEFENDER);
return; return;
} }
if(attacker->incapacitated()) { if(attacker->incapacitated()) {
LOG_AI_ACTIONS << "attempt to attack with unit that is petrified\n"; LOG_AI_ACTIONS << "attempt to attack with unit that is petrified";
set_error(E_INCAPACITATED_ATTACKER); set_error(E_INCAPACITATED_ATTACKER);
return; return;
} }
if(defender->incapacitated()) { if(defender->incapacitated()) {
LOG_AI_ACTIONS << "attempt to attack unit that is petrified\n"; LOG_AI_ACTIONS << "attempt to attack unit that is petrified";
set_error(E_INCAPACITATED_DEFENDER); set_error(E_INCAPACITATED_DEFENDER);
return; return;
} }
if(!attacker->attacks_left()) { if(!attacker->attacks_left()) {
LOG_AI_ACTIONS << "attempt to attack with no attacks left\n"; LOG_AI_ACTIONS << "attempt to attack with no attacks left";
set_error(E_NO_ATTACKS_LEFT); set_error(E_NO_ATTACKS_LEFT);
return; return;
} }
if(attacker->side()!=get_side()) { if(attacker->side()!=get_side()) {
LOG_AI_ACTIONS << "attempt to attack with not own unit\n"; LOG_AI_ACTIONS << "attempt to attack with not own unit";
set_error(E_NOT_OWN_ATTACKER); set_error(E_NOT_OWN_ATTACKER);
return; return;
} }
if(!get_my_team().is_enemy(defender->side())) { if(!get_my_team().is_enemy(defender->side())) {
LOG_AI_ACTIONS << "attempt to attack unit that is not enemy\n"; LOG_AI_ACTIONS << "attempt to attack unit that is not enemy";
set_error(E_NOT_ENEMY_DEFENDER); set_error(E_NOT_ENEMY_DEFENDER);
return; return;
} }
if (attacker_weapon_!=-1) { if (attacker_weapon_!=-1) {
if ((attacker_weapon_<0)||(attacker_weapon_ >= static_cast<int>(attacker->attacks().size()))) { if ((attacker_weapon_<0)||(attacker_weapon_ >= static_cast<int>(attacker->attacks().size()))) {
LOG_AI_ACTIONS << "invalid weapon selection for the attacker\n"; LOG_AI_ACTIONS << "invalid weapon selection for the attacker";
set_error(E_WRONG_ATTACKER_WEAPON); set_error(E_WRONG_ATTACKER_WEAPON);
return; return;
} }
} }
if (!tiles_adjacent(attacker_loc_,defender_loc_)) { if (!tiles_adjacent(attacker_loc_,defender_loc_)) {
LOG_AI_ACTIONS << "attacker and defender not adjacent\n"; LOG_AI_ACTIONS << "attacker and defender not adjacent";
set_error(E_ATTACKER_AND_DEFENDER_NOT_ADJACENT); set_error(E_ATTACKER_AND_DEFENDER_NOT_ADJACENT);
return; return;
} }

View file

@ -252,7 +252,7 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >>
if (ufilt(u) if (ufilt(u)
&& (!u.invisible(u.get_location()) || u.is_visible_to_team(current_team(), false))) && (!u.invisible(u.get_location()) || u.is_visible_to_team(current_team(), false)))
{ {
DBG_AI_GOAL << "side " << get_side() << ": in " << goal_type << ": " << u.get_location() << " should be protected\n"; DBG_AI_GOAL << "side " << get_side() << ": in " << goal_type << ": " << u.get_location() << " should be protected";
items.insert(u.get_location()); items.insert(u.get_location());
} }
} }

View file

@ -1066,7 +1066,7 @@ double readonly_context_impl::power_projection(const map_location& loc, const mo
int64_t rating_64 = hp * defense * most_damage * village_bonus / 200; int64_t rating_64 = hp * defense * most_damage * village_bonus / 200;
int rating = rating_64; int rating = rating_64;
if(static_cast<int64_t>(rating) != rating_64) { if(static_cast<int64_t>(rating) != rating_64) {
WRN_AI << "overflow in ai attack calculation\n"; WRN_AI << "overflow in ai attack calculation";
} }
if(rating > best_rating) { if(rating > best_rating) {
map_location *pos = std::find(beg_used, end_used, it->second); map_location *pos = std::find(beg_used, end_used, it->second);

View file

@ -444,7 +444,7 @@ wfl::variant attack_analysis::execute_self(wfl::variant ctxt) {
ai::move_result_ptr result = get_ai_context(ctxt.as_callable()).execute_move_action(move_from, att_src); ai::move_result_ptr result = get_ai_context(ctxt.as_callable()).execute_move_action(move_from, att_src);
if(!result->is_ok()) { if(!result->is_ok()) {
//move part failed //move part failed
LOG_AI << "ERROR #" << result->get_status() << " while executing 'attack' formula function\n"; LOG_AI << "ERROR #" << result->get_status() << " while executing 'attack' formula function";
return wfl::variant(std::make_shared<wfl::safe_call_result>(fake_ptr(), result->get_status(), result->get_unit_location())); return wfl::variant(std::make_shared<wfl::safe_call_result>(fake_ptr(), result->get_status(), result->get_unit_location()));
} }
} }
@ -453,7 +453,7 @@ wfl::variant attack_analysis::execute_self(wfl::variant ctxt) {
ai::attack_result_ptr result = get_ai_context(ctxt.as_callable()).execute_attack_action(movements.front().second, target, -1); ai::attack_result_ptr result = get_ai_context(ctxt.as_callable()).execute_attack_action(movements.front().second, target, -1);
if(!result->is_ok()) { if(!result->is_ok()) {
//attack failed //attack failed
LOG_AI << "ERROR #" << result->get_status() << " while executing 'attack' formula function\n"; LOG_AI << "ERROR #" << result->get_status() << " while executing 'attack' formula function";
return wfl::variant(std::make_shared<wfl::safe_call_result>(fake_ptr(), result->get_status())); return wfl::variant(std::make_shared<wfl::safe_call_result>(fake_ptr(), result->get_status()));
} }
} }

View file

@ -223,7 +223,7 @@ double combat_phase::evaluate()
} }
time_taken = SDL_GetTicks() - ticks; time_taken = SDL_GetTicks() - ticks;
LOG_AI_TESTING_AI_DEFAULT << "analysis took " << time_taken << " ticks\n"; LOG_AI_TESTING_AI_DEFAULT << "analysis took " << time_taken << " ticks";
// suokko tested the rating against current_team().caution() // suokko tested the rating against current_team().caution()
// Bad mistake -- the AI became extremely reluctant to attack anything. // Bad mistake -- the AI became extremely reluctant to attack anything.
@ -280,12 +280,12 @@ double move_leader_to_goals_phase::evaluate()
const config &goal = get_leader_goal(); const config &goal = get_leader_goal();
//passive leader can reach a goal //passive leader can reach a goal
if (!goal) { if (!goal) {
LOG_AI_TESTING_AI_DEFAULT << get_name() << "No goal found\n"; LOG_AI_TESTING_AI_DEFAULT << get_name() << "No goal found";
return BAD_SCORE; return BAD_SCORE;
} }
if (goal.empty()) { if (goal.empty()) {
LOG_AI_TESTING_AI_DEFAULT << get_name() << "Empty goal found\n"; LOG_AI_TESTING_AI_DEFAULT << get_name() << "Empty goal found";
return BAD_SCORE; return BAD_SCORE;
} }
@ -611,7 +611,7 @@ void get_villages_phase::get_villages(
const move_map& dstsrc, const move_map& enemy_dstsrc, const move_map& dstsrc, const move_map& enemy_dstsrc,
unit_map::const_iterator &leader) unit_map::const_iterator &leader)
{ {
DBG_AI_TESTING_AI_DEFAULT << "deciding which villages we want...\n"; DBG_AI_TESTING_AI_DEFAULT << "deciding which villages we want...";
unit_map &units_ = resources::gameboard->units(); unit_map &units_ = resources::gameboard->units();
const int ticks = SDL_GetTicks(); const int ticks = SDL_GetTicks();
best_leader_loc_ = map_location::null_location(); best_leader_loc_ = map_location::null_location();
@ -637,7 +637,7 @@ void get_villages_phase::get_villages(
} }
} }
DBG_AI_TESTING_AI_DEFAULT << reachmap.size() << " units found who can try to capture a village.\n"; DBG_AI_TESTING_AI_DEFAULT << reachmap.size() << " units found who can try to capture a village.";
find_villages(reachmap, moves_, dstsrc, enemy_dstsrc); find_villages(reachmap, moves_, dstsrc, enemy_dstsrc);
@ -658,7 +658,7 @@ void get_villages_phase::get_villages(
dispatch(reachmap, moves_); dispatch(reachmap, moves_);
} else { } else {
DBG_AI_TESTING_AI_DEFAULT << "No more units left after removing the ones who can't reach a village.\n"; DBG_AI_TESTING_AI_DEFAULT << "No more units left after removing the ones who can't reach a village.";
} }
LOG_AI_TESTING_AI_DEFAULT << "Village assignment done: " << (SDL_GetTicks() - ticks) LOG_AI_TESTING_AI_DEFAULT << "Village assignment done: " << (SDL_GetTicks() - ticks)
@ -781,7 +781,7 @@ void get_villages_phase::find_villages(
void get_villages_phase::dispatch(treachmap& reachmap, tmoves& moves) void get_villages_phase::dispatch(treachmap& reachmap, tmoves& moves)
{ {
DBG_AI_TESTING_AI_DEFAULT << "Starting simple dispatch.\n"; DBG_AI_TESTING_AI_DEFAULT << "Starting simple dispatch.";
// we now have a list with units with the villages they can reach. // we now have a list with units with the villages they can reach.
// keep trying the following steps as long as one of them changes // keep trying the following steps as long as one of them changes
@ -799,10 +799,10 @@ void get_villages_phase::dispatch(treachmap& reachmap, tmoves& moves)
dispatched = true; dispatched = true;
} else { } else {
if(reachmap.empty()) { if(reachmap.empty()) {
DBG_AI_TESTING_AI_DEFAULT << "dispatch_unit_simple() found a final solution.\n"; DBG_AI_TESTING_AI_DEFAULT << "dispatch_unit_simple() found a final solution.";
break; break;
} else { } else {
DBG_AI_TESTING_AI_DEFAULT << "dispatch_unit_simple() couldn't dispatch more units.\n"; DBG_AI_TESTING_AI_DEFAULT << "dispatch_unit_simple() couldn't dispatch more units.";
} }
} }
@ -810,22 +810,22 @@ void get_villages_phase::dispatch(treachmap& reachmap, tmoves& moves)
dispatched = true; dispatched = true;
} else { } else {
if(reachmap.empty()) { if(reachmap.empty()) {
DBG_AI_TESTING_AI_DEFAULT << "dispatch_village_simple() found a final solution.\n"; DBG_AI_TESTING_AI_DEFAULT << "dispatch_village_simple() found a final solution.";
break; break;
} else { } else {
DBG_AI_TESTING_AI_DEFAULT << "dispatch_village_simple() couldn't dispatch more units.\n"; DBG_AI_TESTING_AI_DEFAULT << "dispatch_village_simple() couldn't dispatch more units.";
} }
} }
if(!reachmap.empty() && dispatched) { if(!reachmap.empty() && dispatched) {
DBG_AI_TESTING_AI_DEFAULT << reachmap.size() << " unit(s) left restarting simple dispatching.\n"; DBG_AI_TESTING_AI_DEFAULT << reachmap.size() << " unit(s) left restarting simple dispatching.";
dump_reachmap(reachmap); dump_reachmap(reachmap);
} }
} }
if(reachmap.empty()) { if(reachmap.empty()) {
DBG_AI_TESTING_AI_DEFAULT << "No units left after simple dispatcher.\n"; DBG_AI_TESTING_AI_DEFAULT << "No units left after simple dispatcher.";
return; return;
} }
@ -981,7 +981,7 @@ void get_villages_phase::dispatch_complex(
// Every unit can reach every village. // Every unit can reach every village.
if(unit_count == 2 && village_count == 2) { if(unit_count == 2 && village_count == 2) {
DBG_AI_TESTING_AI_DEFAULT << "Every unit can reach every village for 2 units, dispatch them.\n"; DBG_AI_TESTING_AI_DEFAULT << "Every unit can reach every village for 2 units, dispatch them.";
full_dispatch(reachmap, moves); full_dispatch(reachmap, moves);
return; return;
} }
@ -1063,7 +1063,7 @@ void get_villages_phase::dispatch_complex(
== (village_count * unit_count))); == (village_count * unit_count)));
if(reach_all) { if(reach_all) {
DBG_AI_TESTING_AI_DEFAULT << "Every unit can reach every village, dispatch them\n"; DBG_AI_TESTING_AI_DEFAULT << "Every unit can reach every village, dispatch them";
full_dispatch(reachmap, moves); full_dispatch(reachmap, moves);
reachmap.clear(); reachmap.clear();
return; return;
@ -1119,13 +1119,13 @@ void get_villages_phase::dispatch_complex(
// We did a perfect dispatch 2 units who could visit 2 villages. // We did a perfect dispatch 2 units who could visit 2 villages.
// This means we didn't change the assertion for this functions // This means we didn't change the assertion for this functions
// so call ourselves recursively, and finish afterwards. // so call ourselves recursively, and finish afterwards.
DBG_AI_TESTING_AI_DEFAULT << "Perfect dispatch, do complex again.\n"; DBG_AI_TESTING_AI_DEFAULT << "Perfect dispatch, do complex again.";
dispatch_complex(reachmap, moves, village_count - 2); dispatch_complex(reachmap, moves, village_count - 2);
return; return;
} else { } else {
// We did a not perfect dispatch but we did modify things // We did a not perfect dispatch but we did modify things
// so restart dispatching. // so restart dispatching.
DBG_AI_TESTING_AI_DEFAULT << "NON Perfect dispatch, do dispatch again.\n"; DBG_AI_TESTING_AI_DEFAULT << "NON Perfect dispatch, do dispatch again.";
remove_village(reachmap, moves, village1); remove_village(reachmap, moves, village1);
remove_village(reachmap, moves, village2); remove_village(reachmap, moves, village2);
dispatch(reachmap, moves); dispatch(reachmap, moves);
@ -1196,7 +1196,7 @@ void get_villages_phase::dispatch_complex(
} else if(unit_count <= village_count) { } else if(unit_count <= village_count) {
DBG_AI_TESTING_AI_DEFAULT << "Unit major\n"; DBG_AI_TESTING_AI_DEFAULT << "Unit major";
std::vector<std::size_t> perm (unit_count, 0); std::vector<std::size_t> perm (unit_count, 0);
for(std::size_t i =0; i < unit_count; ++i) { for(std::size_t i =0; i < unit_count; ++i) {
@ -1238,7 +1238,7 @@ void get_villages_phase::dispatch_complex(
} else { } else {
DBG_AI_TESTING_AI_DEFAULT << "Village major\n"; DBG_AI_TESTING_AI_DEFAULT << "Village major";
std::vector<std::size_t> perm (village_count, 0); std::vector<std::size_t> perm (village_count, 0);
for(std::size_t i =0; i < village_count; ++i) { for(std::size_t i =0; i < village_count; ++i) {
@ -1384,7 +1384,7 @@ double get_healing_phase::evaluate()
void get_healing_phase::execute() void get_healing_phase::execute()
{ {
LOG_AI_TESTING_AI_DEFAULT << "moving unit to village for healing...\n"; LOG_AI_TESTING_AI_DEFAULT << "moving unit to village for healing...";
move_->execute(); move_->execute();
if (!move_->is_ok()){ if (!move_->is_ok()){
LOG_AI_TESTING_AI_DEFAULT << get_name() << "::execute not ok"; LOG_AI_TESTING_AI_DEFAULT << get_name() << "::execute not ok";

View file

@ -132,14 +132,14 @@ double move_to_targets_phase::evaluate()
void move_to_targets_phase::execute() void move_to_targets_phase::execute()
{ {
unit_map::const_iterator leader = resources::gameboard->units().find_leader(get_side()); unit_map::const_iterator leader = resources::gameboard->units().find_leader(get_side());
LOG_AI << "finding targets...\n"; LOG_AI << "finding targets...";
std::vector<target> targets; std::vector<target> targets;
while(true) { while(true) {
if(targets.empty()) { if(targets.empty()) {
targets = find_targets(get_enemy_dstsrc()); targets = find_targets(get_enemy_dstsrc());
targets.insert(targets.end(),additional_targets().begin(), targets.insert(targets.end(),additional_targets().begin(),
additional_targets().end()); additional_targets().end());
LOG_AI << "Found " << targets.size() << " targets\n"; LOG_AI << "Found " << targets.size() << " targets";
if(targets.empty()) { if(targets.empty()) {
break; break;
} }
@ -151,9 +151,9 @@ void move_to_targets_phase::execute()
break; break;
} }
LOG_AI << "choosing move with " << targets.size() << " targets\n"; LOG_AI << "choosing move with " << targets.size() << " targets";
std::pair<map_location,map_location> move = choose_move(targets); std::pair<map_location,map_location> move = choose_move(targets);
LOG_AI << "choose_move ends with " << targets.size() << " targets\n"; LOG_AI << "choose_move ends with " << targets.size() << " targets";
for(std::vector<target>::const_iterator ittg = targets.begin(); for(std::vector<target>::const_iterator ittg = targets.begin();
ittg != targets.end(); ++ittg) { ittg != targets.end(); ++ittg) {
@ -270,7 +270,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
for(u = units_.begin(); u != units_.end(); ++u) { for(u = units_.begin(); u != units_.end(); ++u) {
if (!(u->side() != get_side() || (u->can_recruit() && !is_keep_ignoring_leader(u->id())) || u->movement_left() <= 0 || u->incapacitated())) { if (!(u->side() != get_side() || (u->can_recruit() && !is_keep_ignoring_leader(u->id())) || u->movement_left() <= 0 || u->incapacitated())) {
if (u->get_state("guardian")) { if (u->get_state("guardian")) {
LOG_AI << u->type_id() << " is guardian, staying still\n"; LOG_AI << u->type_id() << " is guardian, staying still";
return std::pair(u->get_location(), u->get_location()); return std::pair(u->get_location(), u->get_location());
} }
} }
@ -284,7 +284,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
} }
if(u == units_.end()) { if(u == units_.end()) {
LOG_AI << "no eligible units found\n"; LOG_AI << "no eligible units found";
return std::pair<map_location,map_location>(); return std::pair<map_location,map_location>();
} }
@ -360,7 +360,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
} }
} }
LOG_AI << "choose target...\n"; LOG_AI << "choose target...";
if(best_rated_target == rated_targets.end()) { if(best_rated_target == rated_targets.end()) {
LOG_AI << "no eligible targets found for unit at " << u->get_location(); LOG_AI << "no eligible targets found for unit at " << u->get_location();
@ -376,7 +376,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
bool simple_targeting = get_simple_targeting(); bool simple_targeting = get_simple_targeting();
if(simple_targeting == false) { if(simple_targeting == false) {
LOG_AI << "complex targeting...\n"; LOG_AI << "complex targeting...";
//now see if any other unit can put a better bid forward //now see if any other unit can put a better bid forward
for(++u; u != units_.end(); ++u) { for(++u; u != units_.end(); ++u) {
if (u->side() != get_side() || (u->can_recruit() && !is_keep_ignoring_leader(u->id())) || if (u->side() != get_side() || (u->can_recruit() && !is_keep_ignoring_leader(u->id())) ||
@ -410,7 +410,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
} }
} }
LOG_AI << "done complex targeting...\n"; LOG_AI << "done complex targeting...";
} else { } else {
u = units_.end(); u = units_.end();
} }
@ -423,7 +423,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
//see if we can move to a position in support of this target //see if we can move to a position in support of this target
const move_map& srcdst = get_srcdst(); const move_map& srcdst = get_srcdst();
if(best_target->type == ai_target::type::support) { if(best_target->type == ai_target::type::support) {
LOG_AI << "support...\n"; LOG_AI << "support...";
std::vector<map_location> locs; std::vector<map_location> locs;
access_points(srcdst, best->get_location(), best_target->loc, locs); access_points(srcdst, best->get_location(), best_target->loc, locs);
@ -446,7 +446,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
} }
} }
LOG_AI << "returning support...\n"; LOG_AI << "returning support...";
return std::pair(best->get_location(), best_loc); return std::pair(best->get_location(), best_loc);
} }
} }
@ -459,7 +459,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
bool dangerous = false; bool dangerous = false;
if(get_grouping() != "no") { if(get_grouping() != "no") {
LOG_AI << "grouping...\n"; LOG_AI << "grouping...";
const unit_map::const_iterator unit_at_target = units_.find(best_target->loc); const unit_map::const_iterator unit_at_target = units_.find(best_target->loc);
int movement = best->movement_left(); int movement = best->movement_left();
@ -484,11 +484,11 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
} }
} }
LOG_AI << "done grouping...\n"; LOG_AI << "done grouping...";
} }
if(dangerous) { if(dangerous) {
LOG_AI << "dangerous path\n"; LOG_AI << "dangerous path";
std::set<map_location> group, enemies; std::set<map_location> group, enemies;
const map_location dst = form_group(best_route.steps,dstsrc,group); const map_location dst = form_group(best_route.steps,dstsrc,group);
enemies_along_path(best_route.steps,enemy_dstsrc,enemies); enemies_along_path(best_route.steps,enemy_dstsrc,enemies);
@ -496,7 +496,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
const double our_strength = compare_groups(group,enemies,best_route.steps); const double our_strength = compare_groups(group,enemies,best_route.steps);
if(our_strength > 0.5 + get_caution()) { if(our_strength > 0.5 + get_caution()) {
LOG_AI << "moving group\n"; LOG_AI << "moving group";
const bool res = move_group(dst,best_route.steps,group); const bool res = move_group(dst,best_route.steps,group);
if(res) { if(res) {
return std::pair<map_location,map_location>(map_location(1,1),map_location()); return std::pair<map_location,map_location>(map_location(1,1),map_location());
@ -589,7 +589,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
return std::pair<map_location,map_location>(its.first->second,its.first->first); return std::pair<map_location,map_location>(its.first->second,its.first->first);
} else { } else {
LOG_AI << "dangerous!\n"; LOG_AI << "dangerous!";
is_dangerous = true; is_dangerous = true;
} }
} }
@ -599,7 +599,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
} }
if(best != units_.end()) { if(best != units_.end()) {
LOG_AI << "Could not make good move, staying still\n"; LOG_AI << "Could not make good move, staying still";
//this sounds like the road ahead might be dangerous, and that's why we don't advance. //this sounds like the road ahead might be dangerous, and that's why we don't advance.
//create this as a target, attempting to rally units around //create this as a target, attempting to rally units around
@ -608,7 +608,7 @@ std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vec
return std::pair(best->get_location(), best->get_location()); return std::pair(best->get_location(), best->get_location());
} }
LOG_AI << "Could not find anywhere to move!\n"; LOG_AI << "Could not find anywhere to move!";
return std::pair<map_location,map_location>(); return std::pair<map_location,map_location>();
} }
@ -708,7 +708,7 @@ bool move_to_targets_phase::move_group(const map_location& dst, const std::vecto
return false; return false;
} }
LOG_AI << "group has " << units.size() << " members\n"; LOG_AI << "group has " << units.size() << " members";
map_location next; map_location next;
@ -788,7 +788,7 @@ bool move_to_targets_phase::move_group(const map_location& dst, const std::vecto
} }
} }
} else { } else {
LOG_AI << "Could not move group member to any of " << preferred_moves.size() << " locations\n"; LOG_AI << "Could not move group member to any of " << preferred_moves.size() << " locations";
} }
} }

View file

@ -166,7 +166,7 @@ double recruitment::evaluate() {
recruitment_instructions_ = get_recruitment_instructions(); recruitment_instructions_ = get_recruitment_instructions();
integrate_recruitment_pattern_in_recruitment_instructions(); integrate_recruitment_pattern_in_recruitment_instructions();
recruitment_instructions_turn_ = resources::tod_manager->turn(); recruitment_instructions_turn_ = resources::tod_manager->turn();
LOG_AI_RECRUITMENT << "Recruitment-instructions updated:\n"; LOG_AI_RECRUITMENT << "Recruitment-instructions updated:";
LOG_AI_RECRUITMENT << recruitment_instructions_; LOG_AI_RECRUITMENT << recruitment_instructions_;
} }
@ -206,7 +206,7 @@ double recruitment::evaluate() {
} }
void recruitment::execute() { void recruitment::execute() {
LOG_AI_RECRUITMENT << "\n\n\n------------AI RECRUITMENT BEGIN---------------\n\n"; LOG_AI_RECRUITMENT << "\n\n\n------------AI RECRUITMENT BEGIN---------------\n";
LOG_AI_RECRUITMENT << "TURN: " << resources::tod_manager->turn() << LOG_AI_RECRUITMENT << "TURN: " << resources::tod_manager->turn() <<
" SIDE: " << current_team().side() << "\n"; " SIDE: " << current_team().side() << "\n";
@ -294,7 +294,7 @@ void recruitment::execute() {
if (data.in_danger) { if (data.in_danger) {
data.ratio_score = 50; data.ratio_score = 50;
state_ = LEADER_IN_DANGER; state_ = LEADER_IN_DANGER;
LOG_AI_RECRUITMENT << "Leader " << leader->name() << " is in danger.\n"; LOG_AI_RECRUITMENT << "Leader " << leader->name() << " is in danger.";
} }
leader_data.push_back(data); leader_data.push_back(data);
@ -335,7 +335,7 @@ void recruitment::execute() {
do_combat_analysis(&leader_data); do_combat_analysis(&leader_data);
LOG_AI_RECRUITMENT << "Scores before extra treatments:\n"; LOG_AI_RECRUITMENT << "Scores before extra treatments:";
for (const data& data : leader_data) { for (const data& data : leader_data) {
LOG_AI_RECRUITMENT << "\n" << data.to_string(); LOG_AI_RECRUITMENT << "\n" << data.to_string();
} }
@ -344,7 +344,7 @@ void recruitment::execute() {
do_randomness(&leader_data); do_randomness(&leader_data);
handle_recruitment_more(&leader_data); handle_recruitment_more(&leader_data);
LOG_AI_RECRUITMENT << "Scores after extra treatments:\n"; LOG_AI_RECRUITMENT << "Scores after extra treatments:";
for (const data& data : leader_data) { for (const data& data : leader_data) {
LOG_AI_RECRUITMENT << "\n" << data.to_string(); LOG_AI_RECRUITMENT << "\n" << data.to_string();
} }
@ -371,25 +371,25 @@ void recruitment::execute() {
job = get_most_important_job(); job = get_most_important_job();
if (!job) { if (!job) {
LOG_AI_RECRUITMENT << "All recruitment jobs (recruitment_instructions) done.\n"; LOG_AI_RECRUITMENT << "All recruitment jobs (recruitment_instructions) done.";
break; break;
} }
LOG_AI_RECRUITMENT << "Executing this job:\n" << *job; LOG_AI_RECRUITMENT << "Executing this job:\n" << *job;
data* best_leader_data = get_best_leader_from_ratio_scores(leader_data, job); data* best_leader_data = get_best_leader_from_ratio_scores(leader_data, job);
if (!best_leader_data) { if (!best_leader_data) {
LOG_AI_RECRUITMENT << "Leader with job (recruitment_instruction) is not on keep.\n"; LOG_AI_RECRUITMENT << "Leader with job (recruitment_instruction) is not on keep.";
if (remove_job_if_no_blocker(job)) { if (remove_job_if_no_blocker(job)) {
continue; continue;
} else { } else {
break; break;
} }
} }
LOG_AI_RECRUITMENT << "We want to have " << scouts_wanted_ << " more scouts.\n"; LOG_AI_RECRUITMENT << "We want to have " << scouts_wanted_ << " more scouts.";
const std::string best_recruit = get_best_recruit_from_scores(*best_leader_data, job); const std::string best_recruit = get_best_recruit_from_scores(*best_leader_data, job);
if (best_recruit.empty()) { if (best_recruit.empty()) {
LOG_AI_RECRUITMENT << "Cannot fulfill recruitment-instruction.\n"; LOG_AI_RECRUITMENT << "Cannot fulfill recruitment-instruction.";
if (remove_job_if_no_blocker(job)) { if (remove_job_if_no_blocker(job)) {
continue; continue;
} else { } else {
@ -431,7 +431,7 @@ void recruitment::execute() {
} }
} else { } else {
LOG_AI_RECRUITMENT << "Recruit result not ok.\n"; LOG_AI_RECRUITMENT << "Recruit result not ok.";
// We'll end up here if // We'll end up here if
// 1. We haven't enough gold, // 1. We haven't enough gold,
// 2. There aren't any free hexes around leaders, // 2. There aren't any free hexes around leaders,
@ -1273,7 +1273,7 @@ const std::string recruitment::get_random_pattern_type_if_exists(const data& lea
++job_types_it; ++job_types_it;
} else { } else {
// Erase Element. erase() will return iterator of next element. // Erase Element. erase() will return iterator of next element.
LOG_AI_RECRUITMENT << "Erase type " << *job_types_it << " from pattern.\n"; LOG_AI_RECRUITMENT << "Erase type " << *job_types_it << " from pattern.";
job_types_it = job_types.erase(job_types_it); job_types_it = job_types.erase(job_types_it);
} }
} }
@ -1432,11 +1432,11 @@ bool recruitment::recruit_matches_types(const std::string& recruit,
bool recruitment::remove_job_if_no_blocker(config* job) { bool recruitment::remove_job_if_no_blocker(config* job) {
assert(job); assert(job);
if ((*job)["blocker"].to_bool(true)) { if ((*job)["blocker"].to_bool(true)) {
LOG_AI_RECRUITMENT << "Canceling job.\n"; LOG_AI_RECRUITMENT << "Canceling job.";
job->clear(); job->clear();
return true; return true;
} else { } else {
LOG_AI_RECRUITMENT << "Aborting recruitment.\n"; LOG_AI_RECRUITMENT << "Aborting recruitment.";
return false; return false;
} }
} }
@ -1563,10 +1563,10 @@ void recruitment::update_state() {
if (state_ == NORMAL && ratio > save_gold_begin && income_estimation > 0) { if (state_ == NORMAL && ratio > save_gold_begin && income_estimation > 0) {
state_ = SAVE_GOLD; state_ = SAVE_GOLD;
LOG_AI_RECRUITMENT << "Changed state to SAVE_GOLD.\n"; LOG_AI_RECRUITMENT << "Changed state to SAVE_GOLD.";
} else if (state_ == SAVE_GOLD && ratio < save_gold_end) { } else if (state_ == SAVE_GOLD && ratio < save_gold_end) {
state_ = NORMAL; state_ = NORMAL;
LOG_AI_RECRUITMENT << "Changed state to NORMAL.\n"; LOG_AI_RECRUITMENT << "Changed state to NORMAL.";
} }
} }
@ -1664,7 +1664,7 @@ int recruitment::get_cheapest_unit_cost_for_leader(const unit_map::const_iterato
if (!current_team().recall_list().empty() && current_team().recall_cost() < cheapest_cost) { if (!current_team().recall_list().empty() && current_team().recall_cost() < cheapest_cost) {
cheapest_cost = current_team().recall_cost(); cheapest_cost = current_team().recall_cost();
} }
LOG_AI_RECRUITMENT << "Cheapest unit cost updated to " << cheapest_cost << ".\n"; LOG_AI_RECRUITMENT << "Cheapest unit cost updated to " << cheapest_cost << ".";
cheapest_unit_costs_[leader->underlying_id()] = cheapest_cost; cheapest_unit_costs_[leader->underlying_id()] = cheapest_cost;
return cheapest_cost; return cheapest_cost;
} }
@ -1786,7 +1786,7 @@ recruitment::recruit_situation_change_observer::recruit_situation_change_observe
void recruitment::recruit_situation_change_observer::handle_generic_event( void recruitment::recruit_situation_change_observer::handle_generic_event(
const std::string& event) { const std::string& event) {
if (event == "ai_recruit_list_changed") { if (event == "ai_recruit_list_changed") {
LOG_AI_RECRUITMENT << "Recruitment List is not valid anymore.\n"; LOG_AI_RECRUITMENT << "Recruitment List is not valid anymore.";
set_recruit_list_changed(true); set_recruit_list_changed(true);
} else { } else {
++gamestate_changed_; ++gamestate_changed_;

View file

@ -188,7 +188,7 @@ wfl::variant formula_ai::make_action(wfl::const_formula_ptr formula_, const wfl:
if (!formula_) { if (!formula_) {
throw formula_error("null formula passed to make_action","","formula",0); throw formula_error("null formula passed to make_action","","formula",0);
} }
LOG_AI << "do move...\n"; LOG_AI << "do move...";
const variant var = formula_->evaluate(variables); const variant var = formula_->evaluate(variables);
variant res; variant res;

View file

@ -92,7 +92,7 @@ variant move_callable::execute_self(variant ctxt) {
move_result_ptr move_result = ai.execute_move_action(src_, dst_, true); move_result_ptr move_result = ai.execute_move_action(src_, dst_, true);
if(!move_result->is_ok()) { if(!move_result->is_ok()) {
LOG_AI << "ERROR #" << move_result->get_status() << " while executing 'move' formula function\n"; LOG_AI << "ERROR #" << move_result->get_status() << " while executing 'move' formula function";
return variant(std::make_shared<safe_call_result>(fake_ptr(), move_result->get_status(), move_result->get_unit_location())); return variant(std::make_shared<safe_call_result>(fake_ptr(), move_result->get_status(), move_result->get_unit_location()));
} }
@ -121,7 +121,7 @@ variant move_partial_callable::execute_self(variant ctxt) {
move_result_ptr move_result = ai.execute_move_action(src_, dst_, false); move_result_ptr move_result = ai.execute_move_action(src_, dst_, false);
if(!move_result->is_ok()) { if(!move_result->is_ok()) {
LOG_AI << "ERROR #" << move_result->get_status() << " while executing 'move_partial' formula function\n"; LOG_AI << "ERROR #" << move_result->get_status() << " while executing 'move_partial' formula function";
return variant(std::make_shared<safe_call_result>(fake_ptr(), move_result->get_status(), move_result->get_unit_location())); return variant(std::make_shared<safe_call_result>(fake_ptr(), move_result->get_status(), move_result->get_unit_location()));
} }
@ -224,7 +224,7 @@ variant attack_callable::execute_self(variant ctxt) {
if(!move_result->is_ok()) { if(!move_result->is_ok()) {
//move part failed //move part failed
LOG_AI << "ERROR #" << move_result->get_status() << " while executing 'attack' formula function\n"; LOG_AI << "ERROR #" << move_result->get_status() << " while executing 'attack' formula function";
return variant(std::make_shared<safe_call_result>(fake_ptr(), move_result->get_status(), move_result->get_unit_location())); return variant(std::make_shared<safe_call_result>(fake_ptr(), move_result->get_status(), move_result->get_unit_location()));
} }
} }
@ -235,7 +235,7 @@ variant attack_callable::execute_self(variant ctxt) {
gamestate_changed |= attack_result->is_gamestate_changed(); gamestate_changed |= attack_result->is_gamestate_changed();
if(!attack_result->is_ok()) { if(!attack_result->is_ok()) {
//attack failed //attack failed
LOG_AI << "ERROR #" << attack_result->get_status() << " while executing 'attack' formula function\n"; LOG_AI << "ERROR #" << attack_result->get_status() << " while executing 'attack' formula function";
return variant(std::make_shared<safe_call_result>(fake_ptr(), attack_result->get_status())); return variant(std::make_shared<safe_call_result>(fake_ptr(), attack_result->get_status()));
} }
} }
@ -309,7 +309,7 @@ variant recall_callable::execute_self(variant ctxt) {
if(recall_result->is_ok()) { if(recall_result->is_ok()) {
recall_result->execute(); recall_result->execute();
} else { } else {
LOG_AI << "ERROR #" << recall_result->get_status() << " while executing 'recall' formula function\n"; LOG_AI << "ERROR #" << recall_result->get_status() << " while executing 'recall' formula function";
return variant(std::make_shared<safe_call_result>(fake_ptr(), recall_result->get_status())); return variant(std::make_shared<safe_call_result>(fake_ptr(), recall_result->get_status()));
} }
@ -338,7 +338,7 @@ variant recruit_callable::execute_self(variant ctxt) {
if(recruit_result->is_ok()) { if(recruit_result->is_ok()) {
recruit_result->execute(); recruit_result->execute();
} else { } else {
LOG_AI << "ERROR #" << recruit_result->get_status() << " while executing 'recruit' formula function\n"; LOG_AI << "ERROR #" << recruit_result->get_status() << " while executing 'recruit' formula function";
return variant(std::make_shared<safe_call_result>(fake_ptr(), recruit_result->get_status())); return variant(std::make_shared<safe_call_result>(fake_ptr(), recruit_result->get_status()));
} }

View file

@ -860,7 +860,7 @@ DEFINE_WFL_FUNCTION(move, 2, 2)
{ {
const map_location src = args()[0]->evaluate(variables, add_debug_info(fdb, 0, "move:src")).convert_to<location_callable>()->loc(); const map_location src = args()[0]->evaluate(variables, add_debug_info(fdb, 0, "move:src")).convert_to<location_callable>()->loc();
const map_location dst = args()[1]->evaluate(variables, add_debug_info(fdb, 1, "move:dst")).convert_to<location_callable>()->loc(); const map_location dst = args()[1]->evaluate(variables, add_debug_info(fdb, 1, "move:dst")).convert_to<location_callable>()->loc();
LOG_AI << "move(): " << src << ", " << dst << ")\n"; LOG_AI << "move(): " << src << ", " << dst << ")";
return variant(std::make_shared<move_callable>(src, dst)); return variant(std::make_shared<move_callable>(src, dst));
} }
@ -868,7 +868,7 @@ DEFINE_WFL_FUNCTION(move_partial, 2, 2)
{ {
const map_location src = args()[0]->evaluate(variables, add_debug_info(fdb, 0, "move_partial:src")).convert_to<location_callable>()->loc(); const map_location src = args()[0]->evaluate(variables, add_debug_info(fdb, 0, "move_partial:src")).convert_to<location_callable>()->loc();
const map_location dst = args()[1]->evaluate(variables, add_debug_info(fdb, 1, "move_partial:dst")).convert_to<location_callable>()->loc(); const map_location dst = args()[1]->evaluate(variables, add_debug_info(fdb, 1, "move_partial:dst")).convert_to<location_callable>()->loc();
LOG_AI << "move_partial(): " << src << ", " << dst << ")\n"; LOG_AI << "move_partial(): " << src << ", " << dst << ")";
return variant(std::make_shared<move_partial_callable>(src, dst)); return variant(std::make_shared<move_partial_callable>(src, dst));
} }

View file

@ -76,7 +76,7 @@ const std::vector<std::string> unit_advancements_aspect::get_advancements(const
const int unit_x = (*unit).get_location().wml_x(); const int unit_x = (*unit).get_location().wml_x();
const int unit_y = (*unit).get_location().wml_y(); const int unit_y = (*unit).get_location().wml_y();
LOG_LUA << "Entering unit_advancements_aspect::get_advancements() in instance " << this << " with unit " << unit_id << " on (x,y) = (" << unit_x << ", " << unit_y << ")\n"; LOG_LUA << "Entering unit_advancements_aspect::get_advancements() in instance " << this << " with unit " << unit_id << " on (x,y) = (" << unit_x << ", " << unit_y << ")";
if(L_ == nullptr || ref_ == LUA_REFNIL) if(L_ == nullptr || ref_ == LUA_REFNIL)
{ {
@ -126,7 +126,7 @@ const std::vector<std::string> unit_advancements_aspect::get_advancements(const
const std::string retval = std::string(lua_tostring(L_, -1)); const std::string retval = std::string(lua_tostring(L_, -1));
lua_pop(L_, 1); lua_pop(L_, 1);
LOG_LUA << "Called Lua advancement function. Result was: \"" << retval << "\".\n"; LOG_LUA << "Called Lua advancement function. Result was: \"" << retval << "\".";
return utils::split(retval); return utils::split(retval);
} }

View file

@ -295,14 +295,14 @@ inline std::shared_ptr<std::vector<target> > lua_object< std::vector<target> >::
int target = static_cast<int>(lua_tointeger(L, -1)); int target = static_cast<int>(lua_tointeger(L, -1));
type = ai_target::get_enum(target); // st n + 2 type = ai_target::get_enum(target); // st n + 2
if(!type) { if(!type) {
ERR_OBJ_LUA << "Failed to convert ai target type of " << target << ", skipping.\n"; ERR_OBJ_LUA << "Failed to convert ai target type of " << target << ", skipping.";
continue; continue;
} }
} else if(lua_isstring(L, -1)) { } else if(lua_isstring(L, -1)) {
std::string target = lua_tostring(L, -1); std::string target = lua_tostring(L, -1);
type = ai_target::get_enum(target); // st n + 2 type = ai_target::get_enum(target); // st n + 2
if(!type) { if(!type) {
ERR_OBJ_LUA << "Failed to convert ai target type of " << target << ", skipping.\n"; ERR_OBJ_LUA << "Failed to convert ai target type of " << target << ", skipping.";
continue; continue;
} }
} }

View file

@ -138,7 +138,7 @@ carryover_info::carryover_info(const config& cfg, bool from_snpashot)
{ {
//this shouldn't happen outside a snpshot. //this shouldn't happen outside a snpshot.
if(!from_snpashot) { if(!from_snpashot) {
ERR_NG << "found invalid carryover data in saved game, lost='" << side["lost"] << "' persistent='" << side["persistent"] << "' save_id='" << side["save_id"] << "'\n"; ERR_NG << "found invalid carryover data in saved game, lost='" << side["lost"] << "' persistent='" << side["persistent"] << "' save_id='" << side["save_id"] << "'";
} }
continue; continue;
} }

View file

@ -405,7 +405,7 @@ config& config::child(config_key_type key, int n)
const child_map::const_iterator i = children_.find(key); const child_map::const_iterator i = children_.find(key);
if(i == children_.end()) { if(i == children_.end()) {
DBG_CF << "The config object has no child named »" << key << "«.\n"; DBG_CF << "The config object has no child named »" << key << "«.";
if(throw_when_child_not_found::do_throw()) { if(throw_when_child_not_found::do_throw()) {
throw error("Child not found"); throw error("Child not found");
@ -735,7 +735,7 @@ void config::remove_child(config_key_type key, unsigned index)
child_map::iterator i = children_.find(key); child_map::iterator i = children_.find(key);
if(i == children_.end() || index >= i->second.size()) { if(i == children_.end() || index >= i->second.size()) {
ERR_CF << "Error: attempting to delete non-existing child: " << key << "[" << index << "]\n"; ERR_CF << "Error: attempting to delete non-existing child: " << key << "[" << index << "]";
return; return;
} }
@ -888,7 +888,7 @@ config& config::find_child(config_key_type key, const std::string& name, const s
const child_map::iterator i = children_.find(key); const child_map::iterator i = children_.find(key);
if(i == children_.end()) { if(i == children_.end()) {
DBG_CF << "Key »" << name << "« value »" << value << "« pair not found as child of key »" << key << "«.\n"; DBG_CF << "Key »" << name << "« value »" << value << "« pair not found as child of key »" << key << "«.";
if(throw_when_child_not_found::do_throw()) { if(throw_when_child_not_found::do_throw()) {
throw error("Child not found"); throw error("Child not found");
@ -908,7 +908,7 @@ config& config::find_child(config_key_type key, const std::string& name, const s
return **j; return **j;
} }
DBG_CF << "Key »" << name << "« value »" << value << "« pair not found as child of key »" << key << "«.\n"; DBG_CF << "Key »" << name << "« value »" << value << "« pair not found as child of key »" << key << "«.";
if(throw_when_child_not_found::do_throw()) { if(throw_when_child_not_found::do_throw()) {
throw error("Child not found"); throw error("Child not found");

View file

@ -204,7 +204,7 @@ void config_cache::read_cache(const std::string& file_path, config& cfg, abstrac
} }
if(force_valid_cache_) { if(force_valid_cache_) {
LOG_CACHE << "skipping cache validation (forced)\n"; LOG_CACHE << "skipping cache validation (forced)";
} }
if(filesystem::file_exists(fname + extension) && (force_valid_cache_ || (dir_checksum == filesystem::data_tree_checksum()))) { if(filesystem::file_exists(fname + extension) && (force_valid_cache_ || (dir_checksum == filesystem::data_tree_checksum()))) {
@ -230,7 +230,7 @@ void config_cache::read_cache(const std::string& file_path, config& cfg, abstrac
} }
} }
LOG_CACHE << "no valid cache found. Writing cache to '" << fname << extension << " with defines_map "<< defines_string.str() << "'\n"; LOG_CACHE << "no valid cache found. Writing cache to '" << fname << extension << " with defines_map "<< defines_string.str() << "'";
// Now we need queued defines so read them to memory // Now we need queued defines so read them to memory
read_defines_queue(); read_defines_queue();
@ -255,7 +255,7 @@ void config_cache::read_cache(const std::string& file_path, config& cfg, abstrac
return; return;
} }
LOG_CACHE << "Loading plain config instead of cache\n"; LOG_CACHE << "Loading plain config instead of cache";
preproc_map copy_map(make_copy_map()); preproc_map copy_map(make_copy_map());
read_configs(file_path, cfg, copy_map, validator); read_configs(file_path, cfg, copy_map, validator);
@ -358,7 +358,7 @@ bool config_cache::clean_cache()
status &= delete_cache_files(files, exclude_current); status &= delete_cache_files(files, exclude_current);
status &= delete_cache_files(dirs, exclude_current); status &= delete_cache_files(dirs, exclude_current);
LOG_CACHE << "clean_cache(): done\n"; LOG_CACHE << "clean_cache(): done";
return status; return status;
} }
@ -376,7 +376,7 @@ bool config_cache::purge_cache()
status &= delete_cache_files(files); status &= delete_cache_files(files);
status &= delete_cache_files(dirs); status &= delete_cache_files(dirs);
LOG_CACHE << "purge_cache(): done\n"; LOG_CACHE << "purge_cache(): done";
return status; return status;
} }

View file

@ -170,7 +170,7 @@ uint32_t send_dbus_notification(DBusConnection *connection, uint32_t replaces_id
<< "raw path =\'" << game_config::path << "\' / \'" << game_config::images::app_icon << "\'\n" << "raw path =\'" << game_config::path << "\' / \'" << game_config::images::app_icon << "\'\n"
<< "normalized path =\'" << app_icon_ << "\'\n"; << "normalized path =\'" << app_icon_ << "\'\n";
} else { } else {
DBG_DU << "app_icon_=\'" << app_icon_ << "\'\n"; DBG_DU << "app_icon_=\'" << app_icon_ << "\'";
} }
const char *app_icon = app_icon_.c_str(); const char *app_icon = app_icon_.c_str();

View file

@ -51,10 +51,10 @@ bool open_object([[maybe_unused]] const std::string& path_or_url)
#if defined(_X11) || defined(__APPLE__) #if defined(_X11) || defined(__APPLE__)
#ifndef __APPLE__ #ifndef __APPLE__
LOG_DU << "open_object(): on X11, will use xdg-open\n"; LOG_DU << "open_object(): on X11, will use xdg-open";
const char launcher[] = "xdg-open"; const char launcher[] = "xdg-open";
#else #else
LOG_DU << "open_object(): on OS X, will use open\n"; LOG_DU << "open_object(): on OS X, will use open";
const char launcher[] = "open"; const char launcher[] = "open";
#endif #endif
@ -75,7 +75,7 @@ bool open_object([[maybe_unused]] const std::string& path_or_url)
#elif defined(_WIN32) #elif defined(_WIN32)
LOG_DU << "open_object(): on Win32, will use ShellExecute()\n"; LOG_DU << "open_object(): on Win32, will use ShellExecute()";
std::wstring u16path = unicode_cast<std::wstring>(path_or_url); std::wstring u16path = unicode_cast<std::wstring>(path_or_url);

View file

@ -69,7 +69,7 @@ void enumerate_storage_devices(std::vector<path_info>& res)
std::string u8drive = "A:"; std::string u8drive = "A:";
u8drive[0] += n; u8drive[0] += n;
LOG_DU << "enumerate_win32_drives(): " << u8drive << " is reported to be present\n"; LOG_DU << "enumerate_win32_drives(): " << u8drive << " is reported to be present";
wchar_t drive[] = L"A:\\"; wchar_t drive[] = L"A:\\";
drive[0] += n; drive[0] += n;
@ -80,7 +80,7 @@ void enumerate_storage_devices(std::vector<path_info>& res)
if(GetVolumeInformation(drive, label, label_bufsize, nullptr, nullptr, nullptr, nullptr, 0) == 0) { if(GetVolumeInformation(drive, label, label_bufsize, nullptr, nullptr, nullptr, nullptr, 0) == 0) {
// Probably an empty removable drive, just ignore it and carry on. // Probably an empty removable drive, just ignore it and carry on.
const DWORD err = GetLastError(); const DWORD err = GetLastError();
LOG_DU << "enumerate_win32_drives(): GetVolumeInformation() failed (" << err << ")\n"; LOG_DU << "enumerate_win32_drives(): GetVolumeInformation() failed (" << err << ")";
continue; continue;
} }
@ -111,14 +111,14 @@ void enumerate_storage_devices(std::vector<path_info>& res)
bsys::error_code e; bsys::error_code e;
try { try {
if(bfs::is_directory(mnt, e) && !bfs::is_empty(mnt, e) && !e) { if(bfs::is_directory(mnt, e) && !bfs::is_empty(mnt, e) && !e) {
DBG_DU << "enumerate_mount_parents(): " << mnt << " appears to be a non-empty dir\n"; DBG_DU << "enumerate_mount_parents(): " << mnt << " appears to be a non-empty dir";
res.push_back({mnt, "", mnt}); res.push_back({mnt, "", mnt});
} }
} }
catch(...) { catch(...) {
//bool is_empty(const path& p, system::error_code& ec) might throw. //bool is_empty(const path& p, system::error_code& ec) might throw.
//For example if you have no permission on that directory. Don't list the file in that case. //For example if you have no permission on that directory. Don't list the file in that case.
DBG_DU << "caught exception in enumerate_storage_devices\n"; DBG_DU << "caught exception in enumerate_storage_devices";
} }
} }

View file

@ -221,7 +221,7 @@ std::string os_version()
struct utsname u; struct utsname u;
if(uname(&u) != 0) { if(uname(&u) != 0) {
ERR_DU << "os_version: uname error (" << strerror(errno) << ")\n"; ERR_DU << "os_version: uname error (" << strerror(errno) << ")";
} }
#endif #endif
@ -403,7 +403,7 @@ std::string os_version()
// "I don't know where I am" version. // "I don't know where I am" version.
// //
ERR_DU << "os_version(): unsupported platform\n"; ERR_DU << "os_version(): unsupported platform";
return _("operating_system^<unknown>"); return _("operating_system^<unknown>");
#endif #endif

View file

@ -771,7 +771,7 @@ surface display::screenshot(bool map_screenshot)
} }
if (get_map().empty()) { if (get_map().empty()) {
ERR_DP << "No map loaded, cannot create a map screenshot.\n"; ERR_DP << "No map loaded, cannot create a map screenshot.";
return nullptr; return nullptr;
} }
@ -830,7 +830,7 @@ std::shared_ptr<gui::button> display::find_menu_button(const std::string& id)
void display::layout_buttons() void display::layout_buttons()
{ {
DBG_DP << "positioning menu buttons...\n"; DBG_DP << "positioning menu buttons...";
for(const auto& menu : theme_.menus()) { for(const auto& menu : theme_.menus()) {
if(auto b = find_menu_button(menu.get_id())) { if(auto b = find_menu_button(menu.get_id())) {
const SDL_Rect& loc = menu.location(screen_.draw_area()); const SDL_Rect& loc = menu.location(screen_.draw_area());
@ -841,7 +841,7 @@ void display::layout_buttons()
} }
} }
DBG_DP << "positioning action buttons...\n"; DBG_DP << "positioning action buttons...";
for(const auto& action : theme_.actions()) { for(const auto& action : theme_.actions()) {
if(auto b = find_action_button(action.get_id())) { if(auto b = find_action_button(action.get_id())) {
const SDL_Rect& loc = action.location(screen_.draw_area()); const SDL_Rect& loc = action.location(screen_.draw_area());
@ -887,7 +887,7 @@ void display::create_buttons()
menu_buttons_.clear(); menu_buttons_.clear();
action_buttons_.clear(); action_buttons_.clear();
DBG_DP << "creating menu buttons...\n"; DBG_DP << "creating menu buttons...";
for(const auto& menu : theme_.menus()) { for(const auto& menu : theme_.menus()) {
if(!menu.is_button()) { if(!menu.is_button()) {
continue; continue;
@ -909,7 +909,7 @@ void display::create_buttons()
menu_buttons_.push_back(std::move(b)); menu_buttons_.push_back(std::move(b));
} }
DBG_DP << "creating action buttons...\n"; DBG_DP << "creating action buttons...";
for(const auto& action : theme_.actions()) { for(const auto& action : theme_.actions()) {
auto b = std::make_shared<gui::button>(screen_, action.title(), string_to_button_type(action.type()), auto b = std::make_shared<gui::button>(screen_, action.title(), string_to_button_type(action.type()),
action.image(), gui::button::DEFAULT_SPACE, true, action.overlay(), font::SIZE_BUTTON_SMALL); action.image(), gui::button::DEFAULT_SPACE, true, action.overlay(), font::SIZE_BUTTON_SMALL);
@ -931,7 +931,7 @@ void display::create_buttons()
} }
layout_buttons(); layout_buttons();
DBG_DP << "buttons created\n"; DBG_DP << "buttons created";
} }
void display::draw_buttons() void display::draw_buttons()
@ -1645,7 +1645,7 @@ void display::draw_init()
} }
if(invalidateAll_) { if(invalidateAll_) {
DBG_DP << "draw() with invalidateAll\n"; DBG_DP << "draw() with invalidateAll";
// toggle invalidateAll_ first to allow regular invalidations // toggle invalidateAll_ first to allow regular invalidations
invalidateAll_ = false; invalidateAll_ = false;
@ -3154,7 +3154,7 @@ void display::draw_reports()
void display::invalidate_all() void display::invalidate_all()
{ {
DBG_DP << "invalidate_all()\n"; DBG_DP << "invalidate_all()";
invalidateAll_ = true; invalidateAll_ = true;
invalidated_.clear(); invalidated_.clear();
} }

View file

@ -194,7 +194,7 @@ void editor_controller::do_screenshot(const std::string& screenshot_filename /*
try { try {
surface screenshot = gui().screenshot(true); surface screenshot = gui().screenshot(true);
if(!screenshot || image::save_image(screenshot, screenshot_filename) != image::save_result::success) { if(!screenshot || image::save_image(screenshot, screenshot_filename) != image::save_result::success) {
ERR_ED << "Screenshot creation failed!\n"; ERR_ED << "Screenshot creation failed!";
} }
} catch (const wml_exception& e) { } catch (const wml_exception& e) {
e.show(); e.show();
@ -1304,7 +1304,7 @@ bool editor_controller::left_click(int x, int y, const bool browse)
if (mouse_handler_base::left_click(x, y, browse)) if (mouse_handler_base::left_click(x, y, browse))
return true; return true;
LOG_ED << "Left click, after generic handling\n"; LOG_ED << "Left click, after generic handling";
map_location hex_clicked = gui().hex_clicked_on(x, y); map_location hex_clicked = gui().hex_clicked_on(x, y);
if (!get_current_map_context().map().on_board_with_border(hex_clicked)) if (!get_current_map_context().map().on_board_with_border(hex_clicked))
return true; return true;
@ -1340,7 +1340,7 @@ bool editor_controller::right_click(int x, int y, const bool browse)
{ {
toolkit_->clear_mouseover_overlay(); toolkit_->clear_mouseover_overlay();
if (mouse_handler_base::right_click(x, y, browse)) return true; if (mouse_handler_base::right_click(x, y, browse)) return true;
LOG_ED << "Right click, after generic handling\n"; LOG_ED << "Right click, after generic handling";
map_location hex_clicked = gui().hex_clicked_on(x, y); map_location hex_clicked = gui().hex_clicked_on(x, y);
if (!get_current_map_context().map().on_board_with_border(hex_clicked)) return true; if (!get_current_map_context().map().on_board_with_border(hex_clicked)) return true;
LOG_ED << "Right click action " << hex_clicked; LOG_ED << "Right click action " << hex_clicked;

View file

@ -390,7 +390,7 @@ void map_context::draw_terrain_actual(
if(!map_.on_board_with_border(loc)) { if(!map_.on_board_with_border(loc)) {
// requests for painting off the map are ignored in set_terrain anyway, // requests for painting off the map are ignored in set_terrain anyway,
// but ideally we should not have any // but ideally we should not have any
LOG_ED << "Attempted to draw terrain off the map (" << loc << ")\n"; LOG_ED << "Attempted to draw terrain off the map (" << loc << ")";
return; return;
} }

View file

@ -267,7 +267,7 @@ void location_palette::adjust_size(const SDL_Rect& target)
_("Invalid location id") _("Invalid location id")
); );
//TODO: a user visible messae would be nice. //TODO: a user visible messae would be nice.
ERR_ED << "entered invalid location id\n"; ERR_ED << "entered invalid location id";
} }
} }
})); }));

View file

@ -303,10 +303,10 @@ static bool create_directory_if_missing(const bfs::path& dirpath)
ERR_FS << "Failed to retrieve file status for " << dirpath.string() << ": " << ec.message(); ERR_FS << "Failed to retrieve file status for " << dirpath.string() << ": " << ec.message();
return false; return false;
} else if(bfs::is_directory(fs)) { } else if(bfs::is_directory(fs)) {
DBG_FS << "directory " << dirpath.string() << " exists, not creating\n"; DBG_FS << "directory " << dirpath.string() << " exists, not creating";
return true; return true;
} else if(bfs::exists(fs)) { } else if(bfs::exists(fs)) {
ERR_FS << "cannot create directory " << dirpath.string() << "; file exists\n"; ERR_FS << "cannot create directory " << dirpath.string() << "; file exists";
return false; return false;
} }
@ -553,7 +553,7 @@ const std::string& get_version_path_suffix()
LOG_FS << "Apple developer's userdata migration: symlinking " << old_saves_dir.string() << " to " << new_saves_dir.string(); LOG_FS << "Apple developer's userdata migration: symlinking " << old_saves_dir.string() << " to " << new_saves_dir.string();
bfs::create_symlink(new_saves_dir, old_saves_dir); bfs::create_symlink(new_saves_dir, old_saves_dir);
} else if(!bfs::symbolic_link_exists(old_saves_dir)) { } else if(!bfs::symbolic_link_exists(old_saves_dir)) {
ERR_FS << "Apple developer's userdata migration: Problem! Old (non-containerized) directory " << old_saves_dir.string() << " is not a symlink. Your savegames are scattered around 2 locations.\n"; ERR_FS << "Apple developer's userdata migration: Problem! Old (non-containerized) directory " << old_saves_dir.string() << " is not a symlink. Your savegames are scattered around 2 locations.";
} }
return; return;
} }
@ -1004,10 +1004,10 @@ std::string read_file(const std::string& fname)
filesystem::scoped_istream istream_file(const std::string& fname, bool treat_failure_as_error) filesystem::scoped_istream istream_file(const std::string& fname, bool treat_failure_as_error)
{ {
LOG_FS << "Streaming " << fname << " for reading.\n"; LOG_FS << "Streaming " << fname << " for reading.";
if(fname.empty()) { if(fname.empty()) {
ERR_FS << "Trying to open file with empty name.\n"; ERR_FS << "Trying to open file with empty name.";
filesystem::scoped_istream s(new bfs::ifstream()); filesystem::scoped_istream s(new bfs::ifstream());
s->clear(std::ios_base::failbit); s->clear(std::ios_base::failbit);
return s; return s;
@ -1020,9 +1020,9 @@ filesystem::scoped_istream istream_file(const std::string& fname, bool treat_fai
// TODO: has this still use ? // TODO: has this still use ?
if(!fd.is_open() && treat_failure_as_error) { if(!fd.is_open() && treat_failure_as_error) {
ERR_FS << "Could not open '" << fname << "' for reading.\n"; ERR_FS << "Could not open '" << fname << "' for reading.";
} else if(!is_filename_case_correct(fname, fd)) { } else if(!is_filename_case_correct(fname, fd)) {
ERR_FS << "Not opening '" << fname << "' due to case mismatch.\n"; ERR_FS << "Not opening '" << fname << "' due to case mismatch.";
filesystem::scoped_istream s(new bfs::ifstream()); filesystem::scoped_istream s(new bfs::ifstream());
s->clear(std::ios_base::failbit); s->clear(std::ios_base::failbit);
return s; return s;
@ -1031,7 +1031,7 @@ filesystem::scoped_istream istream_file(const std::string& fname, bool treat_fai
return std::make_unique<boost::iostreams::stream<boost::iostreams::file_descriptor_source>>(fd, 4096, 0); return std::make_unique<boost::iostreams::stream<boost::iostreams::file_descriptor_source>>(fd, 4096, 0);
} catch(const std::exception&) { } catch(const std::exception&) {
if(treat_failure_as_error) { if(treat_failure_as_error) {
ERR_FS << "Could not open '" << fname << "' for reading.\n"; ERR_FS << "Could not open '" << fname << "' for reading.";
} }
filesystem::scoped_istream s(new bfs::ifstream()); filesystem::scoped_istream s(new bfs::ifstream());
@ -1042,7 +1042,7 @@ filesystem::scoped_istream istream_file(const std::string& fname, bool treat_fai
filesystem::scoped_ostream ostream_file(const std::string& fname, std::ios_base::openmode mode, bool create_directory) filesystem::scoped_ostream ostream_file(const std::string& fname, std::ios_base::openmode mode, bool create_directory)
{ {
LOG_FS << "streaming " << fname << " for writing.\n"; LOG_FS << "streaming " << fname << " for writing.";
#if 1 #if 1
try { try {
boost::iostreams::file_descriptor_sink fd(bfs::path(fname), mode); boost::iostreams::file_descriptor_sink fd(bfs::path(fname), mode);
@ -1324,7 +1324,7 @@ void binary_paths_manager::set_paths(const game_config_view& cfg)
for(const config& bp : cfg.child_range("binary_path")) { for(const config& bp : cfg.child_range("binary_path")) {
std::string path = bp["path"].str(); std::string path = bp["path"].str();
if(path.find("..") != std::string::npos) { if(path.find("..") != std::string::npos) {
ERR_FS << "Invalid binary path '" << path << "'\n"; ERR_FS << "Invalid binary path '" << path << "'";
continue; continue;
} }
@ -1353,15 +1353,15 @@ void clear_binary_paths_cache()
static bool is_legal_file(const std::string& filename_str) static bool is_legal_file(const std::string& filename_str)
{ {
DBG_FS << "Looking for '" << filename_str << "'.\n"; DBG_FS << "Looking for '" << filename_str << "'.";
if(filename_str.empty()) { if(filename_str.empty()) {
LOG_FS << " invalid filename\n"; LOG_FS << " invalid filename";
return false; return false;
} }
if(filename_str.find("..") != std::string::npos) { if(filename_str.find("..") != std::string::npos) {
ERR_FS << "Illegal path '" << filename_str << "' (\"..\" not allowed).\n"; ERR_FS << "Illegal path '" << filename_str << "' (\"..\" not allowed).";
return false; return false;
} }
@ -1400,7 +1400,7 @@ const std::vector<std::string>& get_binary_paths(const std::string& type)
if(type.find("..") != std::string::npos) { if(type.find("..") != std::string::npos) {
// Not an assertion, as language.cpp is passing user data as type. // Not an assertion, as language.cpp is passing user data as type.
ERR_FS << "Invalid WML type '" << type << "' for binary paths\n"; ERR_FS << "Invalid WML type '" << type << "' for binary paths";
static std::vector<std::string> dummy; static std::vector<std::string> dummy;
return dummy; return dummy;
} }
@ -1451,10 +1451,10 @@ std::string get_binary_file_location(const std::string& type, const std::string&
bfs::path bpath(bp); bfs::path bpath(bp);
bpath /= filename; bpath /= filename;
DBG_FS << " checking '" << bp << "'\n"; DBG_FS << " checking '" << bp << "'";
if(file_exists(bpath)) { if(file_exists(bpath)) {
DBG_FS << " found at '" << bpath.string() << "'\n"; DBG_FS << " found at '" << bpath.string() << "'";
if(result.empty()) { if(result.empty()) {
result = bpath.string(); result = bpath.string();
} else { } else {
@ -1464,7 +1464,7 @@ std::string get_binary_file_location(const std::string& type, const std::string&
} }
} }
DBG_FS << " not found\n"; DBG_FS << " not found";
return result; return result;
} }
@ -1477,14 +1477,14 @@ std::string get_binary_dir_location(const std::string& type, const std::string&
for(const std::string& bp : get_binary_paths(type)) { for(const std::string& bp : get_binary_paths(type)) {
bfs::path bpath(bp); bfs::path bpath(bp);
bpath /= filename; bpath /= filename;
DBG_FS << " checking '" << bp << "'\n"; DBG_FS << " checking '" << bp << "'";
if(is_directory_internal(bpath)) { if(is_directory_internal(bpath)) {
DBG_FS << " found at '" << bpath.string() << "'\n"; DBG_FS << " found at '" << bpath.string() << "'";
return bpath.string(); return bpath.string();
} }
} }
DBG_FS << " not found\n"; DBG_FS << " not found";
return std::string(); return std::string();
} }
@ -1501,7 +1501,7 @@ std::string get_wml_location(const std::string& filename, const std::string& cur
if(filename[0] == '~') { if(filename[0] == '~') {
result /= get_user_data_path() / "data" / filename.substr(1); result /= get_user_data_path() / "data" / filename.substr(1);
DBG_FS << " trying '" << result.string() << "'\n"; DBG_FS << " trying '" << result.string() << "'";
} else if(*fpath.begin() == ".") { } else if(*fpath.begin() == ".") {
if(!current_dir.empty()) { if(!current_dir.empty()) {
result /= bfs::path(current_dir); result /= bfs::path(current_dir);
@ -1515,10 +1515,10 @@ std::string get_wml_location(const std::string& filename, const std::string& cur
} }
if(result.empty() || !file_exists(result)) { if(result.empty() || !file_exists(result)) {
DBG_FS << " not found\n"; DBG_FS << " not found";
result.clear(); result.clear();
} else { } else {
DBG_FS << " found: '" << result.string() << "'\n"; DBG_FS << " found: '" << result.string() << "'";
} }
return result.string(); return result.string();

View file

@ -92,7 +92,7 @@ bool load_font_config()
try { try {
const std::string& cfg_path = filesystem::get_wml_location("hardwired/fonts.cfg"); const std::string& cfg_path = filesystem::get_wml_location("hardwired/fonts.cfg");
if(cfg_path.empty()) { if(cfg_path.empty()) {
ERR_FT << "could not resolve path to fonts.cfg, file not found\n"; ERR_FT << "could not resolve path to fonts.cfg, file not found";
return false; return false;
} }
@ -114,17 +114,17 @@ bool load_font_config()
family_order_script = fonts_config["family_order_script"]; family_order_script = fonts_config["family_order_script"];
if(family_order_mono.empty()) { if(family_order_mono.empty()) {
ERR_FT << "No monospace font family order defined, falling back to sans serif order\n"; ERR_FT << "No monospace font family order defined, falling back to sans serif order";
family_order_mono = family_order_sans; family_order_mono = family_order_sans;
} }
if(family_order_light.empty()) { if(family_order_light.empty()) {
ERR_FT << "No light font family order defined, falling back to sans serif order\n"; ERR_FT << "No light font family order defined, falling back to sans serif order";
family_order_light = family_order_sans; family_order_light = family_order_sans;
} }
if(family_order_script.empty()) { if(family_order_script.empty()) {
ERR_FT << "No script font family order defined, falling back to sans serif order\n"; ERR_FT << "No script font family order defined, falling back to sans serif order";
family_order_script = family_order_sans; family_order_script = family_order_sans;
} }
@ -164,12 +164,12 @@ manager::manager()
reinterpret_cast<const FcChar8*>(font_file.c_str()), reinterpret_cast<const FcChar8*>(font_file.c_str()),
FcFalse)) FcFalse))
{ {
ERR_FT << "Could not load local font configuration\n"; ERR_FT << "Could not load local font configuration";
throw font::error("font config lib failed to find font.conf: '" + font_file + "'"); throw font::error("font config lib failed to find font.conf: '" + font_file + "'");
} }
else else
{ {
LOG_FT << "Local font configuration loaded\n"; LOG_FT << "Local font configuration loaded";
} }
} }

View file

@ -100,7 +100,7 @@ std::string pango_line_ellipsize(const std::string& text, int font_size, int max
current_substring = std::move(tmp); current_substring = std::move(tmp);
} }
} catch(const utf8::invalid_utf8_exception&) { } catch(const utf8::invalid_utf8_exception&) {
WRN_FT << "Invalid UTF-8 string: \"" << text << "\"\n"; WRN_FT << "Invalid UTF-8 string: \"" << text << "\"";
return ""; return "";
} }

View file

@ -1412,7 +1412,7 @@ variant formula_function_expression::execute(const formula_callable& variables,
static std::string indent; static std::string indent;
indent += " "; indent += " ";
DBG_NG << indent << "executing '" << formula_->str() << "'\n"; DBG_NG << indent << "executing '" << formula_->str() << "'";
const int begin_time = SDL_GetTicks(); const int begin_time = SDL_GetTicks();
map_formula_callable callable; map_formula_callable callable;

View file

@ -124,7 +124,7 @@ static std::string do_interpolation(const std::string &str, const variable_set&
} }
} while(++var_end != res.end() && paren_nesting_level > 0); } while(++var_end != res.end() && paren_nesting_level > 0);
if(utils::detail::evaluate_formula == nullptr) { if(utils::detail::evaluate_formula == nullptr) {
WRN_NG << "Formula substitution ignored (and removed) because WFL engine is not present in the server.\n"; WRN_NG << "Formula substitution ignored (and removed) because WFL engine is not present in the server.";
res.replace(var_begin, var_end, ""); res.replace(var_begin, var_end, "");
continue; continue;
} }

View file

@ -326,7 +326,7 @@ void game_config_manager::load_game_config(bool reload_everything, const game_cl
std::set<std::string> active_addons = classification->active_addons(scenario_id); std::set<std::string> active_addons = classification->active_addons(scenario_id);
// IMPORTANT: this is a significant performance optimization, particularly for the worst case example of the batched WML unit tests // IMPORTANT: this is a significant performance optimization, particularly for the worst case example of the batched WML unit tests
if(!reload_everything && active_addons == active_addons_) { if(!reload_everything && active_addons == active_addons_) {
LOG_CONFIG << "Configs not reloaded and active add-ons remain the same; returning early.\n"; LOG_CONFIG << "Configs not reloaded and active add-ons remain the same; returning early.";
return; return;
} }
active_addons_ = active_addons; active_addons_ = active_addons;
@ -402,7 +402,7 @@ void game_config_manager::load_addons_cfg()
const int size_minus_extension = file.size() - 4; const int size_minus_extension = file.size() - 4;
if(file.substr(size_minus_extension, file.size()) == ".cfg") { if(file.substr(size_minus_extension, file.size()) == ".cfg") {
ERR_CONFIG << "error reading usermade add-on '" << file << "'\n"; ERR_CONFIG << "error reading usermade add-on '" << file << "'";
error_addons.push_back(file); error_addons.push_back(file);

View file

@ -408,7 +408,7 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
{ {
set_scontext_unsynced leave_synced_context; set_scontext_unsynced leave_synced_context;
events::command_disabler command_disabler; events::command_disabler command_disabler;
LOG_NG << "Processing [move_units_fake]\n"; LOG_NG << "Processing [move_units_fake]";
const bool force_scroll = cfg["force_scroll"].to_bool(); const bool force_scroll = cfg["force_scroll"].to_bool();
const vconfig::child_list unit_cfgs = cfg.get_children("fake_unit"); const vconfig::child_list unit_cfgs = cfg.get_children("fake_unit");
@ -418,7 +418,7 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
std::vector<std::vector<map_location>> paths; std::vector<std::vector<map_location>> paths;
paths.reserve(num_units); paths.reserve(num_units);
LOG_NG << "Moving " << num_units << " units\n"; LOG_NG << "Moving " << num_units << " units";
std::size_t longest_path = 0; std::size_t longest_path = 0;
@ -438,12 +438,12 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
units.back().place_on_fake_unit_manager(resources::fake_units); units.back().place_on_fake_unit_manager(resources::fake_units);
} }
LOG_NG << "Units placed, longest path is " << longest_path << " long\n"; LOG_NG << "Units placed, longest path is " << longest_path << " long";
std::vector<map_location> path_step(2); std::vector<map_location> path_step(2);
path_step.resize(2); path_step.resize(2);
for(std::size_t step = 1; step < longest_path; ++step) { for(std::size_t step = 1; step < longest_path; ++step) {
DBG_NG << "Doing step " << step << "...\n"; DBG_NG << "Doing step " << step << "...";
for(std::size_t un = 0; un < num_units; ++un) { for(std::size_t un = 0; un < num_units; ++un) {
if(step >= paths[un].size() || paths[un][step - 1] == paths[un][step]) if(step >= paths[un].size() || paths[un][step - 1] == paths[un][step])
continue; continue;
@ -456,7 +456,7 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
} }
} }
LOG_NG << "Units moved\n"; LOG_NG << "Units moved";
} }
/** /**
@ -467,7 +467,7 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
WML_HANDLER_FUNCTION(recall,, cfg) WML_HANDLER_FUNCTION(recall,, cfg)
{ {
events::command_disabler command_disabler; events::command_disabler command_disabler;
LOG_NG << "recalling unit...\n"; LOG_NG << "recalling unit...";
config temp_config(cfg.get_config()); config temp_config(cfg.get_config());
// Prevent the recall unit filter from using the location as a criterion // Prevent the recall unit filter from using the location as a criterion
@ -483,7 +483,7 @@ WML_HANDLER_FUNCTION(recall,, cfg)
const vconfig & leader_filter = cfg.child("secondary_unit"); const vconfig & leader_filter = cfg.child("secondary_unit");
for(int index = 0; index < static_cast<int>(resources::gameboard->teams().size()); ++index) { for(int index = 0; index < static_cast<int>(resources::gameboard->teams().size()); ++index) {
LOG_NG << "for side " << index + 1 << "...\n"; LOG_NG << "for side " << index + 1 << "...";
const std::string player_id = resources::gameboard->teams()[index].save_id_or_number(); const std::string player_id = resources::gameboard->teams()[index].save_id_or_number();
if(resources::gameboard->teams()[index].recall_list().size() < 1) { if(resources::gameboard->teams()[index].recall_list().size() < 1) {
@ -498,10 +498,10 @@ WML_HANDLER_FUNCTION(recall,, cfg)
const unit_filter ufilt(unit_filter_cfg); const unit_filter ufilt(unit_filter_cfg);
const unit_filter lfilt(leader_filter); // Note that if leader_filter is null, this correctly gives a null filter that matches all units. const unit_filter lfilt(leader_filter); // Note that if leader_filter is null, this correctly gives a null filter that matches all units.
for(std::vector<unit_ptr>::iterator u = avail.begin(); u != avail.end(); ++u) { for(std::vector<unit_ptr>::iterator u = avail.begin(); u != avail.end(); ++u) {
DBG_NG << "checking unit against filter...\n"; DBG_NG << "checking unit against filter...";
scoped_recall_unit auto_store("this_unit", player_id, std::distance(avail.begin(), u)); scoped_recall_unit auto_store("this_unit", player_id, std::distance(avail.begin(), u));
if (ufilt(*(*u), map_location())) { if (ufilt(*(*u), map_location())) {
DBG_NG << (*u)->id() << " matched the filter...\n"; DBG_NG << (*u)->id() << " matched the filter...";
const unit_ptr to_recruit = *u; const unit_ptr to_recruit = *u;
const unit* pass_check = to_recruit.get(); const unit* pass_check = to_recruit.get();
if(!cfg["check_passability"].to_bool(true)) pass_check = nullptr; if(!cfg["check_passability"].to_bool(true)) pass_check = nullptr;
@ -515,17 +515,17 @@ WML_HANDLER_FUNCTION(recall,, cfg)
} }
for (unit_map::const_unit_iterator leader : leaders) { for (unit_map::const_unit_iterator leader : leaders) {
DBG_NG << "...considering " + leader->id() + " as the recalling leader...\n"; DBG_NG << "...considering " + leader->id() + " as the recalling leader...";
map_location loc = cfg_loc; map_location loc = cfg_loc;
if ( lfilt(*leader) && if ( lfilt(*leader) &&
unit_filter(vconfig(leader->recall_filter())).matches( *(*u),map_location() ) ) { unit_filter(vconfig(leader->recall_filter())).matches( *(*u),map_location() ) ) {
DBG_NG << "...matched the leader filter and is able to recall the unit.\n"; DBG_NG << "...matched the leader filter and is able to recall the unit.";
if(!resources::gameboard->map().on_board(loc)) if(!resources::gameboard->map().on_board(loc))
loc = leader->get_location(); loc = leader->get_location();
if(pass_check || (resources::gameboard->units().count(loc) > 0)) if(pass_check || (resources::gameboard->units().count(loc) > 0))
loc = pathfind::find_vacant_tile(loc, pathfind::VACANT_ANY, pass_check); loc = pathfind::find_vacant_tile(loc, pathfind::VACANT_ANY, pass_check);
if(resources::gameboard->map().on_board(loc)) { if(resources::gameboard->map().on_board(loc)) {
DBG_NG << "...valid location for the recall found. Recalling.\n"; DBG_NG << "...valid location for the recall found. Recalling.";
avail.erase(u); // Erase before recruiting, since recruiting can fire more events avail.erase(u); // Erase before recruiting, since recruiting can fire more events
actions::place_recruit(to_recruit, loc, leader->get_location(), 0, true, actions::place_recruit(to_recruit, loc, leader->get_location(), 0, true,
map_location::parse_direction(cfg["facing"]), map_location::parse_direction(cfg["facing"]),
@ -541,7 +541,7 @@ WML_HANDLER_FUNCTION(recall,, cfg)
loc = pathfind::find_vacant_tile(loc, pathfind::VACANT_ANY, pass_check); loc = pathfind::find_vacant_tile(loc, pathfind::VACANT_ANY, pass_check);
// Check if we still have a valid location // Check if we still have a valid location
if (resources::gameboard->map().on_board(loc)) { if (resources::gameboard->map().on_board(loc)) {
DBG_NG << "No usable leader found, but found usable location. Recalling.\n"; DBG_NG << "No usable leader found, but found usable location. Recalling.";
avail.erase(u); // Erase before recruiting, since recruiting can fire more events avail.erase(u); // Erase before recruiting, since recruiting can fire more events
map_location null_location = map_location::null_location(); map_location null_location = map_location::null_location();
actions::place_recruit(to_recruit, loc, null_location, 0, true, actions::place_recruit(to_recruit, loc, null_location, 0, true,

View file

@ -100,7 +100,7 @@ pending_event_handler event_handlers::add_event_handler(const std::string& name,
auto find_it = id_map_.find(id); auto find_it = id_map_.find(id);
if(find_it != id_map_.end() && !find_it->second.expired()) { if(find_it != id_map_.end() && !find_it->second.expired()) {
LOG_EH << "ignoring event handler for name='" << name << "' with id '" << id << "' because an event with that id already exists\n"; LOG_EH << "ignoring event handler for name='" << name << "' with id '" << id << "' because an event with that id already exists";
return {*this, nullptr}; return {*this, nullptr};
} }
} }
@ -109,7 +109,7 @@ pending_event_handler event_handlers::add_event_handler(const std::string& name,
static const char* msg = "[event] is missing name or id field"; static const char* msg = "[event] is missing name or id field";
lg::log_to_chat() << msg << "\n"; lg::log_to_chat() << msg << "\n";
if(lg::info().dont_log(log_event_handler)) { if(lg::info().dont_log(log_event_handler)) {
ERR_EH << msg << " (run with --log-info=event_handler for more info)\n"; ERR_EH << msg << " (run with --log-info=event_handler for more info)";
} else { } else {
ERR_EH << msg; ERR_EH << msg;
} }

View file

@ -342,7 +342,7 @@ void wml_menu_item::update_command(const config& new_command)
resources::game_events->execute_on_events(event_name_, [&](game_events::manager& man, handler_ptr& ptr) { resources::game_events->execute_on_events(event_name_, [&](game_events::manager& man, handler_ptr& ptr) {
if(ptr->is_menu_item()) { if(ptr->is_menu_item()) {
LOG_NG << "Removing command for " << event_name_ << ".\n"; LOG_NG << "Removing command for " << event_name_ << ".";
man.remove_event_handler(command_["id"].str()); man.remove_event_handler(command_["id"].str());
} }
}); });

View file

@ -438,7 +438,7 @@ pump_result_t wml_event_pump::operator()()
assert(resources::lua_kernel != nullptr); assert(resources::lua_kernel != nullptr);
if(impl_->events_queue.empty()) { if(impl_->events_queue.empty()) {
DBG_EH << "Processing queued events, but none found.\n"; DBG_EH << "Processing queued events, but none found.";
return pump_result_t(); return pump_result_t();
} }

View file

@ -672,7 +672,7 @@ std::pair<bool, bool> connect_engine::process_network_data(const config& data)
} }
} }
LOG_CF << "client has taken a valid position\n"; LOG_CF << "client has taken a valid position";
import_user(data, false, side_taken); import_user(data, false, side_taken);
update_and_send_diff(); update_and_send_diff();
@ -682,7 +682,7 @@ std::pair<bool, bool> connect_engine::process_network_data(const config& data)
LOG_MP << "waiting to choose status = " << side_engines_[side_taken]->allow_changes(); LOG_MP << "waiting to choose status = " << side_engines_[side_taken]->allow_changes();
result.second = false; result.second = false;
LOG_NW << "sent player data\n"; LOG_NW << "sent player data";
} else { } else {
ERR_CF << "tried to take illegal side: " << side_taken; ERR_CF << "tried to take illegal side: " << side_taken;
@ -875,7 +875,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine, const
cfg_.remove_attribute("controller"); cfg_.remove_attribute("controller");
cfg_["previous_save_id"] = parent_.side_engines()[side_cntr_index]->previous_save_id(); cfg_["previous_save_id"] = parent_.side_engines()[side_cntr_index]->previous_save_id();
ERR_MP << "controller=<number> is deperecated\n"; ERR_MP << "controller=<number> is deperecated";
} }
if(cfg_["controller"] != side_controller::human && cfg_["controller"] != side_controller::ai && cfg_["controller"] != side_controller::none) { if(cfg_["controller"] != side_controller::human && cfg_["controller"] != side_controller::ai && cfg_["controller"] != side_controller::none) {

View file

@ -255,7 +255,7 @@ create_engine::create_engine(saved_game& state)
type_map_.emplace(level_type::type::sp_campaign, type_list()); type_map_.emplace(level_type::type::sp_campaign, type_list());
type_map_.emplace(level_type::type::random_map, type_list()); type_map_.emplace(level_type::type::random_map, type_list());
DBG_MP << "restoring game config\n"; DBG_MP << "restoring game config";
// Restore game config for multiplayer. // Restore game config for multiplayer.
campaign_type::type type = state_.classification().type; campaign_type::type type = state_.classification().type;
@ -275,7 +275,7 @@ create_engine::create_engine(saved_game& state)
filesystem::get_files_in_dir(filesystem::get_user_data_dir() + "/editor/scenarios", &user_scenario_names_, filesystem::get_files_in_dir(filesystem::get_user_data_dir() + "/editor/scenarios", &user_scenario_names_,
nullptr, filesystem::name_mode::FILE_NAME_ONLY); nullptr, filesystem::name_mode::FILE_NAME_ONLY);
DBG_MP << "initializing all levels, eras and mods\n"; DBG_MP << "initializing all levels, eras and mods";
init_all_levels(); init_all_levels();
init_extras(ERA); init_extras(ERA);
@ -296,15 +296,15 @@ create_engine::create_engine(saved_game& state)
void create_engine::init_generated_level_data() void create_engine::init_generated_level_data()
{ {
DBG_MP << "initializing generated level data\n"; DBG_MP << "initializing generated level data";
//DBG_MP << "current data:\n"; //DBG_MP << "current data:";
//DBG_MP << current_level().data().debug(); //DBG_MP << current_level().data().debug();
random_map * cur_lev = dynamic_cast<random_map *> (&current_level()); random_map * cur_lev = dynamic_cast<random_map *> (&current_level());
if(!cur_lev) { if(!cur_lev) {
WRN_MP << "Tried to initialized generated level data on a level that wasn't a random map\n"; WRN_MP << "Tried to initialized generated level data on a level that wasn't a random map";
return; return;
} }
@ -345,7 +345,7 @@ void create_engine::init_generated_level_data()
cur_lev->set_data(data); cur_lev->set_data(data);
} }
//DBG_MP << "final data:\n"; //DBG_MP << "final data:";
//DBG_MP << current_level().data().debug(); //DBG_MP << current_level().data().debug();
} }
@ -367,7 +367,7 @@ bool create_engine::current_level_has_side_data()
void create_engine::prepare_for_new_level() void create_engine::prepare_for_new_level()
{ {
DBG_MP << "preparing mp_game_settings for new level\n"; DBG_MP << "preparing mp_game_settings for new level";
state_.expand_scenario(); state_.expand_scenario();
state_.expand_random_scenario(); state_.expand_random_scenario();
} }
@ -383,7 +383,7 @@ void create_engine::prepare_for_era_and_mods()
void create_engine::prepare_for_scenario() void create_engine::prepare_for_scenario()
{ {
DBG_MP << "preparing data for scenario by reloading game config\n"; DBG_MP << "preparing data for scenario by reloading game config";
state_.classification().scenario_define = current_level().data()["define"].str(); state_.classification().scenario_define = current_level().data()["define"].str();
@ -394,7 +394,7 @@ void create_engine::prepare_for_scenario()
void create_engine::prepare_for_campaign(const std::string& difficulty) void create_engine::prepare_for_campaign(const std::string& difficulty)
{ {
DBG_MP << "preparing data for campaign by reloading game config\n"; DBG_MP << "preparing data for campaign by reloading game config";
if(!difficulty.empty()) { if(!difficulty.empty()) {
state_.classification().difficulty = difficulty; state_.classification().difficulty = difficulty;
@ -469,7 +469,7 @@ std::string create_engine::select_campaign_difficulty(int set_value)
void create_engine::prepare_for_saved_game() void create_engine::prepare_for_saved_game()
{ {
DBG_MP << "preparing mp_game_settings for saved game\n"; DBG_MP << "preparing mp_game_settings for saved game";
game_config_manager::get()->load_game_config_for_game(state_.classification(), state_.get_scenario_id()); game_config_manager::get()->load_game_config_for_game(state_.classification(), state_.get_scenario_id());
@ -480,7 +480,7 @@ void create_engine::prepare_for_saved_game()
void create_engine::prepare_for_other() void create_engine::prepare_for_other()
{ {
DBG_MP << "prepare_for_other\n"; DBG_MP << "prepare_for_other";
state_.set_scenario(current_level().data()); state_.set_scenario(current_level().data());
state_.mp_settings().hash = current_level().data().hash(); state_.mp_settings().hash = current_level().data().hash();
state_.check_require_scenario(); state_.check_require_scenario();
@ -792,7 +792,7 @@ void create_engine::init_extras(const MP_EXTRA extra_type)
} }
else { else {
//TODO: use a more visible error message. //TODO: use a more visible error message.
ERR_CF << "found " << extra_name << " with id=" << extra["id"] << " twice\n"; ERR_CF << "found " << extra_name << " with id=" << extra["id"] << " twice";
} }
} }
} }

View file

@ -160,7 +160,7 @@ bool lobby_info::process_gamelist_diff_impl(const config& data)
try { try {
gamelist_.apply_diff(data, true); gamelist_.apply_diff(data, true);
} catch(const config::error& e) { } catch(const config::error& e) {
ERR_LB << "Error while applying the gamelist diff: '" << e.message << "' Getting a new gamelist.\n"; ERR_LB << "Error while applying the gamelist diff: '" << e.message << "' Getting a new gamelist.";
return false; return false;
} }
@ -168,7 +168,7 @@ bool lobby_info::process_gamelist_diff_impl(const config& data)
DBG_LB << dump_games_map(games_by_id_); DBG_LB << dump_games_map(games_by_id_);
for(config& c : gamelist_.child("gamelist").child_range("game")) { for(config& c : gamelist_.child("gamelist").child_range("game")) {
DBG_LB << "data process: " << c["id"] << " (" << c[config::diff_track_attribute] << ")\n"; DBG_LB << "data process: " << c["id"] << " (" << c[config::diff_track_attribute] << ")";
const int game_id = c["id"]; const int game_id = c["id"];
if(game_id == 0) { if(game_id == 0) {
@ -215,7 +215,7 @@ bool lobby_info::process_gamelist_diff_impl(const config& data)
try { try {
gamelist_.clear_diff_track(data); gamelist_.clear_diff_track(data);
} catch(const config::error& e) { } catch(const config::error& e) {
ERR_LB << "Error while applying the gamelist diff (2): '" << e.message << "' Getting a new gamelist.\n"; ERR_LB << "Error while applying the gamelist diff (2): '" << e.message << "' Getting a new gamelist.";
return false; return false;
} }

View file

@ -285,13 +285,13 @@ level_result::type campaign_controller::play_game()
res = playmp_scenario(end_level); res = playmp_scenario(end_level);
} }
} catch(const leavegame_wesnothd_error&) { } catch(const leavegame_wesnothd_error&) {
LOG_NG << "The game was remotely ended\n"; LOG_NG << "The game was remotely ended";
return level_result::type::quit; return level_result::type::quit;
} catch(const game::load_game_failed& e) { } catch(const game::load_game_failed& e) {
gui2::show_error_message(_("The game could not be loaded: ") + e.message); gui2::show_error_message(_("The game could not be loaded: ") + e.message);
return level_result::type::quit; return level_result::type::quit;
} catch(const quit_game_exception&) { } catch(const quit_game_exception&) {
LOG_NG << "The game was aborted\n"; LOG_NG << "The game was aborted";
return level_result::type::quit; return level_result::type::quit;
} catch(const game::game_error& e) { } catch(const game::game_error& e) {
gui2::show_error_message(_("Error while playing the game: ") + e.message); gui2::show_error_message(_("Error while playing the game: ") + e.message);

View file

@ -111,20 +111,20 @@ cave_map_generator::cave_map_generator_job::cave_map_generator_job(const cave_ma
flipx_ = static_cast<int>(rng_() % 100) < params.flipx_chance_; flipx_ = static_cast<int>(rng_() % 100) < params.flipx_chance_;
flipy_ = static_cast<int>(rng_() % 100) < params.flipy_chance_; flipy_ = static_cast<int>(rng_() % 100) < params.flipy_chance_;
LOG_NG << "creating scenario....\n"; LOG_NG << "creating scenario....";
generate_chambers(); generate_chambers();
LOG_NG << "placing chambers...\n"; LOG_NG << "placing chambers...";
for(std::vector<chamber>::const_iterator c = chambers_.begin(); c != chambers_.end(); ++c) { for(std::vector<chamber>::const_iterator c = chambers_.begin(); c != chambers_.end(); ++c) {
place_chamber(*c); place_chamber(*c);
} }
LOG_NG << "placing passages...\n"; LOG_NG << "placing passages...";
for(std::vector<passage>::const_iterator p = passages_.begin(); p != passages_.end(); ++p) { for(std::vector<passage>::const_iterator p = passages_.begin(); p != passages_.end(); ++p) {
place_passage(*p); place_passage(*p);
} }
LOG_NG << "outputting map....\n"; LOG_NG << "outputting map....";
res_["map_data"] = t_translation::write_game_map(map_, starting_positions_); res_["map_data"] = t_translation::write_game_map(map_, starting_positions_);
} }

View file

@ -124,7 +124,7 @@ std::string default_map_generator::generate_map(std::map<map_location,std::strin
const int island_radius = 40 + ((max_coastal - data_.island_size) * 40)/max_coastal; const int island_radius = 40 + ((max_coastal - data_.island_size) * 40)/max_coastal;
job_data.island_size = (island_radius * data_.width * 2)/100; job_data.island_size = (island_radius * data_.width * 2)/100;
job_data.island_off_center = std::min(data_.width, data_.height); job_data.island_off_center = std::min(data_.width, data_.height);
DBG_NG << "calculated coastal params...\n"; DBG_NG << "calculated coastal params...";
} }
// A map generator can fail so try a few times to get a map before aborting. // A map generator can fail so try a few times to get a map before aborting.
@ -168,14 +168,14 @@ std::string default_map_generator::generate_map(std::map<map_location,std::strin
config default_map_generator::create_scenario(std::optional<uint32_t> randomseed) config default_map_generator::create_scenario(std::optional<uint32_t> randomseed)
{ {
DBG_NG << "creating scenario...\n"; DBG_NG << "creating scenario...";
config res = cfg_.child_or_empty("scenario"); config res = cfg_.child_or_empty("scenario");
DBG_NG << "got scenario data...\n"; DBG_NG << "got scenario data...";
std::map<map_location,std::string> labels; std::map<map_location,std::string> labels;
DBG_NG << "generating map...\n"; DBG_NG << "generating map...";
try{ try{
res["map_data"] = generate_map(&labels, randomseed); res["map_data"] = generate_map(&labels, randomseed);
@ -184,7 +184,7 @@ config default_map_generator::create_scenario(std::optional<uint32_t> randomseed
res["map_data"] = ""; res["map_data"] = "";
res["error_message"] = exc.message; res["error_message"] = exc.message;
} }
DBG_NG << "done generating map..\n"; DBG_NG << "done generating map..";
for(std::map<map_location,std::string>::const_iterator i = for(std::map<map_location,std::string>::const_iterator i =
labels.begin(); i != labels.end(); ++i) { labels.begin(); i != labels.end(); ++i) {

View file

@ -258,7 +258,7 @@ height_map default_map_generator_job::generate_height_map(size_t width, size_t h
size_t center_x = width/2; size_t center_x = width/2;
size_t center_y = height/2; size_t center_y = height/2;
LOG_NG << "off-centering...\n"; LOG_NG << "off-centering...";
if(island_off_center != 0) { if(island_off_center != 0) {
switch(rng_()%4) { switch(rng_()%4) {
@ -291,7 +291,7 @@ height_map default_map_generator_job::generate_height_map(size_t width, size_t h
{ {
height_map res(width, std::vector<int>(height,0)); height_map res(width, std::vector<int>(height,0));
DBG_NG << iterations << " iterations\n"; DBG_NG << iterations << " iterations";
for(std::size_t i = 0; i != iterations; ++i) { for(std::size_t i = 0; i != iterations; ++i) {
// (x1,y1) is the location of the hill, // (x1,y1) is the location of the hill,
@ -454,14 +454,14 @@ bool default_map_generator_job::generate_river_internal(const height_map& height
if(!on_map || terrain[x][y] == t_translation::SHALLOW_WATER || if(!on_map || terrain[x][y] == t_translation::SHALLOW_WATER ||
terrain[x][y] == t_translation::DEEP_WATER) { terrain[x][y] == t_translation::DEEP_WATER) {
LOG_NG << "generating river...\n"; LOG_NG << "generating river...";
// Generate the river // Generate the river
for(auto i : river) { for(auto i : river) {
terrain[i.x][i.y] = t_translation::SHALLOW_WATER; terrain[i.x][i.y] = t_translation::SHALLOW_WATER;
} }
LOG_NG << "done generating river\n"; LOG_NG << "done generating river";
return true; return true;
} }
@ -816,7 +816,7 @@ std::string default_map_generator_job::default_generate_map(generator_data data,
if(!river.empty() && misc_labels != nullptr) { if(!river.empty() && misc_labels != nullptr) {
const std::string base_name = base_name_generator->generate(); const std::string base_name = base_name_generator->generate();
const std::string& name = river_name_generator->generate({{"base", base_name}}); const std::string& name = river_name_generator->generate({{"base", base_name}});
LOG_NG << "Named river '" << name << "'\n"; LOG_NG << "Named river '" << name << "'";
std::size_t name_frequency = 20; std::size_t name_frequency = 20;
for(std::vector<map_location>::const_iterator r = river.begin(); r != river.end(); ++r) { for(std::vector<map_location>::const_iterator r = river.begin(); r != river.end(); ++r) {
@ -830,7 +830,7 @@ std::string default_map_generator_job::default_generate_map(generator_data data,
} }
} }
LOG_NG << "Generating lake...\n"; LOG_NG << "Generating lake...";
std::set<map_location> locs; std::set<map_location> locs;
if(generate_lake(terrain, x, y, cfg["lake_size"], locs) && misc_labels != nullptr) { if(generate_lake(terrain, x, y, cfg["lake_size"], locs) && misc_labels != nullptr) {
@ -912,7 +912,7 @@ std::string default_map_generator_job::default_generate_map(generator_data data,
} }
} }
LOG_NG << "Placing castles...\n"; LOG_NG << "Placing castles...";
/* /*
* Attempt to place castles at random. * Attempt to place castles at random.
@ -980,7 +980,7 @@ std::string default_map_generator_job::default_generate_map(generator_data data,
LOG_NG << "Placed castles. " << (SDL_GetTicks() - ticks) << " ticks elapsed"; LOG_NG << "Placed castles. " << (SDL_GetTicks() - ticks) << " ticks elapsed";
} }
LOG_NG << "Placing roads...\n"; LOG_NG << "Placing roads...";
ticks = SDL_GetTicks(); ticks = SDL_GetTicks();
// Place roads. // Place roads.
@ -1225,7 +1225,7 @@ std::string default_map_generator_job::default_generate_map(generator_data data,
} }
LOG_NG << "Named landforms. " << (SDL_GetTicks() - ticks) << " ticks elapsed"; LOG_NG << "Named landforms. " << (SDL_GetTicks() - ticks) << " ticks elapsed";
LOG_NG << "Placing villages...\n"; LOG_NG << "Placing villages...";
ticks = SDL_GetTicks(); ticks = SDL_GetTicks();
/* /*

View file

@ -31,7 +31,7 @@ map_generator* create_map_generator(const std::string& name, const config &cfg,
if(name == "default" || name.empty()) { if(name == "default" || name.empty()) {
return new default_map_generator(cfg); return new default_map_generator(cfg);
} else if(name == "cave") { } else if(name == "cave") {
ERR_CF << "map/scenario_generation=cave is deprecatd and will be removed soon, use map/scenario_generation=lua with lua/cave_map_generator.lua instead.\n"; ERR_CF << "map/scenario_generation=cave is deprecatd and will be removed soon, use map/scenario_generation=lua with lua/cave_map_generator.lua instead.";
return new cave_map_generator(cfg); return new cave_map_generator(cfg);
} else if(name == "lua") { } else if(name == "lua") {
return new lua_map_generator(cfg, vars); return new lua_map_generator(cfg, vars);

View file

@ -58,7 +58,7 @@ namespace
default_utf8_locale_name() default_utf8_locale_name()
: name_() : name_()
{ {
LOG_G << "Generating default locale\n"; LOG_G << "Generating default locale";
try try
{ {
//NOTE: the default_locale objects needs to live as least as long as the locale_info object. Otherwise the program will segfault. //NOTE: the default_locale objects needs to live as least as long as the locale_info object. Otherwise the program will segfault.
@ -75,7 +75,7 @@ namespace
{ {
ERR_G << "Failed to generate default locale string. message:" << e.what(); ERR_G << "Failed to generate default locale string. message:" << e.what();
} }
LOG_G << "Finished generating default locale, default is now '" << name_ << "'\n"; LOG_G << "Finished generating default locale, default is now '" << name_ << "'";
} }
std::string name_; std::string name_;
@ -219,7 +219,7 @@ namespace
const bl::localization_backend_manager& g_mgr = bl::localization_backend_manager::global(); const bl::localization_backend_manager& g_mgr = bl::localization_backend_manager::global();
for(const std::string& name : g_mgr.get_all_backends()) for(const std::string& name : g_mgr.get_all_backends())
{ {
LOG_G << "Found boost locale backend: '" << name << "'\n"; LOG_G << "Found boost locale backend: '" << name << "'";
} }
generator_.use_ansi_encoding(false); generator_.use_ansi_encoding(false);
@ -309,7 +309,7 @@ namespace
{ {
try try
{ {
LOG_G << "attempting to generate locale by name '" << current_language_ << "'\n"; LOG_G << "attempting to generate locale by name '" << current_language_ << "'";
current_locale_ = generator_.generate(current_language_); current_locale_ = generator_.generate(current_language_);
current_locale_ = std::locale(current_locale_, new wesnoth_message_format(current_locale_, loaded_domains_, loaded_paths_)); current_locale_ = std::locale(current_locale_, new wesnoth_message_format(current_locale_, loaded_domains_, loaded_paths_));
const bl::info& info = std::use_facet<bl::info>(current_locale_); const bl::info& info = std::use_facet<bl::info>(current_locale_);
@ -470,7 +470,7 @@ std::string dsngettext (const char * domainname, const char *singular, const cha
void bind_textdomain(const char* domain, const char* directory, const char* /*encoding*/) void bind_textdomain(const char* domain, const char* directory, const char* /*encoding*/)
{ {
LOG_G << "adding textdomain '" << domain << "' in directory '" << directory << "'\n"; LOG_G << "adding textdomain '" << domain << "' in directory '" << directory << "'";
std::scoped_lock lock(get_mutex()); std::scoped_lock lock(get_mutex());
get_manager().add_messages_domain(domain); get_manager().add_messages_domain(domain);
get_manager().add_messages_path(directory); get_manager().add_messages_path(directory);
@ -479,7 +479,7 @@ void bind_textdomain(const char* domain, const char* directory, const char* /*en
void set_default_textdomain(const char* domain) void set_default_textdomain(const char* domain)
{ {
LOG_G << "set_default_textdomain: '" << domain << "'\n"; LOG_G << "set_default_textdomain: '" << domain << "'";
std::scoped_lock lock(get_mutex()); std::scoped_lock lock(get_mutex());
get_manager().set_default_messages_domain(domain); get_manager().set_default_messages_domain(domain);
} }
@ -504,7 +504,7 @@ int compare(const std::string& s1, const std::string& s2)
static bool bad_cast_once = false; static bool bad_cast_once = false;
if(!bad_cast_once) { if(!bad_cast_once) {
ERR_G << "locale set-up for compare() is broken, falling back to std::string::compare()\n"; ERR_G << "locale set-up for compare() is broken, falling back to std::string::compare()";
bad_cast_once = true; bad_cast_once = true;
} }
@ -528,7 +528,7 @@ int icompare(const std::string& s1, const std::string& s2)
static bool bad_cast_once = false; static bool bad_cast_once = false;
if(!bad_cast_once) { if(!bad_cast_once) {
ERR_G << "locale set-up for icompare() is broken, falling back to std::string::compare()\n"; ERR_G << "locale set-up for icompare() is broken, falling back to std::string::compare()";
try { //just to be safe. try { //just to be safe.
ERR_G << get_manager().debug_description(); ERR_G << get_manager().debug_description();

View file

@ -159,7 +159,7 @@ operator()(const wfl::map_formula_callable& variables, wfl::function_symbol_tabl
wfl::variant v = wfl::formula(*formula_, functions).evaluate(variables); wfl::variant v = wfl::formula(*formula_, functions).evaluate(variables);
const T& result = execute(v); const T& result = execute(v);
DBG_GUI_D << "Formula: execute '" << *formula_ << "' result '" << result << "'.\n"; DBG_GUI_D << "Formula: execute '" << *formula_ << "' result '" << result << "'.";
return result; return result;
} }

View file

@ -54,7 +54,7 @@ line_shape::line_shape(const config& cfg)
{ {
const std::string& debug = (cfg["debug"]); const std::string& debug = (cfg["debug"]);
if(!debug.empty()) { if(!debug.empty()) {
DBG_GUI_P << "Line: found debug message '" << debug << "'.\n"; DBG_GUI_P << "Line: found debug message '" << debug << "'.";
} }
} }
@ -71,7 +71,7 @@ void line_shape::draw(wfl::map_formula_callable& variables)
const unsigned x2 = x2_(variables); const unsigned x2 = x2_(variables);
const unsigned y2 = y2_(variables); const unsigned y2 = y2_(variables);
DBG_GUI_D << "Line: draw from " << x1 << ',' << y1 << " to " << x2 << ',' << y2 << ".\n"; DBG_GUI_D << "Line: draw from " << x1 << ',' << y1 << " to " << x2 << ',' << y2 << ".";
// @todo FIXME respect the thickness. // @todo FIXME respect the thickness.
@ -93,7 +93,7 @@ rectangle_shape::rectangle_shape(const config& cfg)
const std::string& debug = (cfg["debug"]); const std::string& debug = (cfg["debug"]);
if(!debug.empty()) { if(!debug.empty()) {
DBG_GUI_P << "Rectangle: found debug message '" << debug << "'.\n"; DBG_GUI_P << "Rectangle: found debug message '" << debug << "'.";
} }
} }
@ -155,7 +155,7 @@ round_rectangle_shape::round_rectangle_shape(const config& cfg)
const std::string& debug = (cfg["debug"]); const std::string& debug = (cfg["debug"]);
if(!debug.empty()) { if(!debug.empty()) {
DBG_GUI_P << "Rounded Rectangle: found debug message '" << debug << "'.\n"; DBG_GUI_P << "Rounded Rectangle: found debug message '" << debug << "'.";
} }
} }
@ -167,7 +167,7 @@ void round_rectangle_shape::draw(wfl::map_formula_callable& variables)
const int h = h_(variables); const int h = h_(variables);
const int r = r_(variables); const int r = r_(variables);
DBG_GUI_D << "Rounded Rectangle: draw from " << x << ',' << y << " width " << w << " height " << h << ".\n"; DBG_GUI_D << "Rounded Rectangle: draw from " << x << ',' << y << " width " << w << " height " << h << ".";
const color_t fill_color = fill_color_(variables); const color_t fill_color = fill_color_(variables);
@ -217,7 +217,7 @@ circle_shape::circle_shape(const config& cfg)
{ {
const std::string& debug = (cfg["debug"]); const std::string& debug = (cfg["debug"]);
if(!debug.empty()) { if(!debug.empty()) {
DBG_GUI_P << "Circle: found debug message '" << debug << "'.\n"; DBG_GUI_P << "Circle: found debug message '" << debug << "'.";
} }
} }
@ -233,7 +233,7 @@ void circle_shape::draw(wfl::map_formula_callable& variables)
const int y = y_(variables); const int y = y_(variables);
const unsigned radius = radius_(variables); const unsigned radius = radius_(variables);
DBG_GUI_D << "Circle: drawn at " << x << ',' << y << " radius " << radius << ".\n"; DBG_GUI_D << "Circle: drawn at " << x << ',' << y << " radius " << radius << ".";
const color_t fill_color = fill_color_(variables); const color_t fill_color = fill_color_(variables);
if(!fill_color.null() && radius) { if(!fill_color.null() && radius) {
@ -261,7 +261,7 @@ image_shape::image_shape(const config& cfg, wfl::action_function_symbol_table& f
{ {
const std::string& debug = (cfg["debug"]); const std::string& debug = (cfg["debug"]);
if(!debug.empty()) { if(!debug.empty()) {
DBG_GUI_P << "Image: found debug message '" << debug << "'.\n"; DBG_GUI_P << "Image: found debug message '" << debug << "'.";
} }
} }
@ -276,7 +276,7 @@ void image_shape::dimension_validation(unsigned value, const std::string& name,
void image_shape::draw(wfl::map_formula_callable& variables) void image_shape::draw(wfl::map_formula_callable& variables)
{ {
DBG_GUI_D << "Image: draw.\n"; DBG_GUI_D << "Image: draw.";
/** /**
* @todo formulas are now recalculated every draw cycle which is a bit * @todo formulas are now recalculated every draw cycle which is a bit
@ -286,7 +286,7 @@ void image_shape::draw(wfl::map_formula_callable& variables)
const std::string& name = image_name_(variables); const std::string& name = image_name_(variables);
if(name.empty()) { if(name.empty()) {
DBG_GUI_D << "Image: formula returned no value, will not be drawn.\n"; DBG_GUI_D << "Image: formula returned no value, will not be drawn.";
return; return;
} }
@ -378,7 +378,7 @@ image_shape::resize_mode image_shape::get_resize_mode(const std::string& resize_
return resize_mode::scale_sharp; return resize_mode::scale_sharp;
} else { } else {
if(!resize_mode.empty() && resize_mode != "scale") { if(!resize_mode.empty() && resize_mode != "scale") {
ERR_GUI_E << "Invalid resize mode '" << resize_mode << "' falling back to 'scale'.\n"; ERR_GUI_E << "Invalid resize mode '" << resize_mode << "' falling back to 'scale'.";
} }
return resize_mode::scale; return resize_mode::scale;
} }
@ -407,7 +407,7 @@ text_shape::text_shape(const config& cfg)
const std::string& debug = (cfg["debug"]); const std::string& debug = (cfg["debug"]);
if(!debug.empty()) { if(!debug.empty()) {
DBG_GUI_P << "Text: found debug message '" << debug << "'.\n"; DBG_GUI_P << "Text: found debug message '" << debug << "'.";
} }
} }
@ -421,7 +421,7 @@ void text_shape::draw(wfl::map_formula_callable& variables)
const t_string text = text_(variables); const t_string text = text_(variables);
if(text.empty()) { if(text.empty()) {
DBG_GUI_D << "Text: no text to render, leave.\n"; DBG_GUI_D << "Text: no text to render, leave.";
return; return;
} }
@ -459,7 +459,7 @@ void text_shape::draw(wfl::map_formula_callable& variables)
texture tex = text_renderer.render_and_get_texture(); texture tex = text_renderer.render_and_get_texture();
if(!tex) { if(!tex) {
DBG_GUI_D << "Text: Rendering '" << text << "' resulted in an empty canvas, leave.\n"; DBG_GUI_D << "Text: Rendering '" << text << "' resulted in an empty canvas, leave.";
return; return;
} }
@ -496,7 +496,7 @@ void canvas::draw()
// This early-return has to come before the `validate(rect.w <= w_)` check, as during the boost_unit_tests execution // This early-return has to come before the `validate(rect.w <= w_)` check, as during the boost_unit_tests execution
// the debug_clock widget will have no shapes, 0x0 size, yet be given a larger rect to draw. // the debug_clock widget will have no shapes, 0x0 size, yet be given a larger rect to draw.
if(shapes_.empty()) { if(shapes_.empty()) {
DBG_GUI_D << "Canvas: empty (no shapes to draw).\n"; DBG_GUI_D << "Canvas: empty (no shapes to draw).";
return; return;
} }
@ -531,7 +531,7 @@ void canvas::parse_cfg(const config& cfg)
const std::string& type = shape.key; const std::string& type = shape.key;
const config& data = shape.cfg; const config& data = shape.cfg;
DBG_GUI_P << "Canvas: found shape of the type " << type << ".\n"; DBG_GUI_P << "Canvas: found shape of the type " << type << ".";
if(type == "line") { if(type == "line") {
shapes_.emplace_back(std::make_unique<line_shape>(data)); shapes_.emplace_back(std::make_unique<line_shape>(data));

View file

@ -153,7 +153,7 @@ void mouse_motion::signal_handler_sdl_mouse_motion(const event::ui_event event,
} }
resource_locker lock{signal_handler_sdl_mouse_motion_entered_}; resource_locker lock{signal_handler_sdl_mouse_motion_entered_};
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
if(mouse_captured_) { if(mouse_captured_) {
assert(mouse_focus_); assert(mouse_focus_);
@ -167,7 +167,7 @@ void mouse_motion::signal_handler_sdl_mouse_motion(const event::ui_event event,
} }
if(mouse_over) { if(mouse_over) {
DBG_GUI_E << LOG_HEADER << "Firing: " << event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event << ".";
if(owner_.fire(event, *mouse_over, coordinate)) { if(owner_.fire(event, *mouse_over, coordinate)) {
return; return;
} }
@ -193,7 +193,7 @@ void mouse_motion::signal_handler_sdl_mouse_motion(const event::ui_event event,
void mouse_motion::signal_handler_sdl_touch_motion( void mouse_motion::signal_handler_sdl_touch_motion(
const event::ui_event event, bool& handled, const point& coordinate, const point& distance) const event::ui_event event, bool& handled, const point& coordinate, const point& distance)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
if(mouse_captured_) { if(mouse_captured_) {
assert(mouse_focus_); assert(mouse_focus_);
@ -208,7 +208,7 @@ void mouse_motion::signal_handler_sdl_touch_motion(
void mouse_motion::signal_handler_sdl_wheel(const event::ui_event event, bool& handled, const point& coordinate) void mouse_motion::signal_handler_sdl_wheel(const event::ui_event event, bool& handled, const point& coordinate)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
if(mouse_captured_) { if(mouse_captured_) {
assert(mouse_focus_); assert(mouse_focus_);
@ -223,7 +223,7 @@ void mouse_motion::signal_handler_sdl_wheel(const event::ui_event event, bool& h
void mouse_motion::signal_handler_show_helptip(const event::ui_event event, bool& handled, const point& coordinate) void mouse_motion::signal_handler_show_helptip(const event::ui_event event, bool& handled, const point& coordinate)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
if(mouse_captured_) { if(mouse_captured_) {
assert(mouse_focus_); assert(mouse_focus_);
@ -232,7 +232,7 @@ void mouse_motion::signal_handler_show_helptip(const event::ui_event event, bool
} }
} else { } else {
if(widget* mouse_over = owner_.find_at(coordinate, true)) { if(widget* mouse_over = owner_.find_at(coordinate, true)) {
DBG_GUI_E << LOG_HEADER << "Firing: " << event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event << ".";
if(owner_.fire(event, *mouse_over, coordinate)) { if(owner_.fire(event, *mouse_over, coordinate)) {
stop_hover_timer(); stop_hover_timer();
} }
@ -244,7 +244,7 @@ void mouse_motion::signal_handler_show_helptip(const event::ui_event event, bool
void mouse_motion::mouse_enter(widget* mouse_over) void mouse_motion::mouse_enter(widget* mouse_over)
{ {
DBG_GUI_E << LOG_HEADER << "Firing: " << event::MOUSE_ENTER << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event::MOUSE_ENTER << ".";
assert(mouse_over); assert(mouse_over);
@ -257,7 +257,7 @@ void mouse_motion::mouse_enter(widget* mouse_over)
void mouse_motion::mouse_hover(widget* mouse_over, const point& coordinate) void mouse_motion::mouse_hover(widget* mouse_over, const point& coordinate)
{ {
DBG_GUI_E << LOG_HEADER << "Firing: " << event::MOUSE_MOTION << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event::MOUSE_MOTION << ".";
assert(mouse_over); assert(mouse_over);
@ -273,11 +273,11 @@ void mouse_motion::mouse_hover(widget* mouse_over, const point& coordinate)
void mouse_motion::show_tooltip() void mouse_motion::show_tooltip()
{ {
DBG_GUI_E << LOG_HEADER << "Firing: " << event::SHOW_TOOLTIP << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event::SHOW_TOOLTIP << ".";
if(!hover_widget_) { if(!hover_widget_) {
// See mouse_motion::stop_hover_timer. // See mouse_motion::stop_hover_timer.
ERR_GUI_E << LOG_HEADER << event::SHOW_TOOLTIP << " bailing out, no hover widget.\n"; ERR_GUI_E << LOG_HEADER << event::SHOW_TOOLTIP << " bailing out, no hover widget.";
return; return;
} }
@ -297,7 +297,7 @@ void mouse_motion::show_tooltip()
void mouse_motion::mouse_leave() void mouse_motion::mouse_leave()
{ {
DBG_GUI_E << LOG_HEADER << "Firing: " << event::MOUSE_LEAVE << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event::MOUSE_LEAVE << ".";
styled_widget* control = dynamic_cast<styled_widget*>(mouse_focus_); styled_widget* control = dynamic_cast<styled_widget*>(mouse_focus_);
if(!control || control->get_active()) { if(!control || control->get_active()) {
@ -453,11 +453,11 @@ void mouse_button<I>::signal_handler_sdl_button_down(
} }
resource_locker lock{signal_handler_sdl_button_down_entered_}; resource_locker lock{signal_handler_sdl_button_down_entered_};
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
if(is_down_) { if(is_down_) {
#ifdef GUI2_SHOW_UNHANDLED_EVENT_WARNINGS #ifdef GUI2_SHOW_UNHANDLED_EVENT_WARNINGS
WRN_GUI_E << LOG_HEADER << event << ". The mouse button is already down, we missed an event.\n"; WRN_GUI_E << LOG_HEADER << event << ". The mouse button is already down, we missed an event.";
#endif #endif
return; return;
} }
@ -466,9 +466,9 @@ void mouse_button<I>::signal_handler_sdl_button_down(
if(mouse_captured_) { if(mouse_captured_) {
assert(mouse_focus_); assert(mouse_focus_);
focus_ = mouse_focus_; focus_ = mouse_focus_;
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].sdl_button_down_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].sdl_button_down_event << ".";
if(!owner_.fire(mouse_data[I].sdl_button_down_event, *focus_, coordinate)) { if(!owner_.fire(mouse_data[I].sdl_button_down_event, *focus_, coordinate)) {
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_down_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_down_event << ".";
owner_.fire(mouse_data[I].button_down_event, *mouse_focus_); owner_.fire(mouse_data[I].button_down_event, *mouse_focus_);
} }
} else { } else {
@ -486,9 +486,9 @@ void mouse_button<I>::signal_handler_sdl_button_down(
} }
focus_ = mouse_over; focus_ = mouse_over;
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].sdl_button_down_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].sdl_button_down_event << ".";
if(!owner_.fire(mouse_data[I].sdl_button_down_event, *focus_, coordinate)) { if(!owner_.fire(mouse_data[I].sdl_button_down_event, *focus_, coordinate)) {
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_down_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_down_event << ".";
owner_.fire(mouse_data[I].button_down_event, *focus_); owner_.fire(mouse_data[I].button_down_event, *focus_);
} }
} }
@ -504,20 +504,20 @@ void mouse_button<I>::signal_handler_sdl_button_up(
} }
resource_locker lock{signal_handler_sdl_button_up_entered_}; resource_locker lock{signal_handler_sdl_button_up_entered_};
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
if(!is_down_) { if(!is_down_) {
#ifdef GUI2_SHOW_UNHANDLED_EVENT_WARNINGS #ifdef GUI2_SHOW_UNHANDLED_EVENT_WARNINGS
WRN_GUI_E << LOG_HEADER << event << ". The mouse button is already up, we missed an event.\n"; WRN_GUI_E << LOG_HEADER << event << ". The mouse button is already up, we missed an event.";
#endif #endif
return; return;
} }
is_down_ = false; is_down_ = false;
if(focus_) { if(focus_) {
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].sdl_button_up_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].sdl_button_up_event << ".";
if(!owner_.fire(mouse_data[I].sdl_button_up_event, *focus_, coordinate)) { if(!owner_.fire(mouse_data[I].sdl_button_up_event, *focus_, coordinate)) {
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_up_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_up_event << ".";
owner_.fire(mouse_data[I].button_up_event, *focus_); owner_.fire(mouse_data[I].button_up_event, *focus_);
} }
} }
@ -556,14 +556,14 @@ void mouse_button<I>::mouse_button_click(widget* widget)
{ {
uint32_t stamp = SDL_GetTicks(); uint32_t stamp = SDL_GetTicks();
if(last_click_stamp_ + settings::double_click_time >= stamp && last_clicked_widget_ == widget) { if(last_click_stamp_ + settings::double_click_time >= stamp && last_clicked_widget_ == widget) {
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_double_click_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_double_click_event << ".";
owner_.fire(mouse_data[I].button_double_click_event, *widget); owner_.fire(mouse_data[I].button_double_click_event, *widget);
last_click_stamp_ = 0; last_click_stamp_ = 0;
last_clicked_widget_ = nullptr; last_clicked_widget_ = nullptr;
} else { } else {
DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_click_event << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << mouse_data[I].button_click_event << ".";
owner_.fire(mouse_data[I].button_click_event, *widget); owner_.fire(mouse_data[I].button_click_event, *widget);
last_click_stamp_ = stamp; last_click_stamp_ = stamp;
last_clicked_widget_ = widget; last_clicked_widget_ = widget;
@ -680,14 +680,14 @@ widget* distributor::keyboard_focus() const
void distributor::keyboard_capture(widget* widget) void distributor::keyboard_capture(widget* widget)
{ {
if(keyboard_focus_) { if(keyboard_focus_) {
DBG_GUI_E << LOG_HEADER << "Firing: " << event::LOSE_KEYBOARD_FOCUS << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event::LOSE_KEYBOARD_FOCUS << ".";
owner_.fire(event::LOSE_KEYBOARD_FOCUS, *keyboard_focus_, nullptr); owner_.fire(event::LOSE_KEYBOARD_FOCUS, *keyboard_focus_, nullptr);
} }
keyboard_focus_ = widget; keyboard_focus_ = widget;
if(keyboard_focus_) { if(keyboard_focus_) {
DBG_GUI_E << LOG_HEADER << "Firing: " << event::RECEIVE_KEYBOARD_FOCUS << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << event::RECEIVE_KEYBOARD_FOCUS << ".";
owner_.fire(event::RECEIVE_KEYBOARD_FOCUS, *keyboard_focus_, nullptr); owner_.fire(event::RECEIVE_KEYBOARD_FOCUS, *keyboard_focus_, nullptr);
} }
} }
@ -714,7 +714,7 @@ void distributor::signal_handler_keyboard_internal(event::ui_event evt, P1&& p1,
{ {
/** @todo Test whether recursion protection is needed. */ /** @todo Test whether recursion protection is needed. */
DBG_GUI_E << LOG_HEADER << evt << ".\n"; DBG_GUI_E << LOG_HEADER << evt << ".";
if(keyboard_focus_) { if(keyboard_focus_) {
// Attempt to cast to styled_widget, to avoid sending events if the // Attempt to cast to styled_widget, to avoid sending events if the
@ -722,7 +722,7 @@ void distributor::signal_handler_keyboard_internal(event::ui_event evt, P1&& p1,
// is enabled and ready to receive events. // is enabled and ready to receive events.
styled_widget* control = dynamic_cast<styled_widget*>(keyboard_focus_); styled_widget* control = dynamic_cast<styled_widget*>(keyboard_focus_);
if(!control || control->get_active()) { if(!control || control->get_active()) {
DBG_GUI_E << LOG_HEADER << "Firing: " << evt << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << evt << ".";
if(owner_.fire(evt, *keyboard_focus_, p1, p2, p3)) { if(owner_.fire(evt, *keyboard_focus_, p1, p2, p3)) {
return; return;
} }
@ -762,7 +762,7 @@ void distributor::signal_handler_keyboard_internal(event::ui_event evt, P1&& p1,
continue; continue;
} }
DBG_GUI_E << LOG_HEADER << "Firing: " << evt << ".\n"; DBG_GUI_E << LOG_HEADER << "Firing: " << evt << ".";
if(owner_.fire(evt, **ritor, p1, p2, p3)) { if(owner_.fire(evt, **ritor, p1, p2, p3)) {
return; return;
} }
@ -786,7 +786,7 @@ void distributor::signal_handler_sdl_text_editing(const std::string& unicode, in
void distributor::signal_handler_notify_removal(dispatcher& w, const ui_event event) void distributor::signal_handler_notify_removal(dispatcher& w, const ui_event event)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
/** /**
* @todo Evaluate whether moving the cleanup parts in the subclasses. * @todo Evaluate whether moving the cleanup parts in the subclasses.

View file

@ -78,7 +78,7 @@ static unsigned event_poll_interval = 0;
*/ */
static uint32_t timer_sdl_draw_event(uint32_t, void*) static uint32_t timer_sdl_draw_event(uint32_t, void*)
{ {
// DBG_GUI_E << "Pushing draw event in queue.\n"; // DBG_GUI_E << "Pushing draw event in queue.";
SDL_Event event; SDL_Event event;
sdl::UserEvent data(DRAW_EVENT); sdl::UserEvent data(DRAW_EVENT);
@ -612,7 +612,7 @@ void sdl_event_handler::draw_everything()
void sdl_event_handler::video_resize(const point& new_size) void sdl_event_handler::video_resize(const point& new_size)
{ {
DBG_GUI_E << "Firing: " << SDL_VIDEO_RESIZE << ".\n"; DBG_GUI_E << "Firing: " << SDL_VIDEO_RESIZE << ".";
for(auto dispatcher : dispatchers_) for(auto dispatcher : dispatchers_)
{ {
@ -621,7 +621,7 @@ void sdl_event_handler::video_resize(const point& new_size)
} }
void sdl_event_handler::raw_event(const SDL_Event& event) { void sdl_event_handler::raw_event(const SDL_Event& event) {
DBG_GUI_E << "Firing raw event\n"; DBG_GUI_E << "Firing raw event";
for(auto dispatcher : dispatchers_) for(auto dispatcher : dispatchers_)
{ {
@ -631,7 +631,7 @@ void sdl_event_handler::raw_event(const SDL_Event& event) {
void sdl_event_handler::mouse(const ui_event event, const point& position) void sdl_event_handler::mouse(const ui_event event, const point& position)
{ {
DBG_GUI_E << "Firing: " << event << ".\n"; DBG_GUI_E << "Firing: " << event << ".";
if(mouse_focus) { if(mouse_focus) {
mouse_focus->fire(event, dynamic_cast<widget&>(*mouse_focus), position); mouse_focus->fire(event, dynamic_cast<widget&>(*mouse_focus), position);
@ -830,7 +830,7 @@ void sdl_event_handler::key_down(const SDL_Keycode key,
const SDL_Keymod modifier, const SDL_Keymod modifier,
const std::string& unicode) const std::string& unicode)
{ {
DBG_GUI_E << "Firing: " << SDL_KEY_DOWN << ".\n"; DBG_GUI_E << "Firing: " << SDL_KEY_DOWN << ".";
if(dispatcher* dispatcher = keyboard_dispatcher()) { if(dispatcher* dispatcher = keyboard_dispatcher()) {
dispatcher->fire(SDL_KEY_DOWN, dispatcher->fire(SDL_KEY_DOWN,
@ -843,7 +843,7 @@ void sdl_event_handler::key_down(const SDL_Keycode key,
void sdl_event_handler::keyboard(const ui_event event) void sdl_event_handler::keyboard(const ui_event event)
{ {
DBG_GUI_E << "Firing: " << event << ".\n"; DBG_GUI_E << "Firing: " << event << ".";
if(dispatcher* dispatcher = keyboard_dispatcher()) { if(dispatcher* dispatcher = keyboard_dispatcher()) {
dispatcher->fire(event, dynamic_cast<widget&>(*dispatcher)); dispatcher->fire(event, dynamic_cast<widget&>(*dispatcher));
@ -852,7 +852,7 @@ void sdl_event_handler::keyboard(const ui_event event)
void sdl_event_handler::close_window(const unsigned window_id) void sdl_event_handler::close_window(const unsigned window_id)
{ {
DBG_GUI_E << "Firing " << CLOSE_WINDOW << ".\n"; DBG_GUI_E << "Firing " << CLOSE_WINDOW << ".";
window* window = window::window_instance(window_id); window* window = window::window_instance(window_id);
if(window) { if(window) {

View file

@ -73,7 +73,7 @@ gui_definition::gui_definition(const config& cfg)
const std::string& def_id = def_ptr->id; const std::string& def_id = def_ptr->id;
if(def_map.find(def_id) != def_map.end()) { if(def_map.find(def_id) != def_map.end()) {
ERR_GUI_P << "Skipping duplicate definition '" << def_id << "' for '" << type_id << "'\n"; ERR_GUI_P << "Skipping duplicate definition '" << def_id << "' for '" << type_id << "'";
continue; continue;
} }

View file

@ -96,7 +96,7 @@ extern "C" {
static uint32_t timer_callback(uint32_t, void* id) static uint32_t timer_callback(uint32_t, void* id)
{ {
DBG_GUI_E << "Pushing timer event in queue.\n"; DBG_GUI_E << "Pushing timer event in queue.";
// iTunes still reports a couple of crashes here. Cannot see a problem yet. // iTunes still reports a couple of crashes here. Cannot see a problem yet.
Uint32 result; Uint32 result;
@ -130,7 +130,7 @@ std::size_t add_timer(const uint32_t interval,
{ {
static_assert(sizeof(std::size_t) == sizeof(void*), "Pointer and std::size_t are not the same size"); static_assert(sizeof(std::size_t) == sizeof(void*), "Pointer and std::size_t are not the same size");
DBG_GUI_E << "Adding timer.\n"; DBG_GUI_E << "Adding timer.";
timer timer; timer timer;
{ {
@ -161,19 +161,19 @@ std::size_t add_timer(const uint32_t interval,
get_timers().emplace(next_timer_id, timer); get_timers().emplace(next_timer_id, timer);
} }
DBG_GUI_E << "Added timer " << next_timer_id << ".\n"; DBG_GUI_E << "Added timer " << next_timer_id << ".";
return next_timer_id; return next_timer_id;
} }
bool remove_timer(const std::size_t id) bool remove_timer(const std::size_t id)
{ {
DBG_GUI_E << "Removing timer " << id << ".\n"; DBG_GUI_E << "Removing timer " << id << ".";
std::scoped_lock lock(timers_mutex); std::scoped_lock lock(timers_mutex);
auto itor = get_timers().find(id); auto itor = get_timers().find(id);
if(itor == get_timers().end()) { if(itor == get_timers().end()) {
LOG_GUI_E << "Can't remove timer since it no longer exists.\n"; LOG_GUI_E << "Can't remove timer since it no longer exists.";
return false; return false;
} }
@ -192,7 +192,7 @@ bool remove_timer(const std::size_t id)
* - Push event in queue * - Push event in queue
* - Another event is processed and tries to remove the event. * - Another event is processed and tries to remove the event.
*/ */
DBG_GUI_E << "The timer is already out of the SDL timer list.\n"; DBG_GUI_E << "The timer is already out of the SDL timer list.";
} }
get_timers().erase(itor); get_timers().erase(itor);
return true; return true;
@ -200,7 +200,7 @@ bool remove_timer(const std::size_t id)
bool execute_timer(const std::size_t id) bool execute_timer(const std::size_t id)
{ {
DBG_GUI_E << "Executing timer " << id << ".\n"; DBG_GUI_E << "Executing timer " << id << ".";
std::function<void(size_t)> callback = nullptr; std::function<void(size_t)> callback = nullptr;
{ {
@ -208,7 +208,7 @@ bool execute_timer(const std::size_t id)
auto itor = get_timers().find(id); auto itor = get_timers().find(id);
if(itor == get_timers().end()) { if(itor == get_timers().end()) {
LOG_GUI_E << "Can't execute timer since it no longer exists.\n"; LOG_GUI_E << "Can't execute timer since it no longer exists.";
return false; return false;
} }

View file

@ -95,7 +95,7 @@ builder_widget::builder_widget(const config& cfg)
debug_border_mode = widget::debug_border::fill; debug_border_mode = widget::debug_border::fill;
break; break;
default: default:
WRN_GUI_P << "Widget builder: unknown debug border mode " << dbm << ".\n"; WRN_GUI_P << "Widget builder: unknown debug border mode " << dbm << ".";
} }
} }
@ -151,7 +151,7 @@ void builder_window::read(const config& cfg)
VALIDATE(!id_.empty(), missing_mandatory_wml_key("window", "id")); VALIDATE(!id_.empty(), missing_mandatory_wml_key("window", "id"));
VALIDATE(!description_.empty(), missing_mandatory_wml_key("window", "description")); VALIDATE(!description_.empty(), missing_mandatory_wml_key("window", "description"));
DBG_GUI_P << "Window builder: reading data for window " << id_ << ".\n"; DBG_GUI_P << "Window builder: reading data for window " << id_ << ".";
config::const_child_itors cfgs = cfg.child_range("resolution"); config::const_child_itors cfgs = cfg.child_range("resolution");
VALIDATE(!cfgs.empty(), _("No resolution defined.")); VALIDATE(!cfgs.empty(), _("No resolution defined."));
@ -262,7 +262,7 @@ builder_grid::builder_grid(const config& cfg)
} }
} }
DBG_GUI_P << "Window builder: grid has " << rows << " rows and " << cols << " columns.\n"; DBG_GUI_P << "Window builder: grid has " << rows << " rows and " << cols << " columns.";
} }
std::unique_ptr<widget> builder_grid::build() const std::unique_ptr<widget> builder_grid::build() const
@ -287,7 +287,7 @@ void builder_grid::build(grid& grid, optional_replacements replacements) const
log_scope2(log_gui_general, "Window builder: building grid"); log_scope2(log_gui_general, "Window builder: building grid");
DBG_GUI_G << "Window builder: grid '" << id << "' has " << rows << " rows and " << cols << " columns.\n"; DBG_GUI_G << "Window builder: grid '" << id << "' has " << rows << " rows and " << cols << " columns.";
for(unsigned x = 0; x < rows; ++x) { for(unsigned x = 0; x < rows; ++x) {
grid.set_row_grow_factor(x, row_grow_factor[x]); grid.set_row_grow_factor(x, row_grow_factor[x]);
@ -297,7 +297,7 @@ void builder_grid::build(grid& grid, optional_replacements replacements) const
grid.set_column_grow_factor(y, col_grow_factor[y]); grid.set_column_grow_factor(y, col_grow_factor[y]);
} }
DBG_GUI_G << "Window builder: adding child at " << x << ',' << y << ".\n"; DBG_GUI_G << "Window builder: adding child at " << x << ',' << y << ".";
const unsigned int i = x * cols + y; const unsigned int i = x * cols + y;

View file

@ -67,8 +67,8 @@ public:
, filter() , filter()
, copy_button() , copy_button()
{ {
LOG_CHAT_LOG << "entering chat_log::model...\n"; LOG_CHAT_LOG << "entering chat_log::model...";
LOG_CHAT_LOG << "finished chat_log::model...\n"; LOG_CHAT_LOG << "finished chat_log::model...";
} }
vconfig cfg; vconfig cfg;
@ -105,7 +105,7 @@ public:
} }
const std::string& lcfilter = utf8::lowercase(filter->get_value()); const std::string& lcfilter = utf8::lowercase(filter->get_value());
LOG_CHAT_LOG << "entering chat_log::model::stream_log\n"; LOG_CHAT_LOG << "entering chat_log::model::stream_log";
for(const auto & t : make_pair(chat_log_history.begin() + first, for(const auto & t : make_pair(chat_log_history.begin() + first,
chat_log_history.begin() + last)) chat_log_history.begin() + last))

View file

@ -395,18 +395,18 @@ file_dialog::SELECTION_TYPE file_dialog::register_new_selection(const std::strin
// here. This makes it the only platform where is_relative() and is_root() // here. This makes it the only platform where is_relative() and is_root()
// aren't mutually exclusive. // aren't mutually exclusive.
if(fs::is_root(name)) { if(fs::is_root(name)) {
DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' is relative to a root resource\n"; DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' is relative to a root resource";
// Using the browsed dir's root drive instead of the cwd's makes the most // Using the browsed dir's root drive instead of the cwd's makes the most
// sense for users. // sense for users.
new_parent = fs::root_name(current_dir_); new_parent = fs::root_name(current_dir_);
new_path = fs::normalize_path(concat_path(new_parent, name), true, true); new_path = fs::normalize_path(concat_path(new_parent, name), true, true);
} else { } else {
DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' seems relative\n"; DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' seems relative";
new_parent = current_dir_; new_parent = current_dir_;
new_path = fs::normalize_path(concat_path(current_dir_, name), true, true); new_path = fs::normalize_path(concat_path(current_dir_, name), true, true);
} }
} else { } else {
DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' seems absolute\n"; DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' seems absolute";
new_parent = fs::directory_name(name); new_parent = fs::directory_name(name);
new_path = fs::normalize_path(name, true, true); new_path = fs::normalize_path(name, true, true);
DBG_FILEDLG << "register_new_selection(): new selection is " << new_path; DBG_FILEDLG << "register_new_selection(): new selection is " << new_path;
@ -433,13 +433,13 @@ file_dialog::SELECTION_TYPE file_dialog::register_new_selection(const std::strin
// exists). // exists).
const std::string& absolute_parent = fs::normalize_path(new_parent, true, true); const std::string& absolute_parent = fs::normalize_path(new_parent, true, true);
if(!absolute_parent.empty()) { if(!absolute_parent.empty()) {
DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' does not exist or is not accessible, but parent exists\n"; DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' does not exist or is not accessible, but parent exists";
current_dir_ = absolute_parent; current_dir_ = absolute_parent;
current_entry_ = fs::base_name(name); current_entry_ = fs::base_name(name);
return SELECTION_NOT_FOUND; return SELECTION_NOT_FOUND;
} }
DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' does not exist or is not accessible\n"; DBG_FILEDLG << "register_new_selection(): new selection '" << name << "' does not exist or is not accessible";
return SELECTION_PARENT_NOT_FOUND; return SELECTION_PARENT_NOT_FOUND;
} }

View file

@ -121,8 +121,8 @@ public:
, log_() , log_()
, raw_log_() , raw_log_()
{ {
DBG_LUA << "constructing a lua_interpreter::model\n"; DBG_LUA << "constructing a lua_interpreter::model";
//DBG_LUA << "incoming:\n" << lk.get_log().rdbuf() << "\n.\n"; //DBG_LUA << "incoming:\n" << lk.get_log().rdbuf() << "\n.";
log_ << font::escape_text(lk.get_log().str()) << std::flush; log_ << font::escape_text(lk.get_log().str()) << std::flush;
raw_log_ << lk.get_log().str() << std::flush; raw_log_ << lk.get_log().str() << std::flush;
// Lua kernel sends log strings to this function // Lua kernel sends log strings to this function
@ -130,14 +130,14 @@ public:
log_ << font::escape_text(str); log_ << font::escape_text(str);
raw_log_ << str; raw_log_ << str;
}); });
//DBG_LUA << "received:\n" << log_.str() << "\n.\n"; //DBG_LUA << "received:\n" << log_.str() << "\n.";
DBG_LUA << "finished constructing a lua_interpreter::model\n"; DBG_LUA << "finished constructing a lua_interpreter::model";
} }
~lua_model() ~lua_model()
{ {
DBG_LUA << "destroying a lua_interpreter::model\n"; DBG_LUA << "destroying a lua_interpreter::model";
L_.set_external_log(nullptr); //deregister our log since it's about to be destroyed L_.set_external_log(nullptr); //deregister our log since it's about to be destroyed
} }
@ -226,13 +226,13 @@ public:
} }
void maybe_update_prefix (const std::string & text) { void maybe_update_prefix (const std::string & text) {
LOG_LUA << "maybe update prefix\n"; LOG_LUA << "maybe update prefix";
LOG_LUA << "prefix_: '"<< prefix_ << "'\t text='"<< text << "'\n"; LOG_LUA << "prefix_: '"<< prefix_ << "'\t text='"<< text << "'";
if (!end_of_history_) return; if (!end_of_history_) return;
prefix_ = text; prefix_ = text;
LOG_LUA << "updated prefix\n"; LOG_LUA << "updated prefix";
} }
std::string search([[maybe_unused]] int direction ) { std::string search([[maybe_unused]] int direction ) {
@ -275,7 +275,7 @@ public:
} }
#endif #endif
LOG_LUA << "didn't find anything\n"; LOG_LUA << "didn't find anything";
// reset, set history to the end and prefix_ to empty, and return the current prefix_ for the user to edit // reset, set history to the end and prefix_ to empty, and return the current prefix_ for the user to edit
end_of_history_ = true; end_of_history_ = true;
@ -400,7 +400,7 @@ public:
/** Execute a command, and report any errors encountered. */ /** Execute a command, and report any errors encountered. */
bool lua_interpreter::lua_model::execute (const std::string & cmd) bool lua_interpreter::lua_model::execute (const std::string & cmd)
{ {
LOG_LUA << "lua_interpreter::model::execute...\n"; LOG_LUA << "lua_interpreter::model::execute...";
try { try {
L_.interactive_run(cmd.c_str()); L_.interactive_run(cmd.c_str());
@ -424,13 +424,13 @@ void lua_interpreter::lua_model::add_dialog_message(const std::string & msg) {
/** Update the view based on the model. */ /** Update the view based on the model. */
void lua_interpreter::controller::update_view() void lua_interpreter::controller::update_view()
{ {
LOG_LUA << "lua_interpreter update_view...\n"; LOG_LUA << "lua_interpreter update_view...";
assert(lua_model_); assert(lua_model_);
assert(view_); assert(view_);
view_->update_contents(lua_model_->get_log()); view_->update_contents(lua_model_->get_log());
LOG_LUA << "lua_interpreter update_view finished\n"; LOG_LUA << "lua_interpreter update_view finished";
} }
/** Find all the widgets managed by the controller and connect them to handler methods. */ /** Find all the widgets managed by the controller and connect them to handler methods. */
@ -503,9 +503,9 @@ void lua_interpreter::controller::input_keypress_callback(bool& handled,
assert(lua_model_); assert(lua_model_);
assert(text_entry); assert(text_entry);
LOG_LUA << "keypress_callback\n"; LOG_LUA << "keypress_callback";
if(key == SDLK_RETURN || key == SDLK_KP_ENTER) { // handle executing whatever is in the command entry field if(key == SDLK_RETURN || key == SDLK_KP_ENTER) { // handle executing whatever is in the command entry field
LOG_LUA << "executing...\n"; LOG_LUA << "executing...";
execute(); execute();
handled = true; handled = true;
halt = true; halt = true;
@ -514,7 +514,7 @@ void lua_interpreter::controller::input_keypress_callback(bool& handled,
// This preempts that. // This preempts that.
window.queue_redraw(); window.queue_redraw();
LOG_LUA << "finished executing\n"; LOG_LUA << "finished executing";
} else if(key == SDLK_TAB) { // handle tab completion } else if(key == SDLK_TAB) { // handle tab completion
tab(); tab();
handled = true; handled = true;
@ -545,7 +545,7 @@ void lua_interpreter::controller::execute()
cmd.erase(cmd.find_last_not_of(" \n\r\t")+1); //right trim the string cmd.erase(cmd.find_last_not_of(" \n\r\t")+1); //right trim the string
LOG_LUA << "Executing '"<< cmd << "'\n"; LOG_LUA << "Executing '"<< cmd << "'";
if (cmd.size() >= 13 && (cmd.substr(0,13) == "history clear" || cmd.substr(0,13) == "clear history")) { if (cmd.size() >= 13 && (cmd.substr(0,13) == "history clear" || cmd.substr(0,13) == "clear history")) {
lua_model_->add_dialog_message(input_model_->clear_history()); lua_model_->add_dialog_message(input_model_->clear_history());
@ -677,7 +677,7 @@ void lua_interpreter::display(lua_kernel_base * lk) {
} }
#endif #endif
if (!lk) { if (!lk) {
ERR_LUA << "Tried to open console with a null lua kernel pointer.\n"; ERR_LUA << "Tried to open console with a null lua kernel pointer.";
return; return;
} }
@ -711,8 +711,8 @@ void lua_interpreter::pre_show(window& window)
lua_interpreter::lua_interpreter(lua_kernel_base & lk) lua_interpreter::lua_interpreter(lua_kernel_base & lk)
: controller_(new lua_interpreter::controller(lk)) : controller_(new lua_interpreter::controller(lk))
{ {
LOG_LUA << "entering lua_interpreter ctor...\n"; LOG_LUA << "entering lua_interpreter ctor...";
LOG_LUA << "finished lua_interpreter ctor...\n"; LOG_LUA << "finished lua_interpreter ctor...";
} }
} // namespace dialogs } // namespace dialogs

View file

@ -300,7 +300,7 @@ void mp_lobby::update_gamelist_diff()
next_gamelist_id_at_row.push_back(game.id); next_gamelist_id_at_row.push_back(game.id);
} else { } else {
if(list_i >= gamelistbox_->get_item_count()) { if(list_i >= gamelistbox_->get_item_count()) {
ERR_LB << "Ran out of listbox items -- triggering a full refresh\n"; ERR_LB << "Ran out of listbox items -- triggering a full refresh";
refresh_lobby(); refresh_lobby();
return; return;
} }
@ -323,7 +323,7 @@ void mp_lobby::update_gamelist_diff()
} }
if(game.display_status == mp::game_info::disp_status::UPDATED) { if(game.display_status == mp::game_info::disp_status::UPDATED) {
LOG_LB << "Modifying game in listbox " << game.id << " (row " << list_i << ")\n"; LOG_LB << "Modifying game in listbox " << game.id << " (row " << list_i << ")";
grid* grid = gamelistbox_->get_row_grid(list_i); grid* grid = gamelistbox_->get_row_grid(list_i);
modify_grid_with_data(grid, make_game_row_data(game)); modify_grid_with_data(grid, make_game_row_data(game));
adjust_game_row_contents(game, grid, false); adjust_game_row_contents(game, grid, false);
@ -336,7 +336,7 @@ void mp_lobby::update_gamelist_diff()
++list_rows_deleted; ++list_rows_deleted;
} else { } else {
// clean // clean
LOG_LB << "Clean game in listbox " << game.id << " (row " << list_i << ")\n"; LOG_LB << "Clean game in listbox " << game.id << " (row " << list_i << ")";
next_gamelist_id_at_row.push_back(game.id); next_gamelist_id_at_row.push_back(game.id);
++list_i; ++list_i;
} }
@ -516,7 +516,7 @@ void mp_lobby::adjust_game_row_contents(const mp::game_info& game, grid* grid, b
void mp_lobby::update_gamelist_filter() void mp_lobby::update_gamelist_filter()
{ {
DBG_LB << "mp_lobby::update_gamelist_filter\n"; DBG_LB << "mp_lobby::update_gamelist_filter";
lobby_info_.apply_game_filter(); lobby_info_.apply_game_filter();
DBG_LB << "Games in lobby_info: " << lobby_info_.games().size() DBG_LB << "Games in lobby_info: " << lobby_info_.games().size()
<< ", games in listbox: " << gamelistbox_->get_item_count() << "\n"; << ", games in listbox: " << gamelistbox_->get_item_count() << "\n";
@ -757,7 +757,7 @@ void mp_lobby::process_gamelist(const config& data)
if(delay_gamelist_update_ || delay_playerlist_update_) return; if(delay_gamelist_update_ || delay_playerlist_update_) return;
lobby_info_.process_gamelist(data); lobby_info_.process_gamelist(data);
DBG_LB << "Received gamelist\n"; DBG_LB << "Received gamelist";
gamelist_dirty_ = true; gamelist_dirty_ = true;
gamelist_diff_update_ = false; gamelist_diff_update_ = false;
} }
@ -767,7 +767,7 @@ void mp_lobby::process_gamelist_diff(const config& data)
if(delay_gamelist_update_ || delay_playerlist_update_) return; if(delay_gamelist_update_ || delay_playerlist_update_) return;
if(lobby_info_.process_gamelist_diff(data)) { if(lobby_info_.process_gamelist_diff(data)) {
DBG_LB << "Received gamelist diff\n"; DBG_LB << "Received gamelist diff";
gamelist_dirty_ = true; gamelist_dirty_ = true;
} else { } else {
ERR_LB << "process_gamelist_diff failed!"; ERR_LB << "process_gamelist_diff failed!";

View file

@ -411,10 +411,10 @@ void mp_create_game::pre_show(window& win)
void mp_create_game::sync_with_depcheck() void mp_create_game::sync_with_depcheck()
{ {
DBG_MP << "sync_with_depcheck: start\n"; DBG_MP << "sync_with_depcheck: start";
if(static_cast<int>(create_engine_.current_era_index()) != create_engine_.dependency_manager().get_era_index()) { if(static_cast<int>(create_engine_.current_era_index()) != create_engine_.dependency_manager().get_era_index()) {
DBG_MP << "sync_with_depcheck: correcting era\n"; DBG_MP << "sync_with_depcheck: correcting era";
const int new_era_index = create_engine_.dependency_manager().get_era_index(); const int new_era_index = create_engine_.dependency_manager().get_era_index();
create_engine_.set_current_era_index(new_era_index, true); create_engine_.set_current_era_index(new_era_index, true);
@ -422,7 +422,7 @@ void mp_create_game::sync_with_depcheck()
} }
if(create_engine_.current_level().id() != create_engine_.dependency_manager().get_scenario()) { if(create_engine_.current_level().id() != create_engine_.dependency_manager().get_scenario()) {
DBG_MP << "sync_with_depcheck: correcting scenario\n"; DBG_MP << "sync_with_depcheck: correcting scenario";
// Match scenario and scenario type // Match scenario and scenario type
const auto new_level_index = create_engine_.find_level_by_id(create_engine_.dependency_manager().get_scenario()); const auto new_level_index = create_engine_.find_level_by_id(create_engine_.dependency_manager().get_scenario());
@ -454,12 +454,12 @@ void mp_create_game::sync_with_depcheck()
} }
if(get_active_mods() != create_engine_.dependency_manager().get_modifications()) { if(get_active_mods() != create_engine_.dependency_manager().get_modifications()) {
DBG_MP << "sync_with_depcheck: correcting modifications\n"; DBG_MP << "sync_with_depcheck: correcting modifications";
set_active_mods(create_engine_.dependency_manager().get_modifications()); set_active_mods(create_engine_.dependency_manager().get_modifications());
} }
create_engine_.init_active_mods(); create_engine_.init_active_mods();
DBG_MP << "sync_with_depcheck: end\n"; DBG_MP << "sync_with_depcheck: end";
} }
template<typename widget> template<typename widget>
@ -525,7 +525,7 @@ void mp_create_game::on_tab_select()
void mp_create_game::on_mod_toggle(const int index, toggle_button* sender) void mp_create_game::on_mod_toggle(const int index, toggle_button* sender)
{ {
if(sender && (sender->get_value_bool() == create_engine_.dependency_manager().is_modification_active(index))) { if(sender && (sender->get_value_bool() == create_engine_.dependency_manager().is_modification_active(index))) {
ERR_MP << "ignoring on_mod_toggle that is already set\n"; ERR_MP << "ignoring on_mod_toggle that is already set";
return; return;
} }

View file

@ -289,13 +289,13 @@ bool mp_join_game::show_flg_select(int side_num, bool first_time)
const config& era = level_.child("era"); const config& era = level_.child("era");
if(!era) { if(!era) {
ERR_MP << "no era information\n"; ERR_MP << "no era information";
return false; return false;
} }
config::const_child_itors possible_sides = era.child_range("multiplayer_side"); config::const_child_itors possible_sides = era.child_range("multiplayer_side");
if(possible_sides.empty()) { if(possible_sides.empty()) {
WRN_MP << "no [multiplayer_side] found in era '" << era["id"] << "'.\n"; WRN_MP << "no [multiplayer_side] found in era '" << era["id"] << "'.";
return false; return false;
} }
@ -547,7 +547,7 @@ void mp_join_game::network_handler()
} }
if(data.has_child("turn")) { if(data.has_child("turn")) {
ERR_MP << "received replay data\n" << data << "\n in mp join\n"; ERR_MP << "received replay data\n" << data << "\n in mp join";
} }
// Update player list // Update player list

View file

@ -76,7 +76,7 @@ static void dump_recall_list_to_console(const T& units)
std::size_t idx = 0; std::size_t idx = 0;
for(const auto& u_ptr : units) { for(const auto& u_ptr : units) {
LOG_DP << "\tunit[" << (idx++) << "]: " << u_ptr->id() << " name = '" << u_ptr->name() << "'\n"; LOG_DP << "\tunit[" << (idx++) << "]: " << u_ptr->id() << " name = '" << u_ptr->name() << "'";
} }
} }
@ -342,7 +342,7 @@ void unit_recall::rename_unit()
void unit_recall::dismiss_unit() void unit_recall::dismiss_unit()
{ {
LOG_DP << "Recall list units:\n"; dump_recall_list_to_console(recall_list_); LOG_DP << "Recall list units:"; dump_recall_list_to_console(recall_list_);
listbox& list = find_widget<listbox>(get_window(), "recall_list", false); listbox& list = find_widget<listbox>(get_window(), "recall_list", false);
const int index = list.get_selected_row(); const int index = list.get_selected_row();
@ -388,8 +388,8 @@ void unit_recall::dismiss_unit()
filter_options_.erase(filter_options_.begin() + index); filter_options_.erase(filter_options_.begin() + index);
assert(filter_options_.size() == list.get_item_count()); assert(filter_options_.size() == list.get_item_count());
LOG_DP << "Dismissing a unit, side = " << u.side() << ", id = '" << u.id() << "'\n"; LOG_DP << "Dismissing a unit, side = " << u.side() << ", id = '" << u.id() << "'";
LOG_DP << "That side's recall list:\n"; LOG_DP << "That side's recall list:";
dump_recall_list_to_console(team_.recall_list()); dump_recall_list_to_console(team_.recall_list());
// Find the unit in the recall list. // Find the unit in the recall list.

View file

@ -87,7 +87,7 @@ void init()
if(current_theme.empty()) { if(current_theme.empty()) {
current_gui = default_gui; current_gui = default_gui;
} else if(current_gui == guis.end()) { } else if(current_gui == guis.end()) {
ERR_GUI_P << "Missing [gui] definition for '" << current_theme << "'\n"; ERR_GUI_P << "Missing [gui] definition for '" << current_theme << "'";
current_gui = default_gui; current_gui = default_gui;
} }

View file

@ -88,7 +88,7 @@ void button::set_state(const state_t state)
void button::signal_handler_mouse_enter(const event::ui_event event, void button::signal_handler_mouse_enter(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -97,7 +97,7 @@ void button::signal_handler_mouse_enter(const event::ui_event event,
void button::signal_handler_mouse_leave(const event::ui_event event, void button::signal_handler_mouse_leave(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(ENABLED); set_state(ENABLED);
handled = true; handled = true;
@ -106,7 +106,7 @@ void button::signal_handler_mouse_leave(const event::ui_event event,
void button::signal_handler_left_button_down(const event::ui_event event, void button::signal_handler_left_button_down(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
window* window = get_window(); window* window = get_window();
if(window) { if(window) {
@ -120,7 +120,7 @@ void button::signal_handler_left_button_down(const event::ui_event event,
void button::signal_handler_left_button_up(const event::ui_event event, void button::signal_handler_left_button_up(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -129,7 +129,7 @@ void button::signal_handler_left_button_up(const event::ui_event event,
void button::signal_handler_left_button_click(const event::ui_event event, void button::signal_handler_left_button_click(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
sound::play_UI_sound(settings::sound_button_click); sound::play_UI_sound(settings::sound_button_click);

View file

@ -327,7 +327,7 @@ void chatbox::add_chat_room_message_sent(const std::string& room, const std::str
{ {
lobby_chat_window* t = room_window_open(room, false); lobby_chat_window* t = room_window_open(room, false);
if(!t) { if(!t) {
LOG_LB << "Cannot add sent message to ui for room " << room << ", player not in the room\n"; LOG_LB << "Cannot add sent message to ui for room " << room << ", player not in the room";
return; return;
} }
@ -597,19 +597,19 @@ void chatbox::process_message(const ::config& data, bool whisper /*= false*/)
// Attempt to send to the currently active room first. // Attempt to send to the currently active room first.
if(room.empty()) { if(room.empty()) {
LOG_LB << "Message without a room from " << sender << ", falling back to active window\n"; LOG_LB << "Message without a room from " << sender << ", falling back to active window";
room = open_windows_[active_window_].name; room = open_windows_[active_window_].name;
} }
// If we still don't have a name, fall back to lobby. // If we still don't have a name, fall back to lobby.
if(room.empty()) { if(room.empty()) {
LOG_LB << "Message without a room from " << sender << ", assuming lobby\n"; LOG_LB << "Message without a room from " << sender << ", assuming lobby";
room = "lobby"; room = "lobby";
} }
if(log_ != nullptr && data["type"].str() == "motd") { if(log_ != nullptr && data["type"].str() == "motd") {
if(log_->at("lobby").received_motd == message) { if(log_->at("lobby").received_motd == message) {
LOG_LB << "Ignoring repeated motd\n"; LOG_LB << "Ignoring repeated motd";
return; return;
} else { } else {
log_->at("lobby").received_motd = message; log_->at("lobby").received_motd = message;
@ -636,7 +636,7 @@ void chatbox::process_network_data(const ::config& data)
void chatbox::signal_handler_receive_keyboard_focus(const event::ui_event event) void chatbox::signal_handler_receive_keyboard_focus(const event::ui_event event)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
// Forward focus to the input textbox. // Forward focus to the input textbox.
get_window()->keyboard_capture(chat_input_); get_window()->keyboard_capture(chat_input_);

View file

@ -204,11 +204,11 @@ void grid::reduce_width(const unsigned maximum_width)
{ {
/***** ***** ***** ***** INIT ***** ***** ***** *****/ /***** ***** ***** ***** INIT ***** ***** ***** *****/
log_scope2(log_gui_layout, LOG_SCOPE_HEADER); log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
DBG_GUI_L << LOG_HEADER << " maximum width " << maximum_width << ".\n"; DBG_GUI_L << LOG_HEADER << " maximum width " << maximum_width << ".";
point size = get_best_size(); point size = get_best_size();
if(size.x <= static_cast<int>(maximum_width)) { if(size.x <= static_cast<int>(maximum_width)) {
DBG_GUI_L << LOG_HEADER << " Already fits.\n"; DBG_GUI_L << LOG_HEADER << " Already fits.";
return; return;
} }
@ -218,7 +218,7 @@ void grid::reduce_width(const unsigned maximum_width)
size = get_best_size(); size = get_best_size();
if(size.x <= static_cast<int>(maximum_width)) { if(size.x <= static_cast<int>(maximum_width)) {
DBG_GUI_L << LOG_HEADER << " Resize request honored.\n"; DBG_GUI_L << LOG_HEADER << " Resize request honored.";
return; return;
} }
@ -228,7 +228,7 @@ void grid::reduce_width(const unsigned maximum_width)
/***** ***** ***** ***** Acknowledge failure ***** ***** ***** *****/ /***** ***** ***** ***** Acknowledge failure ***** ***** ***** *****/
DBG_GUI_L << LOG_HEADER << " Resizing failed.\n"; DBG_GUI_L << LOG_HEADER << " Resizing failed.";
throw layout_exception_width_resize_failed(); throw layout_exception_width_resize_failed();
} }
@ -282,11 +282,11 @@ void grid::reduce_height(const unsigned maximum_height)
{ {
/***** ***** ***** ***** INIT ***** ***** ***** *****/ /***** ***** ***** ***** INIT ***** ***** ***** *****/
log_scope2(log_gui_layout, LOG_SCOPE_HEADER); log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
DBG_GUI_L << LOG_HEADER << " maximum height " << maximum_height << ".\n"; DBG_GUI_L << LOG_HEADER << " maximum height " << maximum_height << ".";
point size = get_best_size(); point size = get_best_size();
if(size.y <= static_cast<int>(maximum_height)) { if(size.y <= static_cast<int>(maximum_height)) {
DBG_GUI_L << LOG_HEADER << " Already fits.\n"; DBG_GUI_L << LOG_HEADER << " Already fits.";
return; return;
} }
@ -296,7 +296,7 @@ void grid::reduce_height(const unsigned maximum_height)
size = get_best_size(); size = get_best_size();
if(size.y <= static_cast<int>(maximum_height)) { if(size.y <= static_cast<int>(maximum_height)) {
DBG_GUI_L << LOG_HEADER << " Resize request honored.\n"; DBG_GUI_L << LOG_HEADER << " Resize request honored.";
return; return;
} }
@ -306,7 +306,7 @@ void grid::reduce_height(const unsigned maximum_height)
/***** ***** ***** ***** Acknowledge failure ***** ***** ***** *****/ /***** ***** ***** ***** Acknowledge failure ***** ***** ***** *****/
DBG_GUI_L << LOG_HEADER << " Resizing failed.\n"; DBG_GUI_L << LOG_HEADER << " Resizing failed.";
throw layout_exception_height_resize_failed(); throw layout_exception_height_resize_failed();
} }
@ -464,7 +464,7 @@ point grid::calculate_best_size() const
std::accumulate(col_width_.begin(), col_width_.end(), 0), std::accumulate(col_width_.begin(), col_width_.end(), 0),
std::accumulate(row_height_.begin(), row_height_.end(), 0)); std::accumulate(row_height_.begin(), row_height_.end(), 0));
DBG_GUI_L << LOG_HEADER << " returning " << result << ".\n"; DBG_GUI_L << LOG_HEADER << " returning " << result << ".";
return result; return result;
} }
@ -521,7 +521,7 @@ void grid::place(const point& origin, const point& size)
out << " in a '" << typeid(*pw).name() << "' with the id '" << pw->id() << "'"; out << " in a '" << typeid(*pw).name() << "' with the id '" << pw->id() << "'";
pw = pw->parent(); pw = pw->parent();
} }
ERR_GUI_L << LOG_HEADER << out.str() << ".\n"; ERR_GUI_L << LOG_HEADER << out.str() << ".";
return; return;
} }
@ -824,17 +824,17 @@ void grid::child::place(point origin, point size)
} else if(v_flag == VERTICAL_ALIGN_TOP) { } else if(v_flag == VERTICAL_ALIGN_TOP) {
// Do nothing. // Do nothing.
DBG_GUI_L << LOG_CHILD_HEADER << " vertically aligned at the top.\n"; DBG_GUI_L << LOG_CHILD_HEADER << " vertically aligned at the top.";
} else if(v_flag == VERTICAL_ALIGN_CENTER) { } else if(v_flag == VERTICAL_ALIGN_CENTER) {
widget_orig.y += (size.y - widget_size.y) / 2; widget_orig.y += (size.y - widget_size.y) / 2;
DBG_GUI_L << LOG_CHILD_HEADER << " vertically centered.\n"; DBG_GUI_L << LOG_CHILD_HEADER << " vertically centered.";
} else if(v_flag == VERTICAL_ALIGN_BOTTOM) { } else if(v_flag == VERTICAL_ALIGN_BOTTOM) {
widget_orig.y += (size.y - widget_size.y); widget_orig.y += (size.y - widget_size.y);
DBG_GUI_L << LOG_CHILD_HEADER << " vertically aligned at the bottom.\n"; DBG_GUI_L << LOG_CHILD_HEADER << " vertically aligned at the bottom.";
} else { } else {
ERR_GUI_L << LOG_CHILD_HEADER << " Invalid vertical alignment '" ERR_GUI_L << LOG_CHILD_HEADER << " Invalid vertical alignment '"
@ -855,12 +855,12 @@ void grid::child::place(point origin, point size)
} else if(h_flag == HORIZONTAL_ALIGN_LEFT) { } else if(h_flag == HORIZONTAL_ALIGN_LEFT) {
// Do nothing. // Do nothing.
DBG_GUI_L << LOG_CHILD_HEADER << " horizontally aligned at the left.\n"; DBG_GUI_L << LOG_CHILD_HEADER << " horizontally aligned at the left.";
} else if(h_flag == HORIZONTAL_ALIGN_CENTER) { } else if(h_flag == HORIZONTAL_ALIGN_CENTER) {
widget_orig.x += (size.x - widget_size.x) / 2; widget_orig.x += (size.x - widget_size.x) / 2;
DBG_GUI_L << LOG_CHILD_HEADER << " horizontally centered.\n"; DBG_GUI_L << LOG_CHILD_HEADER << " horizontally centered.";
} else if(h_flag == HORIZONTAL_ALIGN_RIGHT) { } else if(h_flag == HORIZONTAL_ALIGN_RIGHT) {

View file

@ -47,7 +47,7 @@ point image::calculate_best_size() const
point image_size = ::image::get_size(::image::locator{get_label()}); point image_size = ::image::get_size(::image::locator{get_label()});
if(image_size.x == 0 || image_size.y == 0) { if(image_size.x == 0 || image_size.y == 0) {
DBG_GUI_L << LOG_HEADER << " empty image return default.\n"; DBG_GUI_L << LOG_HEADER << " empty image return default.";
return get_config_default_size(); return get_config_default_size();
} }
@ -57,22 +57,22 @@ point image::calculate_best_size() const
point result {image_size.x, image_size.y}; point result {image_size.x, image_size.y};
if(minimum.x > 0 && result.x < minimum.x) { if(minimum.x > 0 && result.x < minimum.x) {
DBG_GUI_L << LOG_HEADER << " increase width to minimum.\n"; DBG_GUI_L << LOG_HEADER << " increase width to minimum.";
result.x = minimum.x; result.x = minimum.x;
} else if(maximum.x > 0 && result.x > maximum.x) { } else if(maximum.x > 0 && result.x > maximum.x) {
DBG_GUI_L << LOG_HEADER << " decrease width to maximum.\n"; DBG_GUI_L << LOG_HEADER << " decrease width to maximum.";
result.x = maximum.x; result.x = maximum.x;
} }
if(minimum.y > 0 && result.y < minimum.y) { if(minimum.y > 0 && result.y < minimum.y) {
DBG_GUI_L << LOG_HEADER << " increase height to minimum.\n"; DBG_GUI_L << LOG_HEADER << " increase height to minimum.";
result.y = minimum.y; result.y = minimum.y;
} else if(maximum.y > 0 && result.y > maximum.y) { } else if(maximum.y > 0 && result.y > maximum.y) {
DBG_GUI_L << LOG_HEADER << " decrease height to maximum.\n"; DBG_GUI_L << LOG_HEADER << " decrease height to maximum.";
result.y = maximum.y; result.y = maximum.y;
} }
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n"; DBG_GUI_L << LOG_HEADER << " result " << result << ".";
return result; return result;
} }

View file

@ -139,7 +139,7 @@ void label::signal_handler_left_button_click(bool& handled)
return ; // without marking event as "handled" return ; // without marking event as "handled"
} }
DBG_GUI_E << "Clicked Link:\"" << link << "\"\n"; DBG_GUI_E << "Clicked Link:\"" << link << "\"";
const int res = show_message(_("Open link?"), link, dialogs::message::yes_no_buttons); const int res = show_message(_("Open link?"), link, dialogs::message::yes_no_buttons);
if(res == gui2::retval::OK) { if(res == gui2::retval::OK) {
@ -168,7 +168,7 @@ void label::signal_handler_right_button_click(bool& handled)
return ; // without marking event as "handled" return ; // without marking event as "handled"
} }
DBG_GUI_E << "Right Clicked Link:\"" << link << "\"\n"; DBG_GUI_E << "Right Clicked Link:\"" << link << "\"";
desktop::clipboard::copy_to_clipboard(link, false); desktop::clipboard::copy_to_clipboard(link, false);

View file

@ -400,9 +400,9 @@ void listbox::resize_content(const int width_modification,
queue_redraw(); queue_redraw();
} }
DBG_GUI_L << LOG_HEADER << " succeeded.\n"; DBG_GUI_L << LOG_HEADER << " succeeded.";
} else { } else {
DBG_GUI_L << LOG_HEADER << " failed.\n"; DBG_GUI_L << LOG_HEADER << " failed.";
} }
} }
@ -788,7 +788,7 @@ std::unique_ptr<widget> builder_listbox::build() const
widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode); widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode);
widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode); widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode);
DBG_GUI_G << "Window builder: placed listbox '" << id << "' with definition '" << definition << "'.\n"; DBG_GUI_G << "Window builder: placed listbox '" << id << "' with definition '" << definition << "'.";
const auto conf = widget->cast_config_to<listbox_definition>(); const auto conf = widget->cast_config_to<listbox_definition>();
assert(conf); assert(conf);
@ -831,7 +831,7 @@ std::unique_ptr<widget> builder_horizontal_listbox::build() const
widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode); widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode);
widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode); widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode);
DBG_GUI_G << "Window builder: placed listbox '" << id << "' with definition '" << definition << "'.\n"; DBG_GUI_G << "Window builder: placed listbox '" << id << "' with definition '" << definition << "'.";
const auto conf = widget->cast_config_to<listbox_definition>(); const auto conf = widget->cast_config_to<listbox_definition>();
assert(conf); assert(conf);
@ -874,7 +874,7 @@ std::unique_ptr<widget> builder_grid_listbox::build() const
widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode); widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode);
widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode); widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode);
DBG_GUI_G << "Window builder: placed listbox '" << id << "' with definition '" << definition << "'.\n"; DBG_GUI_G << "Window builder: placed listbox '" << id << "' with definition '" << definition << "'.";
const auto conf = widget->cast_config_to<listbox_definition>(); const auto conf = widget->cast_config_to<listbox_definition>();
assert(conf); assert(conf);

View file

@ -99,7 +99,7 @@ void menu_button::set_state(const state_t state)
void menu_button::signal_handler_mouse_enter(const event::ui_event event, bool& handled) void menu_button::signal_handler_mouse_enter(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -107,7 +107,7 @@ void menu_button::signal_handler_mouse_enter(const event::ui_event event, bool&
void menu_button::signal_handler_mouse_leave(const event::ui_event event, bool& handled) void menu_button::signal_handler_mouse_leave(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(ENABLED); set_state(ENABLED);
handled = true; handled = true;
@ -115,7 +115,7 @@ void menu_button::signal_handler_mouse_leave(const event::ui_event event, bool&
void menu_button::signal_handler_left_button_down(const event::ui_event event, bool& handled) void menu_button::signal_handler_left_button_down(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
window* window = get_window(); window* window = get_window();
if(window) { if(window) {
@ -128,7 +128,7 @@ void menu_button::signal_handler_left_button_down(const event::ui_event event, b
void menu_button::signal_handler_left_button_up(const event::ui_event event, bool& handled) void menu_button::signal_handler_left_button_up(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -137,7 +137,7 @@ void menu_button::signal_handler_left_button_up(const event::ui_event event, boo
void menu_button::signal_handler_left_button_click(const event::ui_event event, bool& handled) void menu_button::signal_handler_left_button_click(const event::ui_event event, bool& handled)
{ {
assert(get_window()); assert(get_window());
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
sound::play_UI_sound(settings::sound_button_click); sound::play_UI_sound(settings::sound_button_click);
@ -161,7 +161,7 @@ void menu_button::signal_handler_left_button_click(const event::ui_event event,
void menu_button::signal_handler_sdl_wheel_up(const event::ui_event event, bool& handled) void menu_button::signal_handler_sdl_wheel_up(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
// TODO: should values wrap? // TODO: should values wrap?
if(selected_ > 0) { if(selected_ > 0) {
@ -173,7 +173,7 @@ void menu_button::signal_handler_sdl_wheel_up(const event::ui_event event, bool&
void menu_button::signal_handler_sdl_wheel_down(const event::ui_event event, bool& handled) void menu_button::signal_handler_sdl_wheel_down(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
// TODO: should values wrap? // TODO: should values wrap?
if(selected_ < values_.size() - 1) { if(selected_ < values_.size() - 1) {

View file

@ -95,7 +95,7 @@ void multimenu_button::set_state(const state_t state)
void multimenu_button::signal_handler_mouse_enter(const event::ui_event event, bool& handled) void multimenu_button::signal_handler_mouse_enter(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -103,7 +103,7 @@ void multimenu_button::signal_handler_mouse_enter(const event::ui_event event, b
void multimenu_button::signal_handler_mouse_leave(const event::ui_event event, bool& handled) void multimenu_button::signal_handler_mouse_leave(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(ENABLED); set_state(ENABLED);
handled = true; handled = true;
@ -111,7 +111,7 @@ void multimenu_button::signal_handler_mouse_leave(const event::ui_event event, b
void multimenu_button::signal_handler_left_button_down(const event::ui_event event, bool& handled) void multimenu_button::signal_handler_left_button_down(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
window* window = get_window(); window* window = get_window();
if(window) { if(window) {
@ -124,7 +124,7 @@ void multimenu_button::signal_handler_left_button_down(const event::ui_event eve
void multimenu_button::signal_handler_left_button_up(const event::ui_event event, bool& handled) void multimenu_button::signal_handler_left_button_up(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -133,7 +133,7 @@ void multimenu_button::signal_handler_left_button_up(const event::ui_event event
void multimenu_button::signal_handler_left_button_click(const event::ui_event event, bool& handled) void multimenu_button::signal_handler_left_button_click(const event::ui_event event, bool& handled)
{ {
assert(get_window()); assert(get_window());
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
sound::play_UI_sound(settings::sound_button_click); sound::play_UI_sound(settings::sound_button_click);

View file

@ -311,7 +311,7 @@ void pane::signal_handler_request_placement(dispatcher& dispatcher,
const event::ui_event event, const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
widget* wgt = dynamic_cast<widget*>(&dispatcher); widget* wgt = dynamic_cast<widget*>(&dispatcher);
if(wgt) { if(wgt) {
@ -337,14 +337,14 @@ void pane::signal_handler_request_placement(dispatcher& dispatcher,
item.item_grid->place(point(), item.item_grid->get_best_size()); item.item_grid->place(point(), item.item_grid->get_best_size());
} }
place_or_set_origin_children(); place_or_set_origin_children();
DBG_GUI_E << LOG_HEADER << ' ' << event << " handled.\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << " handled.";
handled = true; handled = true;
return; return;
} }
} }
} }
DBG_GUI_E << LOG_HEADER << ' ' << event << " failed to handle.\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << " failed to handle.";
assert(false); assert(false);
handled = false; handled = false;
} }

View file

@ -67,13 +67,13 @@ unsigned panel::get_state() const
void panel::impl_draw_background() void panel::impl_draw_background()
{ {
DBG_GUI_D << LOG_HEADER << " size " << get_rectangle() << ".\n"; DBG_GUI_D << LOG_HEADER << " size " << get_rectangle() << ".";
get_canvas(0).draw(); get_canvas(0).draw();
} }
void panel::impl_draw_foreground() void panel::impl_draw_foreground()
{ {
DBG_GUI_D << LOG_HEADER << " size " << get_rectangle() << ".\n"; DBG_GUI_D << LOG_HEADER << " size " << get_rectangle() << ".";
get_canvas(1).draw(); get_canvas(1).draw();
} }

View file

@ -105,7 +105,7 @@ void repeating_button::set_state(const state_t state)
void repeating_button::signal_handler_mouse_enter(const event::ui_event event, void repeating_button::signal_handler_mouse_enter(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -114,7 +114,7 @@ void repeating_button::signal_handler_mouse_enter(const event::ui_event event,
void repeating_button::signal_handler_mouse_leave(const event::ui_event event, void repeating_button::signal_handler_mouse_leave(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(ENABLED); set_state(ENABLED);
handled = true; handled = true;
@ -124,7 +124,7 @@ void
repeating_button::signal_handler_left_button_down(const event::ui_event event, repeating_button::signal_handler_left_button_down(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
// If the timer isn't set it's the initial down event. // If the timer isn't set it's the initial down event.
if(!repeat_timer_) { if(!repeat_timer_) {
@ -151,7 +151,7 @@ repeating_button::signal_handler_left_button_down(const event::ui_event event,
void repeating_button::signal_handler_left_button_up(const event::ui_event event, void repeating_button::signal_handler_left_button_up(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(repeat_timer_) { if(repeat_timer_) {
remove_timer(repeat_timer_); remove_timer(repeat_timer_);

View file

@ -157,7 +157,7 @@ bool scroll_label::can_wrap() const
void scroll_label::signal_handler_left_button_down(const event::ui_event event) void scroll_label::signal_handler_left_button_down(const event::ui_event event)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
get_window()->keyboard_capture(this); get_window()->keyboard_capture(this);
} }

View file

@ -336,7 +336,7 @@ void scrollbar_base::signal_handler_mouse_enter(const event::ui_event event,
bool& handled, bool& handled,
bool& halt) bool& halt)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
// Send the motion under our event id to make debugging easier. // Send the motion under our event id to make debugging easier.
signal_handler_mouse_motion(event, handled, halt, get_mouse_position()); signal_handler_mouse_motion(event, handled, halt, get_mouse_position());
@ -347,7 +347,7 @@ void scrollbar_base::signal_handler_mouse_motion(const event::ui_event event,
bool& halt, bool& halt,
const point& coordinate) const point& coordinate)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << " at " << coordinate << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << " at " << coordinate << ".";
point mouse = coordinate; point mouse = coordinate;
mouse.x -= get_x(); mouse.x -= get_x();
@ -391,7 +391,7 @@ void scrollbar_base::signal_handler_mouse_motion(const event::ui_event event,
void scrollbar_base::signal_handler_mouse_leave(const event::ui_event event, void scrollbar_base::signal_handler_mouse_leave(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(state_ == FOCUSED) { if(state_ == FOCUSED) {
set_state(ENABLED); set_state(ENABLED);
@ -403,7 +403,7 @@ void scrollbar_base::signal_handler_mouse_leave(const event::ui_event event,
void scrollbar_base::signal_handler_left_button_down(const event::ui_event event, void scrollbar_base::signal_handler_left_button_down(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
point mouse = get_mouse_position(); point mouse = get_mouse_position();
mouse.x -= get_x(); mouse.x -= get_x();
@ -434,7 +434,7 @@ void scrollbar_base::signal_handler_left_button_down(const event::ui_event event
void scrollbar_base::signal_handler_left_button_up(const event::ui_event event, void scrollbar_base::signal_handler_left_button_up(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
point mouse = get_mouse_position(); point mouse = get_mouse_position();
mouse.x -= get_x(); mouse.x -= get_x();

View file

@ -154,7 +154,7 @@ void scrollbar_container::layout_initialize(const bool full_initialization)
void scrollbar_container::request_reduce_height(const unsigned maximum_height) void scrollbar_container::request_reduce_height(const unsigned maximum_height)
{ {
DBG_GUI_L << LOG_HEADER << " requested height " << maximum_height << ".\n"; DBG_GUI_L << LOG_HEADER << " requested height " << maximum_height << ".";
/* /*
* First ask the content to reduce it's height. This seems to work for now, * First ask the content to reduce it's height. This seems to work for now,
@ -172,12 +172,12 @@ void scrollbar_container::request_reduce_height(const unsigned maximum_height)
// Did we manage to achieve the wanted size? // Did we manage to achieve the wanted size?
point size = get_best_size(); point size = get_best_size();
if(static_cast<unsigned>(size.y) <= maximum_height) { if(static_cast<unsigned>(size.y) <= maximum_height) {
DBG_GUI_L << LOG_HEADER << " child honored request, height " << size.y << ".\n"; DBG_GUI_L << LOG_HEADER << " child honored request, height " << size.y << ".";
return; return;
} }
if(vertical_scrollbar_mode_ == ALWAYS_INVISIBLE) { if(vertical_scrollbar_mode_ == ALWAYS_INVISIBLE) {
DBG_GUI_L << LOG_HEADER << " request failed due to scrollbar mode.\n"; DBG_GUI_L << LOG_HEADER << " request failed due to scrollbar mode.";
return; return;
} }
@ -206,10 +206,10 @@ void scrollbar_container::request_reduce_height(const unsigned maximum_height)
// FIXME adjust for the step size of the scrollbar // FIXME adjust for the step size of the scrollbar
set_layout_size(size); set_layout_size(size);
DBG_GUI_L << LOG_HEADER << " resize resulted in " << size.y << ".\n"; DBG_GUI_L << LOG_HEADER << " resize resulted in " << size.y << ".";
if(resized) { if(resized) {
DBG_GUI_L << LOG_HEADER << " resize modified the width, throw notification.\n"; DBG_GUI_L << LOG_HEADER << " resize modified the width, throw notification.";
throw layout_exception_width_modified(); throw layout_exception_width_modified();
} }
@ -217,7 +217,7 @@ void scrollbar_container::request_reduce_height(const unsigned maximum_height)
void scrollbar_container::request_reduce_width(const unsigned maximum_width) void scrollbar_container::request_reduce_width(const unsigned maximum_width)
{ {
DBG_GUI_L << LOG_HEADER << " requested width " << maximum_width << ".\n"; DBG_GUI_L << LOG_HEADER << " requested width " << maximum_width << ".";
if(static_cast<unsigned>(get_grid().get_best_size().x) > maximum_width) { if(static_cast<unsigned>(get_grid().get_best_size().x) > maximum_width) {
get_grid().request_reduce_width(maximum_width); get_grid().request_reduce_width(maximum_width);
@ -236,12 +236,12 @@ void scrollbar_container::request_reduce_width(const unsigned maximum_width)
// Did we manage to achieve the wanted size? // Did we manage to achieve the wanted size?
point size = get_best_size(); point size = get_best_size();
if(static_cast<unsigned>(size.x) <= maximum_width) { if(static_cast<unsigned>(size.x) <= maximum_width) {
DBG_GUI_L << LOG_HEADER << " child honored request, width " << size.x << ".\n"; DBG_GUI_L << LOG_HEADER << " child honored request, width " << size.x << ".";
return; return;
} }
if(horizontal_scrollbar_mode_ == ALWAYS_INVISIBLE) { if(horizontal_scrollbar_mode_ == ALWAYS_INVISIBLE) {
DBG_GUI_L << LOG_HEADER << " request failed due to scrollbar mode.\n"; DBG_GUI_L << LOG_HEADER << " request failed due to scrollbar mode.";
return; return;
} }
@ -279,7 +279,7 @@ void scrollbar_container::request_reduce_width(const unsigned maximum_width)
// FIXME adjust for the step size of the scrollbar // FIXME adjust for the step size of the scrollbar
set_layout_size(size); set_layout_size(size);
DBG_GUI_L << LOG_HEADER << " resize resulted in " << size.x << ".\n"; DBG_GUI_L << LOG_HEADER << " resize resulted in " << size.x << ".";
} }
bool scrollbar_container::can_wrap() const bool scrollbar_container::can_wrap() const
@ -537,10 +537,10 @@ bool scrollbar_container::content_resize_request(const bool force_sizing)
point best_size = content_grid_->recalculate_best_size(); point best_size = content_grid_->recalculate_best_size();
point size = content_->get_size(); point size = content_->get_size();
DBG_GUI_L << LOG_HEADER << " wanted size " << best_size << " available size " << size << ".\n"; DBG_GUI_L << LOG_HEADER << " wanted size " << best_size << " available size " << size << ".";
if(size == point()) { if(size == point()) {
DBG_GUI_L << LOG_HEADER << " initial setup not done, bailing out.\n"; DBG_GUI_L << LOG_HEADER << " initial setup not done, bailing out.";
return false; return false;
} }
@ -548,21 +548,21 @@ bool scrollbar_container::content_resize_request(const bool force_sizing)
const point content_size = content_grid_->get_size(); const point content_size = content_grid_->get_size();
if(content_size.x > size.x || content_size.y > size.y) { if(content_size.x > size.x || content_size.y > size.y) {
DBG_GUI_L << LOG_HEADER << " will fit, only needs a resize.\n"; DBG_GUI_L << LOG_HEADER << " will fit, only needs a resize.";
goto resize; goto resize;
} }
if(force_sizing) { if(force_sizing) {
DBG_GUI_L << LOG_HEADER << " fits, but resize forced.\n"; DBG_GUI_L << LOG_HEADER << " fits, but resize forced.";
goto resize; goto resize;
} }
DBG_GUI_L << LOG_HEADER << " fits, nothing to do.\n"; DBG_GUI_L << LOG_HEADER << " fits, nothing to do.";
return true; return true;
} }
if(best_size.x > size.x) { if(best_size.x > size.x) {
DBG_GUI_L << LOG_HEADER << " content too wide.\n"; DBG_GUI_L << LOG_HEADER << " content too wide.";
if(horizontal_scrollbar_mode_ == ALWAYS_INVISIBLE || if(horizontal_scrollbar_mode_ == ALWAYS_INVISIBLE ||
( (
@ -570,7 +570,7 @@ bool scrollbar_container::content_resize_request(const bool force_sizing)
horizontal_scrollbar_grid_->get_visible() == widget::visibility::invisible horizontal_scrollbar_grid_->get_visible() == widget::visibility::invisible
) )
) { ) {
DBG_GUI_L << LOG_HEADER << " can't use horizontal scrollbar, request placement.\n"; DBG_GUI_L << LOG_HEADER << " can't use horizontal scrollbar, request placement.";
event::message message; event::message message;
fire(event::REQUEST_PLACEMENT, *this, message); fire(event::REQUEST_PLACEMENT, *this, message);
@ -579,7 +579,7 @@ bool scrollbar_container::content_resize_request(const bool force_sizing)
} }
if(best_size.y > size.y) { if(best_size.y > size.y) {
DBG_GUI_L << LOG_HEADER << " content too high.\n"; DBG_GUI_L << LOG_HEADER << " content too high.";
if(vertical_scrollbar_mode_ == ALWAYS_INVISIBLE || if(vertical_scrollbar_mode_ == ALWAYS_INVISIBLE ||
( (
@ -587,7 +587,7 @@ bool scrollbar_container::content_resize_request(const bool force_sizing)
vertical_scrollbar_grid_->get_visible() == widget::visibility::invisible vertical_scrollbar_grid_->get_visible() == widget::visibility::invisible
) )
) { ) {
DBG_GUI_L << LOG_HEADER << " can't use vertical scrollbar, request placement.\n"; DBG_GUI_L << LOG_HEADER << " can't use vertical scrollbar, request placement.";
event::message message; event::message message;
fire(event::REQUEST_PLACEMENT, *this, message); fire(event::REQUEST_PLACEMENT, *this, message);
@ -596,7 +596,7 @@ bool scrollbar_container::content_resize_request(const bool force_sizing)
} }
resize: resize:
DBG_GUI_L << LOG_HEADER << " handle resizing.\n"; DBG_GUI_L << LOG_HEADER << " handle resizing.";
place(get_origin(), get_size()); place(get_origin(), get_size());
return true; return true;
@ -611,7 +611,7 @@ bool scrollbar_container::content_resize_request(const int width_modification,
<< height_modification << ".\n"; << height_modification << ".\n";
if(get_size() == point()) { if(get_size() == point()) {
DBG_GUI_L << LOG_HEADER << " initial setup not done, bailing out.\n"; DBG_GUI_L << LOG_HEADER << " initial setup not done, bailing out.";
return false; return false;
} }
@ -619,7 +619,7 @@ bool scrollbar_container::content_resize_request(const int width_modification,
assert(window); assert(window);
if(window->get_need_layout()) { if(window->get_need_layout()) {
DBG_GUI_L << LOG_HEADER << " window already needs a layout phase, bailing out.\n"; DBG_GUI_L << LOG_HEADER << " window already needs a layout phase, bailing out.";
return false; return false;
} }
@ -639,7 +639,7 @@ bool scrollbar_container::content_resize_request(const int width_modification,
set_scrollbar_button_status(); set_scrollbar_button_status();
} }
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n"; DBG_GUI_L << LOG_HEADER << " result " << result << ".";
return result; return result;
} }
@ -657,7 +657,7 @@ bool scrollbar_container::content_resize_width(const int width_modification, con
} }
if(static_cast<unsigned>(new_width) <= content_->get_width()) { if(static_cast<unsigned>(new_width) <= content_->get_width()) {
DBG_GUI_L << " width fits in container, test height.\n"; DBG_GUI_L << " width fits in container, test height.";
adjust_scrollbar_mode(horizontal_scrollbar_grid_, horizontal_scrollbar_, horizontal_scrollbar_mode_, adjust_scrollbar_mode(horizontal_scrollbar_grid_, horizontal_scrollbar_, horizontal_scrollbar_mode_,
content_grid_->get_width(), content_grid_->get_width() + width_modification, width_modification_pos, content_grid_->get_width(), content_grid_->get_width() + width_modification, width_modification_pos,
@ -672,7 +672,7 @@ bool scrollbar_container::content_resize_width(const int width_modification, con
horizontal_scrollbar_grid_->get_visible() == widget::visibility::invisible horizontal_scrollbar_grid_->get_visible() == widget::visibility::invisible
) )
) { ) {
DBG_GUI_L << " can't use horizontal scrollbar, ask window.\n"; DBG_GUI_L << " can't use horizontal scrollbar, ask window.";
window* window = get_window(); window* window = get_window();
assert(window); assert(window);
@ -681,7 +681,7 @@ bool scrollbar_container::content_resize_width(const int width_modification, con
return false; return false;
} }
DBG_GUI_L << " use the horizontal scrollbar, test height.\n"; DBG_GUI_L << " use the horizontal scrollbar, test height.";
adjust_scrollbar_mode(horizontal_scrollbar_grid_, horizontal_scrollbar_, horizontal_scrollbar_mode_, adjust_scrollbar_mode(horizontal_scrollbar_grid_, horizontal_scrollbar_, horizontal_scrollbar_mode_,
content_grid_->get_width(), content_grid_->get_width() + width_modification, width_modification_pos, content_grid_->get_width(), content_grid_->get_width() + width_modification, width_modification_pos,
content_->get_width()); content_->get_width());
@ -704,7 +704,7 @@ bool scrollbar_container::content_resize_height(const int height_modification, c
} }
if(static_cast<unsigned>(new_height) <= content_->get_height()) { if(static_cast<unsigned>(new_height) <= content_->get_height()) {
DBG_GUI_L << " height in container, resize allowed.\n"; DBG_GUI_L << " height in container, resize allowed.";
adjust_scrollbar_mode(vertical_scrollbar_grid_, vertical_scrollbar_, vertical_scrollbar_mode_, adjust_scrollbar_mode(vertical_scrollbar_grid_, vertical_scrollbar_, vertical_scrollbar_mode_,
content_grid_->get_height(), new_height, height_modification_pos, content_->get_height()); content_grid_->get_height(), new_height, height_modification_pos, content_->get_height());
@ -718,7 +718,7 @@ bool scrollbar_container::content_resize_height(const int height_modification, c
vertical_scrollbar_grid_->get_visible() == widget::visibility::invisible vertical_scrollbar_grid_->get_visible() == widget::visibility::invisible
) )
) { ) {
DBG_GUI_L << " can't use vertical scrollbar, ask window.\n"; DBG_GUI_L << " can't use vertical scrollbar, ask window.";
window* window = get_window(); window* window = get_window();
assert(window); assert(window);
@ -727,7 +727,7 @@ bool scrollbar_container::content_resize_height(const int height_modification, c
return false; return false;
} }
DBG_GUI_L << " use the vertical scrollbar, resize allowed.\n"; DBG_GUI_L << " use the vertical scrollbar, resize allowed.";
adjust_scrollbar_mode(vertical_scrollbar_grid_, vertical_scrollbar_, vertical_scrollbar_mode_, adjust_scrollbar_mode(vertical_scrollbar_grid_, vertical_scrollbar_, vertical_scrollbar_mode_,
content_grid_->get_height(), new_height, height_modification_pos, content_->get_height()); content_grid_->get_height(), new_height, height_modification_pos, content_->get_height());
@ -1093,7 +1093,7 @@ const std::string& scrollbar_container::get_control_type() const
void scrollbar_container::signal_handler_sdl_key_down( void scrollbar_container::signal_handler_sdl_key_down(
const event::ui_event event, bool& handled, const SDL_Keycode key, SDL_Keymod modifier) const event::ui_event event, bool& handled, const SDL_Keycode key, SDL_Keymod modifier)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
switch(key) { switch(key) {
case SDLK_HOME: case SDLK_HOME:
@ -1135,7 +1135,7 @@ void scrollbar_container::signal_handler_sdl_key_down(
void scrollbar_container::signal_handler_sdl_wheel_up(const event::ui_event event, bool& handled) void scrollbar_container::signal_handler_sdl_wheel_up(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
assert(vertical_scrollbar_grid_ && vertical_scrollbar_); assert(vertical_scrollbar_grid_ && vertical_scrollbar_);
@ -1148,7 +1148,7 @@ void scrollbar_container::signal_handler_sdl_wheel_up(const event::ui_event even
void scrollbar_container::signal_handler_sdl_wheel_down(const event::ui_event event, bool& handled) void scrollbar_container::signal_handler_sdl_wheel_down(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
assert(vertical_scrollbar_grid_ && vertical_scrollbar_); assert(vertical_scrollbar_grid_ && vertical_scrollbar_);
@ -1161,7 +1161,7 @@ void scrollbar_container::signal_handler_sdl_wheel_down(const event::ui_event ev
void scrollbar_container::signal_handler_sdl_wheel_left(const event::ui_event event, bool& handled) void scrollbar_container::signal_handler_sdl_wheel_left(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
assert(horizontal_scrollbar_grid_ && horizontal_scrollbar_); assert(horizontal_scrollbar_grid_ && horizontal_scrollbar_);
@ -1174,7 +1174,7 @@ void scrollbar_container::signal_handler_sdl_wheel_left(const event::ui_event ev
void scrollbar_container::signal_handler_sdl_wheel_right(const event::ui_event event, bool& handled) void scrollbar_container::signal_handler_sdl_wheel_right(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
assert(horizontal_scrollbar_grid_ && horizontal_scrollbar_); assert(horizontal_scrollbar_grid_ && horizontal_scrollbar_);
@ -1192,7 +1192,7 @@ scrollbar_container::signal_handler_sdl_touch_motion(const event::ui_event event
const point& distance) const point& distance)
{ {
(void) position; (void) position;
DBG_GUI_E << LOG_HEADER << event << ".\n"; DBG_GUI_E << LOG_HEADER << event << ".";
bool is_scrollbar_moved = false; bool is_scrollbar_moved = false;

View file

@ -129,7 +129,7 @@ std::unique_ptr<widget> builder_size_lock::build() const
{ {
auto widget = std::make_unique<size_lock>(*this); auto widget = std::make_unique<size_lock>(*this);
DBG_GUI_G << "Window builder: placed fixed size widget '" << id << "' with definition '" << definition << "'.\n"; DBG_GUI_G << "Window builder: placed fixed size widget '" << id << "' with definition '" << definition << "'.";
const auto conf = widget->cast_config_to<size_lock_definition>(); const auto conf = widget->cast_config_to<size_lock_definition>();
assert(conf != nullptr); assert(conf != nullptr);

View file

@ -75,7 +75,7 @@ point slider::calculate_best_size() const
result.x = conf->left_offset + best_slider_length_ + conf->right_offset; result.x = conf->left_offset + best_slider_length_ + conf->right_offset;
} }
DBG_GUI_L << LOG_HEADER << " best_slider_length " << best_slider_length_ << " result " << result << ".\n"; DBG_GUI_L << LOG_HEADER << " best_slider_length " << best_slider_length_ << " result " << result << ".";
return result; return result;
} }
@ -203,7 +203,7 @@ void slider::handle_key_increase(bool& handled)
void slider::signal_handler_sdl_key_down(const event::ui_event event, bool& handled, const SDL_Keycode key) void slider::signal_handler_sdl_key_down(const event::ui_event event, bool& handled, const SDL_Keycode key)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(key == SDLK_DOWN || key == SDLK_LEFT) { if(key == SDLK_DOWN || key == SDLK_LEFT) {
handle_key_decrease(handled); handle_key_decrease(handled);
@ -217,7 +217,7 @@ void slider::signal_handler_sdl_key_down(const event::ui_event event, bool& hand
#if 0 #if 0
void slider::signal_handler_left_button_down(const event::ui_event event, bool& handled) void slider::signal_handler_left_button_down(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
update_current_item_mouse_position(); update_current_item_mouse_position();
@ -227,7 +227,7 @@ void slider::signal_handler_left_button_down(const event::ui_event event, bool&
void slider::signal_handler_left_button_up(const event::ui_event event, bool& handled) void slider::signal_handler_left_button_up(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
get_window()->keyboard_capture(this); get_window()->keyboard_capture(this);
@ -363,7 +363,7 @@ std::unique_ptr<widget> builder_slider::build() const
widget->set_maximum_value_label(maximum_value_label_); widget->set_maximum_value_label(maximum_value_label_);
} }
DBG_GUI_G << "Window builder: placed slider '" << id << "' with definition '" << definition << "'.\n"; DBG_GUI_G << "Window builder: placed slider '" << id << "' with definition '" << definition << "'.";
return widget; return widget;
} }

View file

@ -207,7 +207,7 @@ void slider_base::update_slider_position(slider_base::slider_position_t& pos)
void slider_base::signal_handler_mouse_enter(const event::ui_event event, bool& handled, bool& halt) void slider_base::signal_handler_mouse_enter(const event::ui_event event, bool& handled, bool& halt)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
// Send the motion under our event id to make debugging easier. // Send the motion under our event id to make debugging easier.
signal_handler_mouse_motion(event, handled, halt, get_mouse_position()); signal_handler_mouse_motion(event, handled, halt, get_mouse_position());
@ -216,7 +216,7 @@ void slider_base::signal_handler_mouse_enter(const event::ui_event event, bool&
void slider_base::signal_handler_mouse_motion( void slider_base::signal_handler_mouse_motion(
const event::ui_event event, bool& handled, bool& halt, const point& coordinate) const event::ui_event event, bool& handled, bool& halt, const point& coordinate)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << " at " << coordinate << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << " at " << coordinate << ".";
point mouse = coordinate; point mouse = coordinate;
mouse.x -= get_x(); mouse.x -= get_x();
@ -256,7 +256,7 @@ void slider_base::signal_handler_mouse_motion(
void slider_base::signal_handler_mouse_leave(const event::ui_event event, bool& handled) void slider_base::signal_handler_mouse_leave(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(state_ == FOCUSED) { if(state_ == FOCUSED) {
set_state(ENABLED); set_state(ENABLED);
@ -267,7 +267,7 @@ void slider_base::signal_handler_mouse_leave(const event::ui_event event, bool&
void slider_base::signal_handler_left_button_down(const event::ui_event event, bool& handled) void slider_base::signal_handler_left_button_down(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
point mouse = get_mouse_position(); point mouse = get_mouse_position();
mouse.x -= get_x(); mouse.x -= get_x();
@ -298,7 +298,7 @@ void slider_base::signal_handler_left_button_down(const event::ui_event event, b
void slider_base::signal_handler_left_button_up(const event::ui_event event, bool& handled) void slider_base::signal_handler_left_button_up(const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
point mouse = get_mouse_position(); point mouse = get_mouse_position();
mouse.x -= get_x(); mouse.x -= get_x();

View file

@ -144,7 +144,7 @@ point styled_widget::get_config_minimum_size() const
point result(config_->min_width, config_->min_height); point result(config_->min_width, config_->min_height);
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n"; DBG_GUI_L << LOG_HEADER << " result " << result << ".";
return result; return result;
} }
@ -154,7 +154,7 @@ point styled_widget::get_config_default_size() const
point result(config_->default_width, config_->default_height); point result(config_->default_width, config_->default_height);
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n"; DBG_GUI_L << LOG_HEADER << " result " << result << ".";
return result; return result;
} }
@ -164,7 +164,7 @@ point styled_widget::get_config_maximum_size() const
point result(config_->max_width, config_->max_height); point result(config_->max_width, config_->max_height);
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n"; DBG_GUI_L << LOG_HEADER << " result " << result << ".";
return result; return result;
} }
@ -246,7 +246,7 @@ point styled_widget::calculate_best_size() const
{ {
assert(config_); assert(config_);
if(label_.empty()) { if(label_.empty()) {
DBG_GUI_L << LOG_HEADER << " empty label return default.\n"; DBG_GUI_L << LOG_HEADER << " empty label return default.";
return get_config_default_size(); return get_config_default_size();
} }
@ -524,7 +524,7 @@ void styled_widget::signal_handler_show_tooltip(const event::ui_event event,
bool& handled, bool& handled,
const point& location) const point& location)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(!tooltip_.empty()) { if(!tooltip_.empty()) {
std::string tip = tooltip_; std::string tip = tooltip_;
@ -547,7 +547,7 @@ void styled_widget::signal_handler_show_helptip(const event::ui_event event,
bool& handled, bool& handled,
const point& location) const point& location)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(!help_message_.empty()) { if(!help_message_.empty()) {
event::message_show_helptip message(help_message_, location, get_rectangle()); event::message_show_helptip message(help_message_, location, get_rectangle());
@ -558,7 +558,7 @@ void styled_widget::signal_handler_show_helptip(const event::ui_event event,
void styled_widget::signal_handler_notify_remove_tooltip(const event::ui_event event, void styled_widget::signal_handler_notify_remove_tooltip(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
/* /*
* This makes the class know the tip code rather intimately. An * This makes the class know the tip code rather intimately. An

View file

@ -347,7 +347,7 @@ void text_box::signal_handler_mouse_motion(const event::ui_event event,
bool& handled, bool& handled,
const point& coordinate) const point& coordinate)
{ {
DBG_GUI_E << get_control_type() << "[" << id() << "]: " << event << ".\n"; DBG_GUI_E << get_control_type() << "[" << id() << "]: " << event << ".";
if(dragging_) { if(dragging_) {
handle_mouse_selection(coordinate, false); handle_mouse_selection(coordinate, false);
@ -359,7 +359,7 @@ void text_box::signal_handler_mouse_motion(const event::ui_event event,
void text_box::signal_handler_left_button_down(const event::ui_event event, void text_box::signal_handler_left_button_down(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
/* /*
* Copied from the base class see how we can do inheritance with the new * Copied from the base class see how we can do inheritance with the new
@ -376,7 +376,7 @@ void text_box::signal_handler_left_button_down(const event::ui_event event,
void text_box::signal_handler_left_button_up(const event::ui_event event, void text_box::signal_handler_left_button_up(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
dragging_ = false; dragging_ = false;
handled = true; handled = true;
@ -386,7 +386,7 @@ void
text_box::signal_handler_left_button_double_click(const event::ui_event event, text_box::signal_handler_left_button_double_click(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
select_all(); select_all();
handled = true; handled = true;

View file

@ -508,7 +508,7 @@ void text_box_base::handle_editing(bool& handled, const std::string& unicode, in
void text_box_base::signal_handler_middle_button_click(const event::ui_event event, void text_box_base::signal_handler_middle_button_click(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
paste_selection(true); paste_selection(true);
@ -521,7 +521,7 @@ void text_box_base::signal_handler_sdl_key_down(const event::ui_event event,
SDL_Keymod modifier) SDL_Keymod modifier)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
/* /*
* For copy, cut and paste we use a different key on the MAC. Even for 'select * For copy, cut and paste we use a different key on the MAC. Even for 'select
@ -656,14 +656,14 @@ void text_box_base::signal_handler_sdl_key_down(const event::ui_event event,
void text_box_base::signal_handler_receive_keyboard_focus(const event::ui_event event) void text_box_base::signal_handler_receive_keyboard_focus(const event::ui_event event)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
} }
void text_box_base::signal_handler_lose_keyboard_focus(const event::ui_event event) void text_box_base::signal_handler_lose_keyboard_focus(const event::ui_event event)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(ENABLED); set_state(ENABLED);
} }
@ -671,7 +671,7 @@ void text_box_base::signal_handler_lose_keyboard_focus(const event::ui_event eve
void text_box_base::signal_handler_mouse_enter(const event::ui_event event, void text_box_base::signal_handler_mouse_enter(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(state_ != FOCUSED) { if(state_ != FOCUSED) {
set_state(HOVERED); set_state(HOVERED);
@ -685,7 +685,7 @@ void text_box_base::signal_handler_mouse_enter(const event::ui_event event,
void text_box_base::signal_handler_mouse_leave(const event::ui_event event, void text_box_base::signal_handler_mouse_leave(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(state_ != FOCUSED) { if(state_ != FOCUSED) {
set_state(ENABLED); set_state(ENABLED);

View file

@ -150,7 +150,7 @@ void toggle_button::set_state(const state_t state)
void toggle_button::signal_handler_mouse_enter(const event::ui_event event, void toggle_button::signal_handler_mouse_enter(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
} }
@ -158,7 +158,7 @@ void toggle_button::signal_handler_mouse_enter(const event::ui_event event,
void toggle_button::signal_handler_mouse_leave(const event::ui_event event, void toggle_button::signal_handler_mouse_leave(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(ENABLED); set_state(ENABLED);
handled = true; handled = true;
} }
@ -166,7 +166,7 @@ void toggle_button::signal_handler_mouse_leave(const event::ui_event event,
void toggle_button::signal_handler_left_button_click(const event::ui_event event, void toggle_button::signal_handler_left_button_click(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
sound::play_UI_sound(settings::sound_toggle_button_click); sound::play_UI_sound(settings::sound_toggle_button_click);
@ -178,7 +178,7 @@ void toggle_button::signal_handler_left_button_click(const event::ui_event event
void toggle_button::signal_handler_left_button_double_click( void toggle_button::signal_handler_left_button_double_click(
const event::ui_event event, bool& handled) const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(retval_ == retval::NONE) { if(retval_ == retval::NONE) {
return; return;

View file

@ -210,7 +210,7 @@ void toggle_panel::impl_draw_foreground()
void toggle_panel::signal_handler_mouse_enter(const event::ui_event event, void toggle_panel::signal_handler_mouse_enter(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(FOCUSED); set_state(FOCUSED);
handled = true; handled = true;
@ -219,7 +219,7 @@ void toggle_panel::signal_handler_mouse_enter(const event::ui_event event,
void toggle_panel::signal_handler_mouse_leave(const event::ui_event event, void toggle_panel::signal_handler_mouse_leave(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
set_state(ENABLED); set_state(ENABLED);
handled = true; handled = true;
@ -228,7 +228,7 @@ void toggle_panel::signal_handler_mouse_leave(const event::ui_event event,
void void
toggle_panel::signal_handler_pre_left_button_click(const event::ui_event event) toggle_panel::signal_handler_pre_left_button_click(const event::ui_event event)
{ {
DBG_GUI_E << get_control_type() << "[" << id() << "]: " << event << ".\n"; DBG_GUI_E << get_control_type() << "[" << id() << "]: " << event << ".";
set_value(1, true); set_value(1, true);
@ -255,7 +255,7 @@ toggle_panel::signal_handler_pre_left_button_click(const event::ui_event event)
void toggle_panel::signal_handler_left_button_click(const event::ui_event event, void toggle_panel::signal_handler_left_button_click(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
sound::play_UI_sound(settings::sound_toggle_panel_click); sound::play_UI_sound(settings::sound_toggle_panel_click);
@ -267,7 +267,7 @@ void toggle_panel::signal_handler_left_button_click(const event::ui_event event,
void toggle_panel::signal_handler_left_button_double_click( void toggle_panel::signal_handler_left_button_double_click(
const event::ui_event event, bool& handled) const event::ui_event event, bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(retval_) { if(retval_) {
window* window = get_window(); window* window = get_window();

View file

@ -136,9 +136,9 @@ void tree_view::resize_content(const int width_modification,
queue_redraw(); queue_redraw();
} }
horizontal_scrollbar_moved(); horizontal_scrollbar_moved();
DBG_GUI_L << LOG_HEADER << " succeeded.\n"; DBG_GUI_L << LOG_HEADER << " succeeded.";
} else { } else {
DBG_GUI_L << LOG_HEADER << " failed.\n"; DBG_GUI_L << LOG_HEADER << " failed.";
} }
} }
@ -171,7 +171,7 @@ void tree_view::finalize_setup()
void tree_view::signal_handler_left_button_down(const event::ui_event event) void tree_view::signal_handler_left_button_down(const event::ui_event event)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
get_window()->keyboard_capture(this); get_window()->keyboard_capture(this);
} }
@ -305,7 +305,7 @@ std::unique_ptr<widget> builder_tree_view::build() const
widget->set_indentation_step_size(indentation_step_size); widget->set_indentation_step_size(indentation_step_size);
DBG_GUI_G << "Window builder: placed tree_view '" << id << "' with definition '" << definition << "'.\n"; DBG_GUI_G << "Window builder: placed tree_view '" << id << "' with definition '" << definition << "'.";
const auto conf = widget->cast_config_to<tree_view_definition>(); const auto conf = widget->cast_config_to<tree_view_definition>();
assert(conf); assert(conf);

View file

@ -527,7 +527,7 @@ point tree_view_node::calculate_best_size(const int indentation_level, const uns
best_size.x += indentation_level * indentation_step_size; best_size.x += indentation_level * indentation_step_size;
} }
DBG_GUI_L << LOG_HEADER << " own grid best size " << best_size << ".\n"; DBG_GUI_L << LOG_HEADER << " own grid best size " << best_size << ".";
for(const auto& node : children_) { for(const auto& node : children_) {
if(node->grid_.get_visible() == widget::visibility::invisible) { if(node->grid_.get_visible() == widget::visibility::invisible) {
@ -543,7 +543,7 @@ point tree_view_node::calculate_best_size(const int indentation_level, const uns
best_size.x = std::max(best_size.x, node_size.x); best_size.x = std::max(best_size.x, node_size.x);
} }
DBG_GUI_L << LOG_HEADER << " result " << best_size << ".\n"; DBG_GUI_L << LOG_HEADER << " result " << best_size << ".";
return best_size; return best_size;
} }
@ -567,7 +567,7 @@ void tree_view_node::place(const point& origin, const point& size)
unsigned tree_view_node::place(const unsigned indentation_step_size, point origin, unsigned width) unsigned tree_view_node::place(const unsigned indentation_step_size, point origin, unsigned width)
{ {
log_scope2(log_gui_layout, LOG_SCOPE_HEADER); log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
DBG_GUI_L << LOG_HEADER << " origin " << origin << ".\n"; DBG_GUI_L << LOG_HEADER << " origin " << origin << ".";
const unsigned offset = origin.y; const unsigned offset = origin.y;
point best_size = grid_.get_best_size(); point best_size = grid_.get_best_size();
@ -584,11 +584,11 @@ unsigned tree_view_node::place(const unsigned indentation_step_size, point origi
origin.y += best_size.y; origin.y += best_size.y;
if(is_folded()) { if(is_folded()) {
DBG_GUI_L << LOG_HEADER << " folded node done.\n"; DBG_GUI_L << LOG_HEADER << " folded node done.";
return origin.y - offset; return origin.y - offset;
} }
DBG_GUI_L << LOG_HEADER << " set children.\n"; DBG_GUI_L << LOG_HEADER << " set children.";
for(auto& node : children_) { for(auto& node : children_) {
origin.y += node->place(indentation_step_size, origin, width); origin.y += node->place(indentation_step_size, origin, width);
} }
@ -596,18 +596,18 @@ unsigned tree_view_node::place(const unsigned indentation_step_size, point origi
// Inherited. // Inherited.
widget::set_size(point(width, origin.y - offset)); widget::set_size(point(width, origin.y - offset));
DBG_GUI_L << LOG_HEADER << " result " << (origin.y - offset) << ".\n"; DBG_GUI_L << LOG_HEADER << " result " << (origin.y - offset) << ".";
return origin.y - offset; return origin.y - offset;
} }
void tree_view_node::set_visible_rectangle(const SDL_Rect& rectangle) void tree_view_node::set_visible_rectangle(const SDL_Rect& rectangle)
{ {
log_scope2(log_gui_layout, LOG_SCOPE_HEADER); log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
DBG_GUI_L << LOG_HEADER << " rectangle " << rectangle << ".\n"; DBG_GUI_L << LOG_HEADER << " rectangle " << rectangle << ".";
grid_.set_visible_rectangle(rectangle); grid_.set_visible_rectangle(rectangle);
if(is_folded()) { if(is_folded()) {
DBG_GUI_L << LOG_HEADER << " folded node done.\n"; DBG_GUI_L << LOG_HEADER << " folded node done.";
return; return;
} }
@ -631,7 +631,7 @@ void tree_view_node::impl_draw_children()
void tree_view_node::signal_handler_left_button_click(const event::ui_event event) void tree_view_node::signal_handler_left_button_click(const event::ui_event event)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
/** /**
* @todo Rewrite this sizing code for the folding/unfolding. * @todo Rewrite this sizing code for the folding/unfolding.
@ -652,7 +652,7 @@ void tree_view_node::signal_handler_left_button_click(const event::ui_event even
void tree_view_node::signal_handler_label_left_button_click(const event::ui_event event, bool& handled, bool& halt) void tree_view_node::signal_handler_label_left_button_click(const event::ui_event event, bool& handled, bool& halt)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
assert(label_); assert(label_);

View file

@ -136,7 +136,7 @@ const unsigned LAYOUT = 0;
*/ */
static void push_draw_event() static void push_draw_event()
{ {
// DBG_GUI_E << "Pushing draw event in queue.\n"; // DBG_GUI_E << "Pushing draw event in queue.";
SDL_Event event; SDL_Event event;
sdl::UserEvent data(DRAW_EVENT); sdl::UserEvent data(DRAW_EVENT);
@ -182,7 +182,7 @@ static void delay_event(const SDL_Event& event, const uint32_t delay)
*/ */
static void helptip() static void helptip()
{ {
DBG_GUI_E << "Pushing SHOW_HELPTIP_EVENT event in queue.\n"; DBG_GUI_E << "Pushing SHOW_HELPTIP_EVENT event in queue.";
SDL_Event event; SDL_Event event;
sdl::UserEvent data(SHOW_HELPTIP_EVENT); sdl::UserEvent data(SHOW_HELPTIP_EVENT);
@ -683,7 +683,7 @@ void window::add_linked_widget(const std::string& id, widget* wgt)
{ {
assert(wgt); assert(wgt);
if(!has_linked_size_group(id)) { if(!has_linked_size_group(id)) {
ERR_GUI << "Unknown linked group '" << id << "'; skipping\n"; ERR_GUI << "Unknown linked group '" << id << "'; skipping";
return; return;
} }
@ -1027,7 +1027,7 @@ void window_implementation::layout(window& window,
if(size.x <= static_cast<int>(maximum_width) if(size.x <= static_cast<int>(maximum_width)
&& size.y <= static_cast<int>(maximum_height)) { && size.y <= static_cast<int>(maximum_height)) {
DBG_GUI_L << LOG_IMPL_HEADER << " Result: Fits, nothing to do.\n"; DBG_GUI_L << LOG_IMPL_HEADER << " Result: Fits, nothing to do.";
return; return;
} }
@ -1063,7 +1063,7 @@ void window_implementation::layout(window& window,
&& size.y <= static_cast<int>(maximum_height)); && size.y <= static_cast<int>(maximum_height));
DBG_GUI_L << LOG_IMPL_HEADER << " Result: Resizing succeeded.\n"; DBG_GUI_L << LOG_IMPL_HEADER << " Result: Resizing succeeded.";
return; return;
} }
catch(const layout_exception_width_modified&) catch(const layout_exception_width_modified&)
@ -1122,7 +1122,7 @@ void window::signal_handler_sdl_video_resize(const event::ui_event event,
bool& handled, bool& handled,
const point& new_size) const point& new_size)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
settings::gamemap_width += new_size.x - settings::screen_width; settings::gamemap_width += new_size.x - settings::screen_width;
settings::gamemap_height += new_size.y - settings::screen_height; settings::gamemap_height += new_size.y - settings::screen_height;
@ -1158,7 +1158,7 @@ void window::signal_handler_sdl_key_down(const event::ui_event event,
const SDL_Keymod mod, const SDL_Keymod mod,
bool handle_tab) bool handle_tab)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
if(text_box_base* tb = dynamic_cast<text_box_base*>(event_distributor_->keyboard_focus())) { if(text_box_base* tb = dynamic_cast<text_box_base*>(event_distributor_->keyboard_focus())) {
if(tb->is_composing()) { if(tb->is_composing()) {
@ -1213,7 +1213,7 @@ void window::signal_handler_message_show_tooltip(const event::ui_event event,
bool& handled, bool& handled,
const event::message& message) const event::message& message)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
const event::message_show_tooltip& request const event::message_show_tooltip& request
= dynamic_cast<const event::message_show_tooltip&>(message); = dynamic_cast<const event::message_show_tooltip&>(message);
@ -1227,7 +1227,7 @@ void window::signal_handler_message_show_helptip(const event::ui_event event,
bool& handled, bool& handled,
const event::message& message) const event::message& message)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
const event::message_show_helptip& request const event::message_show_helptip& request
= dynamic_cast<const event::message_show_helptip&>(message); = dynamic_cast<const event::message_show_helptip&>(message);
@ -1240,7 +1240,7 @@ void window::signal_handler_message_show_helptip(const event::ui_event event,
void window::signal_handler_request_placement(const event::ui_event event, void window::signal_handler_request_placement(const event::ui_event event,
bool& handled) bool& handled)
{ {
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; DBG_GUI_E << LOG_HEADER << ' ' << event << ".";
invalidate_layout(); invalidate_layout();

View file

@ -346,7 +346,7 @@ void generate_sections(const config *help_cfg, const std::string &generator, sec
} else if (generator == "terrains") { } else if (generator == "terrains") {
generate_terrain_sections(sec, level); generate_terrain_sections(sec, level);
} else if (generator == "eras") { } else if (generator == "eras") {
DBG_HP << "Generating eras...\n"; DBG_HP << "Generating eras...";
generate_era_sections(help_cfg, sec, level); generate_era_sections(help_cfg, sec, level);
} else { } else {
std::vector<std::string> parts = utils::split(generator, ':', utils::STRIP_SPACES); std::vector<std::string> parts = utils::split(generator, ':', utils::STRIP_SPACES);
@ -890,7 +890,7 @@ void generate_terrain_sections(section& sec, int /*level*/)
std::shared_ptr<terrain_type_data> tdata = load_terrain_types_data(); std::shared_ptr<terrain_type_data> tdata = load_terrain_types_data();
if (!tdata) { if (!tdata) {
WRN_HP << "When building terrain help sections, couldn't acquire terrain types data, aborting.\n"; WRN_HP << "When building terrain help sections, couldn't acquire terrain types data, aborting.";
return; return;
} }

View file

@ -149,7 +149,7 @@ std::string terrain_topic_generator::operator()() const {
std::shared_ptr<terrain_type_data> tdata = load_terrain_types_data(); std::shared_ptr<terrain_type_data> tdata = load_terrain_types_data();
if (!tdata) { if (!tdata) {
WRN_HP << "When building terrain help topics, we couldn't acquire any terrain types data\n"; WRN_HP << "When building terrain help topics, we couldn't acquire any terrain types data";
return ss.str(); return ss.str();
} }
@ -910,7 +910,7 @@ std::string unit_topic_generator::operator()() const {
ss << generate_table(table); ss << generate_table(table);
} else { } else {
WRN_HP << "When building unit help topics, the display object was null and we couldn't get the terrain info we need.\n"; WRN_HP << "When building unit help topics, the display object was null and we couldn't get the terrain info we need.";
} }
return ss.str(); return ss.str();
} }

View file

@ -590,7 +590,7 @@ void command_executor::queue_command(const SDL_Event& event, int index)
{ {
LOG_HK << "event 0x" << std::hex << event.type << std::dec; LOG_HK << "event 0x" << std::hex << event.type << std::dec;
if(event.type == SDL_TEXTINPUT) { if(event.type == SDL_TEXTINPUT) {
LOG_HK << "SDL_TEXTINPUT \"" << event.text.text << "\"\n"; LOG_HK << "SDL_TEXTINPUT \"" << event.text.text << "\"";
} }
const hotkey_ptr hk = get_hotkey(event); const hotkey_ptr hk = get_hotkey(event);
@ -664,7 +664,7 @@ void command_executor::execute_command_wrap(const command_executor::queued_comma
} }
break; break;
default: default:
DBG_G << "command_executor: unknown command number " << command.command->command << ", ignoring.\n"; DBG_G << "command_executor: unknown command number " << command.command->command << ", ignoring.";
break; break;
} }
} }

View file

@ -374,7 +374,7 @@ wml_hotkey_record::wml_hotkey_record(const std::string& id, const t_string& desc
: cleanup_() : cleanup_()
{ {
if(id == "null") { if(id == "null") {
LOG_G << "Couldn't add wml hotkey with null id and description = '" << description << "'.\n"; LOG_G << "Couldn't add wml hotkey with null id and description = '" << description << "'.";
return; return;
} }
@ -382,9 +382,9 @@ wml_hotkey_record::wml_hotkey_record(const std::string& id, const t_string& desc
id, hotkey::HOTKEY_WML, id, description, false, false, scope_game, HKCAT_CUSTOM, t_string("")); id, hotkey::HOTKEY_WML, id, description, false, false, scope_game, HKCAT_CUSTOM, t_string(""));
if(inserted) { if(inserted) {
DBG_G << "Added wml hotkey with id = '" << id << "' and description = '" << description << "'.\n"; DBG_G << "Added wml hotkey with id = '" << id << "' and description = '" << description << "'.";
} else { } else {
LOG_G << "Hotkey with id '" << id << "' already exists.\n"; LOG_G << "Hotkey with id '" << id << "' already exists.";
return; return;
} }

View file

@ -641,7 +641,7 @@ REGISTER_MOD_PARSER(TC, args)
const int side_n = lexical_cast_default<int>(params[0], -1); const int side_n = lexical_cast_default<int>(params[0], -1);
if(side_n < 1) { if(side_n < 1) {
ERR_DP << "Invalid side (" << side_n << ") passed to the ~TC() function\n"; ERR_DP << "Invalid side (" << side_n << ") passed to the ~TC() function";
return nullptr; return nullptr;
} }

View file

@ -255,7 +255,7 @@ static void wesnoth_setlocale(int category, const std::string& slocale,
locale = lang + encoding[j] + extra; locale = lang + encoding[j] + extra;
res = std::setlocale(category, locale.c_str()); res = std::setlocale(category, locale.c_str());
if (res) { if (res) {
LOG_G << "Set locale to '" << locale << "' result: '" << res << "'.\n"; LOG_G << "Set locale to '" << locale << "' result: '" << res << "'.";
goto done; goto done;
} }
} }
@ -303,23 +303,23 @@ void set_language(const language_def& locale)
bool load_strings(bool complain) bool load_strings(bool complain)
{ {
DBG_G << "Loading strings\n"; DBG_G << "Loading strings";
config cfg; config cfg;
LOG_G << "There are " << languages_.size() << " [language] blocks\n"; LOG_G << "There are " << languages_.size() << " [language] blocks";
if (complain && languages_.empty()) { if (complain && languages_.empty()) {
PLAIN_LOG << "No [language] block found"; PLAIN_LOG << "No [language] block found";
return false; return false;
} }
for (const config &lang : languages_) { for (const config &lang : languages_) {
DBG_G << "[language]\n"; DBG_G << "[language]";
for (const config::attribute &j : lang.attribute_range()) { for (const config::attribute &j : lang.attribute_range()) {
DBG_G << j.first << "=\"" << j.second << "\"\n"; DBG_G << j.first << "=\"" << j.second << "\"";
strings_[j.first] = j.second; strings_[j.first] = j.second;
} }
DBG_G << "[/language]\n"; DBG_G << "[/language]";
} }
DBG_G << "done\n"; DBG_G << "done";
return true; return true;
} }
@ -340,7 +340,7 @@ const language_def& get_locale()
if (prefs_locale == i->localename) if (prefs_locale == i->localename)
return *i; return *i;
} }
LOG_G << "'" << prefs_locale << "' locale not found in known array; defaulting to system locale\n"; LOG_G << "'" << prefs_locale << "' locale not found in known array; defaulting to system locale";
return known_languages[0]; return known_languages[0];
} }
@ -360,7 +360,7 @@ const language_def& get_locale()
} }
#endif #endif
LOG_G << "locale could not be determined; defaulting to system locale\n"; LOG_G << "locale could not be determined; defaulting to system locale";
return known_languages[0]; return known_languages[0];
} }

View file

@ -28,7 +28,7 @@
* Then stream logging info to ERR_DP, or LOG_DP, as if it were an ostream like std::cerr. * Then stream logging info to ERR_DP, or LOG_DP, as if it were an ostream like std::cerr.
* (In general it will actually be std::cerr at runtime when logging is enabled.) * (In general it will actually be std::cerr at runtime when logging is enabled.)
* *
* LOG_DP << "Found a window resize event: ...\n"; * LOG_DP << "Found a window resize event: ...";
* *
* Please do not use iomanip features like std::hex directly on the logger. Because of the * Please do not use iomanip features like std::hex directly on the logger. Because of the
* design of the logger, this will result in all of the loggers (in fact std::cerr) being * design of the logger, this will result in all of the loggers (in fact std::cerr) being

View file

@ -100,7 +100,7 @@ void rotate_logs(const std::string& log_dir)
const std::string path = log_dir + '/' + files[j]; const std::string path = log_dir + '/' + files[j];
LOG_LS << "rotate_logs(): delete " << path; LOG_LS << "rotate_logs(): delete " << path;
if(!filesystem::delete_file(path)) { if(!filesystem::delete_file(path)) {
WRN_LS << "rotate_logs(): failed to delete " << path << "!\n"; WRN_LS << "rotate_logs(): failed to delete " << path << "!";
} }
} }
} }
@ -296,13 +296,13 @@ log_file_manager::log_file_manager(bool native_console)
, use_wincon_(console_attached()) , use_wincon_(console_attached())
, created_wincon_(false) , created_wincon_(false)
{ {
DBG_LS << "Early init message\n"; DBG_LS << "Early init message";
if(use_wincon_) { if(use_wincon_) {
// Someone already attached a console to us. Assume we were compiled // Someone already attached a console to us. Assume we were compiled
// with the console subsystem flag and that the standard streams are // with the console subsystem flag and that the standard streams are
// already pointing to the console. // already pointing to the console.
LOG_LS << "Console already attached at startup, log file disabled.\n"; LOG_LS << "Console already attached at startup, log file disabled.";
return; return;
} }
@ -384,7 +384,7 @@ void log_file_manager::do_redirect_single_stream(const std::string& file_path,
log_file_manager::STREAM_ID stream, log_file_manager::STREAM_ID stream,
bool truncate) bool truncate)
{ {
DBG_LS << stream << ' ' << cur_path_ << " -> " << file_path << " [side A]\n"; DBG_LS << stream << ' ' << cur_path_ << " -> " << file_path << " [side A]";
FILE* crts = stream == STREAM_STDERR ? stderr : stdout; FILE* crts = stream == STREAM_STDERR ? stderr : stdout;
std::ostream& cxxs = stream == STREAM_STDERR ? std::cerr : std::cout; std::ostream& cxxs = stream == STREAM_STDERR ? std::cerr : std::cout;
@ -401,7 +401,7 @@ void log_file_manager::do_redirect_single_stream(const std::string& file_path,
//setbuf(crts, nullptr); //setbuf(crts, nullptr);
DBG_LS << stream << ' ' << cur_path_ << " -> " << file_path << " [side B]\n"; DBG_LS << stream << ' ' << cur_path_ << " -> " << file_path << " [side B]";
} }
bool log_file_manager::console_enabled() const bool log_file_manager::console_enabled() const
@ -428,10 +428,10 @@ void log_file_manager::enable_native_console_output()
} }
if(AttachConsole(ATTACH_PARENT_PROCESS)) { if(AttachConsole(ATTACH_PARENT_PROCESS)) {
LOG_LS << "Attached parent process console.\n"; LOG_LS << "Attached parent process console.";
created_wincon_ = false; created_wincon_ = false;
} else if(AllocConsole()) { } else if(AllocConsole()) {
LOG_LS << "Allocated own console.\n"; LOG_LS << "Allocated own console.";
created_wincon_ = true; created_wincon_ = true;
} else { } else {
// Wine as of version 4.21 just goes ERROR_ACCESS_DENIED when trying // Wine as of version 4.21 just goes ERROR_ACCESS_DENIED when trying
@ -439,20 +439,20 @@ void log_file_manager::enable_native_console_output()
// this since the user purportedly knows what they're doing and if they // this since the user purportedly knows what they're doing and if they
// get radio silence from Wesnoth and no log files they'll realize that // get radio silence from Wesnoth and no log files they'll realize that
// something went wrong. // something went wrong.
WRN_LS << "Cannot attach or allocate a console, continuing anyway (is this Wine?)\n"; WRN_LS << "Cannot attach or allocate a console, continuing anyway (is this Wine?)";
} }
DBG_LS << "stderr to console\n"; DBG_LS << "stderr to console";
fflush(stderr); fflush(stderr);
std::cerr.flush(); std::cerr.flush();
assert(freopen("CONOUT$", "wb", stderr) == stderr); assert(freopen("CONOUT$", "wb", stderr) == stderr);
DBG_LS << "stdout to console\n"; DBG_LS << "stdout to console";
fflush(stdout); fflush(stdout);
std::cout.flush(); std::cout.flush();
assert(freopen("CONOUT$", "wb", stdout) == stdout); assert(freopen("CONOUT$", "wb", stdout) == stdout);
DBG_LS << "stdin from console\n"; DBG_LS << "stdin from console";
assert(freopen("CONIN$", "rb", stdin) == stdin); assert(freopen("CONIN$", "rb", stdin) == stdin);
// At this point the log file has been closed and it's no longer our // At this point the log file has been closed and it's no longer our
@ -461,7 +461,7 @@ void log_file_manager::enable_native_console_output()
cur_path_.clear(); cur_path_.clear();
use_wincon_ = true; use_wincon_ = true;
LOG_LS << "Console streams handover complete!\n"; LOG_LS << "Console streams handover complete!";
} }
std::unique_ptr<log_file_manager> lfm; std::unique_ptr<log_file_manager> lfm;
@ -522,7 +522,7 @@ void finish_log_file_setup()
static bool setup_complete = false; static bool setup_complete = false;
if(setup_complete) { if(setup_complete) {
ERR_LS << "finish_log_file_setup() called more than once!\n"; ERR_LS << "finish_log_file_setup() called more than once!";
return; return;
} }

Some files were not shown because too many files have changed in this diff Show more