From 54fc4a728374ef259d961cd3f711e3bd2d39239c Mon Sep 17 00:00:00 2001 From: Neil McGill Date: Fri, 16 Jun 2023 16:39:28 +0100 Subject: [PATCH] change some debugs to level 2 --- src/thing_ai.cpp | 86 ++++++++++++++++++++++---------------------- src/thing_avoid.cpp | 56 ++++++++++++++--------------- src/thing_wander.cpp | 44 +++++++++++------------ 3 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/thing_ai.cpp b/src/thing_ai.cpp index 62f208e18..10d075ce1 100644 --- a/src/thing_ai.cpp +++ b/src/thing_ai.cpp @@ -42,7 +42,7 @@ bool operator<(const class Path &lhs, const class Path &rhs) } #define GOAL_ADD(prio, score, msg, it) \ - IF_DEBUG \ + IF_DEBUG2 \ { \ auto s = string_sprintf("Add goal prio %d score %d @(%d,%d) %s", prio, score, p.x, p.y, msg); \ AI_LOG(s, it); \ @@ -50,7 +50,7 @@ bool operator<(const class Path &lhs, const class Path &rhs) goals.insert(Goal(prio, score, p, msg, it)); #define GOAL_AVOID_ADD(prio, score, msg, it) \ - IF_DEBUG \ + IF_DEBUG2 \ { \ auto s = string_sprintf("Add goal (avoid) prio %d score %d @(%d,%d) %s", prio, score, p.x, p.y, msg); \ AI_LOG(s, it); \ @@ -61,12 +61,12 @@ void Thing::ai_log(const std::string &msg, Thingp it) { TRACE_NO_INDENT(); - IF_DEBUG + IF_DEBUG2 { if (it) { - dbg("AI: %s, %s", msg.c_str(), it->to_short_string().c_str()); + dbg2("AI: %s, %s", msg.c_str(), it->to_short_string().c_str()); } else { - dbg("AI: %s", msg.c_str()); + dbg2("AI: %s", msg.c_str()); } } } @@ -86,7 +86,7 @@ bool Thing::ai_create_path_to_goal(int minx, int miny, int maxx, int maxy, int s // Choose goals (higher scores, lower costs are preferred) // std::string s = "Choose goal"; - IF_DEBUG { s = string_sprintf("Try to find goals, search-type %d", search_type); } + IF_DEBUG2 { s = string_sprintf("Try to find goals, search-type %d", search_type); } AI_LOG(s); TRACE_AND_INDENT(); @@ -140,7 +140,7 @@ bool Thing::ai_create_path_to_goal(int minx, int miny, int maxx, int maxy, int s return false; } - IF_DEBUG + IF_DEBUG2 { AI_LOG("All goals:"); TRACE_AND_INDENT(); @@ -169,7 +169,7 @@ bool Thing::ai_create_path_to_goal(int minx, int miny, int maxx, int maxy, int s for (auto &g : goalmaps) { auto goal_dmap_copy = *g.dmap; - IF_DEBUG + IF_DEBUG2 { if (is_debug_type()) { AI_LOG("Pre modify dmap for terrain"); @@ -200,7 +200,7 @@ bool Thing::ai_create_path_to_goal(int minx, int miny, int maxx, int maxy, int s } } - IF_DEBUG + IF_DEBUG2 { if (is_debug_type()) { AI_LOG("Modified dmap for terrain"); @@ -230,7 +230,7 @@ bool Thing::ai_create_path_to_goal(int minx, int miny, int maxx, int maxy, int s } } - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Accept avoid goal score %d @(%d,%d) %s", (int) goal.score, (int) goal.at.x, (int) goal.at.y, goal.msg.c_str()); @@ -256,7 +256,7 @@ bool Thing::ai_create_path_to_goal(int minx, int miny, int maxx, int maxy, int s add_goal_penalty(goal.what); } - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Accept goal score %d @(%d,%d) %s", (int) goal.score, (int) goal.at.x, (int) goal.at.y, goal.msg.c_str()); @@ -274,7 +274,7 @@ bool Thing::ai_create_path_to_goal(int minx, int miny, int maxx, int maxy, int s bool Thing::ai_create_path_to_single_goal_do(int minx, int miny, int maxx, int maxy, const Goal &goal, const Dmap *saved_dmap, bool allow_diagonals) { - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Process goal score %d @(%d,%d) %s", (int) goal.score, (int) goal.at.x, (int) goal.at.y, goal.msg.c_str()); @@ -395,7 +395,7 @@ bool Thing::ai_create_path_to_single_goal_do(int minx, int miny, int maxx, int m // Did we try or attempt to try to do something? // if (! game->tick_requested.empty()) { - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Successfully requested a tick: %s", game->tick_requested.c_str()); AI_LOG(s); @@ -482,7 +482,7 @@ int Thing::ai_dmap_can_see_init(int minx, int miny, int maxx, int maxy, int sear point p(x, y); if (! get(ai->can_see_ever.can_see, x, y)) { - // dbg("can see walk %d,%d line %d", x, y, __LINE__); + // dbg2("can see walk %d,%d line %d", x, y, __LINE__); continue; } @@ -494,13 +494,13 @@ int Thing::ai_dmap_can_see_init(int minx, int miny, int maxx, int maxy, int sear // if (0) { if (too_far_from_mob(p)) { - // dbg("can see walk %d,%d line %d", x, y, __LINE__); + // dbg2("can see walk %d,%d line %d", x, y, __LINE__); continue; } if (too_far_from_leader(p)) { if (distance_from_leader() < too_far_from_leader(p)) { - // dbg("can see walk %d,%d line %d", x, y, __LINE__); + // dbg2("can see walk %d,%d line %d", x, y, __LINE__); continue; } } @@ -547,7 +547,7 @@ int Thing::ai_dmap_can_see_init(int minx, int miny, int maxx, int maxy, int sear // So if we get here this thing is an AI obstacle. Can we jump over it? // if (! jump_allowed) { - // dbg("can see walk %d,%d line %d", x, y, __LINE__); + // dbg2("can see walk %d,%d line %d", x, y, __LINE__); continue; } @@ -908,20 +908,20 @@ int Thing::ai_dmap_can_see_init(int minx, int miny, int maxx, int maxy, int sear // set(dmap_can_see->val, start.x, start.y, DMAP_IS_GOAL); - IF_DEBUG + IF_DEBUG2 { if (is_debug_type()) { - dbg("DMAP can see before processing:"); + dbg2("DMAP can see before processing:"); dmap_print(dmap_can_see, curr_at, point(minx, miny), point(maxx, maxy)); } } dmap_process(dmap_can_see, point(minx, miny), point(maxx, maxy), true, true); - IF_DEBUG + IF_DEBUG2 { if (is_debug_type()) { - dbg("DMAP can see:"); + dbg2("DMAP can see:"); dmap_print(dmap_can_see, curr_at, point(minx, miny), point(maxx, maxy)); } } @@ -952,7 +952,7 @@ void Thing::ai_choose_can_see_goals(std::multiset< Goal > &goals, int minx, int } } - dbg("Choose can see goals between %d,%d and %d,%d", minx, miny, maxx, maxy); + dbg2("Choose can see goals between %d,%d and %d,%d", minx, miny, maxx, maxy); TRACE_AND_INDENT(); for (int y = miny; y <= maxy; y++) { @@ -1119,9 +1119,9 @@ void Thing::ai_choose_can_see_goals(std::multiset< Goal > &goals, int minx, int // knowledge. // if (lit_recently) { - dbg("AI: Consider (my agg+health %d, its health %d) ? %s%s%s%s", my_health, it_health, - it->to_short_string().c_str(), is_enemy(it) ? ", is enemy" : "", - is_dangerous(it) ? ", is dangerous" : "", is_to_be_avoided(it) ? ", is to be avoided" : ""); + dbg2("AI: Consider (my agg+health %d, its health %d) ? %s%s%s%s", my_health, it_health, + it->to_short_string().c_str(), is_enemy(it) ? ", is enemy" : "", + is_dangerous(it) ? ", is dangerous" : "", is_to_be_avoided(it) ? ", is to be avoided" : ""); TRACE_AND_INDENT(); if (is_enemy(it) && (dist <= max_dist)) { @@ -1416,7 +1416,7 @@ void Thing::ai_choose_search_goals(std::multiset< Goal > &goals, int search_type if (search_type < MONST_SEARCH_TYPE_LAST_RESORTS_NO_JUMP) { continue; } - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Choose possible descend sewer at @(%d,%d)", o.x, o.y); AI_LOG(s); @@ -1434,7 +1434,7 @@ void Thing::ai_choose_search_goals(std::multiset< Goal > &goals, int search_type if (search_type < MONST_SEARCH_TYPE_LAST_RESORTS_NO_JUMP) { continue; } - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Choose possible ascend sewer at @(%d,%d)", o.x, o.y); AI_LOG(s); @@ -1452,7 +1452,7 @@ void Thing::ai_choose_search_goals(std::multiset< Goal > &goals, int search_type if (search_type < MONST_SEARCH_TYPE_LAST_RESORTS_NO_JUMP) { continue; } - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Choose possible descend dungeon at @(%d,%d)", o.x, o.y); AI_LOG(s); @@ -1470,7 +1470,7 @@ void Thing::ai_choose_search_goals(std::multiset< Goal > &goals, int search_type if (search_type < MONST_SEARCH_TYPE_LAST_RESORTS_NO_JUMP) { continue; } - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Choose possible ascend dungeon at @(%d,%d)", o.x, o.y); AI_LOG(s); @@ -1591,7 +1591,7 @@ void Thing::ai_choose_search_goals(std::multiset< Goal > &goals, int search_type // No search destinations that are, for example, a chasm // if (is_hated_by_me(p)) { - IF_DEBUG + IF_DEBUG2 { auto s = string_sprintf("Search cand is hated @(%d,%d)", p.x, p.y); AI_LOG(s); @@ -2037,7 +2037,7 @@ bool Thing::ai_choose_avoid_goals(std::multiset< Goal > &goals, const Goal &goal // bool Thing::ai_tick(bool recursing) { - dbg("AI: tick"); + dbg2("AI: tick"); TRACE_AND_INDENT(); auto ai = aip(); @@ -2194,18 +2194,18 @@ bool Thing::ai_tick(bool recursing) // // See if anything dangerous is close // - dbg("AI: look for dangerous things"); + dbg2("AI: look for dangerous things"); TRACE_AND_INDENT(); threat = most_dangerous_visible_thing(); if (threat) { - IF_DEBUG { ai_log("threat", threat); } + IF_DEBUG2 { ai_log("threat", threat); } } // // A threat can be a few tiles away; but if one is standing literally next to us! then it takes priority. // - dbg("AI: look for adjacent dangerous things"); + dbg2("AI: look for adjacent dangerous things"); TRACE_AND_INDENT(); auto adjacent_threat = most_dangerous_adjacent_thing(); @@ -2437,13 +2437,13 @@ bool Thing::ai_tick(bool recursing) } } - dbg("AI: state handling"); + dbg2("AI: state handling"); TRACE_AND_INDENT(); switch (infop()->monst_state) { case MONST_STATE_IDLE : { - dbg("AI: state idle"); + dbg2("AI: state idle"); TRACE_AND_INDENT(); if (state_idle(threat, minx, miny, maxx, maxy)) { @@ -2453,7 +2453,7 @@ bool Thing::ai_tick(bool recursing) } case MONST_STATE_MOVING : { - dbg("AI: state moving"); + dbg2("AI: state moving"); TRACE_AND_INDENT(); if (state_moving()) { @@ -2463,7 +2463,7 @@ bool Thing::ai_tick(bool recursing) } case MONST_STATE_SLEEPING : { - dbg("AI: state sleeping"); + dbg2("AI: state sleeping"); TRACE_AND_INDENT(); if (state_sleeping(do_something, wait)) { @@ -2473,7 +2473,7 @@ bool Thing::ai_tick(bool recursing) } case MONST_STATE_RESTING : { - dbg("AI: state resting"); + dbg2("AI: state resting"); TRACE_AND_INDENT(); if (state_resting(do_something, wait)) { @@ -2483,7 +2483,7 @@ bool Thing::ai_tick(bool recursing) } case MONST_STATE_OPEN_INVENTORY : { - dbg("AI: state open inventory"); + dbg2("AI: state open inventory"); TRACE_AND_INDENT(); if (state_open_inventory()) { @@ -2493,7 +2493,7 @@ bool Thing::ai_tick(bool recursing) } case MONST_STATE_USING_ENCHANTSTONE : { - dbg("AI: state use enchantstone"); + dbg2("AI: state use enchantstone"); TRACE_AND_INDENT(); if (state_using_enchantstone()) { @@ -2503,7 +2503,7 @@ bool Thing::ai_tick(bool recursing) } case MONST_STATE_USING_SKILLSTONE : { - dbg("AI: state use skillstone"); + dbg2("AI: state use skillstone"); TRACE_AND_INDENT(); if (state_using_skillstone()) { @@ -2513,7 +2513,7 @@ bool Thing::ai_tick(bool recursing) } case MONST_STATE_REPACK_INVENTORY : { - dbg("AI: state repack inventory"); + dbg2("AI: state repack inventory"); TRACE_AND_INDENT(); if (state_repack_inventory()) { diff --git a/src/thing_avoid.cpp b/src/thing_avoid.cpp index 38b701c3d..b78560325 100644 --- a/src/thing_avoid.cpp +++ b/src/thing_avoid.cpp @@ -11,7 +11,7 @@ bool Thing::will_avoid_monst(const Thingp it) TRACE_NO_INDENT(); auto me = tp(); - // dbg("Avoid %s?", it->to_short_string().c_str()); + // dbg2("Avoid %s?", it->to_short_string().c_str()); // // Avoid flaming things; even friends. @@ -19,12 +19,12 @@ bool Thing::will_avoid_monst(const Thingp it) if (! is_fire_elemental()) { if (environ_dislikes_fire() > 10) { if (it->is_fire()) { - dbg("Avoid fire: %s", it->to_short_string().c_str()); + dbg2("Avoid fire: %s", it->to_short_string().c_str()); return true; } if (it->is_on_fire()) { - dbg("Avoid on fire: %s", it->to_short_string().c_str()); + dbg2("Avoid on fire: %s", it->to_short_string().c_str()); return true; } } @@ -36,14 +36,14 @@ bool Thing::will_avoid_monst(const Thingp it) if (! is_fearless()) { if (is_cautious()) { if (health() < health_max() / 2) { - dbg("Avoid %s? yes as low on health", it->to_short_string().c_str()); + dbg2("Avoid %s? yes as low on health", it->to_short_string().c_str()); return false; } } if (is_daring()) { if (health() < health_max() / 3) { - dbg("Avoid %s? yes as low on health", it->to_short_string().c_str()); + dbg2("Avoid %s? yes as low on health", it->to_short_string().c_str()); return false; } } @@ -53,7 +53,7 @@ bool Thing::will_avoid_monst(const Thingp it) // Not moving? // if (it->idle_count() > 5) { - dbg("Avoid %s? no it's idle", it->to_short_string().c_str()); + dbg2("Avoid %s? no it's idle", it->to_short_string().c_str()); return false; } @@ -61,29 +61,29 @@ bool Thing::will_avoid_monst(const Thingp it) // It's stuck? // if (it->stuck_count() > 5) { - dbg("Avoid %s? no it's stuck", it->to_short_string().c_str()); + dbg2("Avoid %s? no it's stuck", it->to_short_string().c_str()); return false; } if (is_friend(it) || same_mob(it)) { - dbg("Avoid %s? no it's a friend", it->to_short_string().c_str()); + dbg2("Avoid %s? no it's a friend", it->to_short_string().c_str()); return false; } if (is_dangerous(it)) { - dbg("Avoid dangerous: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous: %s", it->to_short_string().c_str()); return true; } if (it->is_edible(this) && is_dangerous(it)) { - dbg("Avoid dangerous eater: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous eater: %s", it->to_short_string().c_str()); return true; } if (me->is_humanoid()) { if (it->attack_humanoid()) { if (is_dangerous(it)) { - dbg("Avoid dangerous humanoid: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous humanoid: %s", it->to_short_string().c_str()); return true; } } @@ -92,7 +92,7 @@ bool Thing::will_avoid_monst(const Thingp it) if (me->is_living()) { if (it->attack_living()) { if (is_dangerous(it)) { - dbg("Avoid dangerous monst: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous monst: %s", it->to_short_string().c_str()); return true; } } @@ -101,7 +101,7 @@ bool Thing::will_avoid_monst(const Thingp it) if (me->is_meat()) { if (it->attack_meat()) { if (is_dangerous(it)) { - dbg("Avoid dangerous monst: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous monst: %s", it->to_short_string().c_str()); return true; } } @@ -110,7 +110,7 @@ bool Thing::will_avoid_monst(const Thingp it) if (me->is_red_blooded() || me->is_green_blooded() || me->is_red_blood() || me->is_green_blood()) { if (it->attack_blood()) { if (is_dangerous(it)) { - dbg("Avoid dangerous monst: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous monst: %s", it->to_short_string().c_str()); return true; } } @@ -119,7 +119,7 @@ bool Thing::will_avoid_monst(const Thingp it) if (me->is_undead()) { if (it->attack_undead()) { if (is_dangerous(it)) { - dbg("Avoid dangerous monst: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous monst: %s", it->to_short_string().c_str()); return true; } } @@ -165,7 +165,7 @@ bool Thing::will_avoid_monst(const point p) if (it->is_player()) { if (is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid dangerous as I am weak: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous as I am weak: %s", it->to_short_string().c_str()); return true; } } @@ -174,7 +174,7 @@ bool Thing::will_avoid_monst(const point p) if (it->is_edible(this) && is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid meat eater as I am weak: %s", it->to_short_string().c_str()); + dbg2("Avoid meat eater as I am weak: %s", it->to_short_string().c_str()); return true; } } @@ -183,7 +183,7 @@ bool Thing::will_avoid_monst(const point p) if (it->attack_humanoid()) { if (is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid humanoid eater as I am weak: %s", it->to_short_string().c_str()); + dbg2("Avoid humanoid eater as I am weak: %s", it->to_short_string().c_str()); return true; } } @@ -194,7 +194,7 @@ bool Thing::will_avoid_monst(const point p) if (it->attack_living()) { if (is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid living eater as I am weak: %s", it->to_short_string().c_str()); + dbg2("Avoid living eater as I am weak: %s", it->to_short_string().c_str()); return true; } } @@ -205,7 +205,7 @@ bool Thing::will_avoid_monst(const point p) if (it->attack_meat()) { if (is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid meat eater as I am weak: %s", it->to_short_string().c_str()); + dbg2("Avoid meat eater as I am weak: %s", it->to_short_string().c_str()); return true; } } @@ -216,7 +216,7 @@ bool Thing::will_avoid_monst(const point p) if (it->attack_blood()) { if (is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid blood eater as I am weak: %s", it->to_short_string().c_str()); + dbg2("Avoid blood eater as I am weak: %s", it->to_short_string().c_str()); return true; } } @@ -227,7 +227,7 @@ bool Thing::will_avoid_monst(const point p) if (it->attack_undead()) { if (is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid undead eater as I am weak: %s", it->to_short_string().c_str()); + dbg2("Avoid undead eater as I am weak: %s", it->to_short_string().c_str()); return true; } } @@ -236,7 +236,7 @@ bool Thing::will_avoid_monst(const point p) if (is_dangerous(it)) { if (health() < health_max() / 4) { - dbg("Avoid dangerous: %s", it->to_short_string().c_str()); + dbg2("Avoid dangerous: %s", it->to_short_string().c_str()); return true; } } @@ -292,13 +292,13 @@ void Thing::avoid_tick(void) } if (attacker->is_dead) { - dbg("Remove avoid, is dead: %s", attacker->to_string().c_str()); + dbg2("Remove avoid, is dead: %s", attacker->to_string().c_str()); aip()->avoid.erase(p.first); return; } if (--p.second > 0) { - dbg("Avoid: %s (%d count)", attacker->to_string().c_str(), p.second); + dbg2("Avoid: %s (%d count)", attacker->to_string().c_str(), p.second); continue; } @@ -306,7 +306,7 @@ void Thing::avoid_tick(void) // If far enough away start to forget this enemy // if (distance(attacker->curr_at, curr_at) > distance_avoid_get()) { - dbg("Remove avoid: %s", attacker->to_string().c_str()); + dbg2("Remove avoid: %s", attacker->to_string().c_str()); aip()->avoid.erase(p.first); return; } @@ -334,10 +334,10 @@ void Thing::add_avoid(Thingp attacker) } if (! aip()->avoid[ attacker->id ]) { - dbg("Add new avoid %s", attacker->to_string().c_str()); + dbg2("Add new avoid %s", attacker->to_string().c_str()); aip()->avoid[ attacker->id ] += 2; } else { - dbg("Increment old avoid %s", attacker->to_string().c_str()); + dbg2("Increment old avoid %s", attacker->to_string().c_str()); aip()->avoid[ attacker->id ] += 2; if (aip()->avoid[ attacker->id ] > THING_AI_MAX_AVOID_COUNT) { diff --git a/src/thing_wander.cpp b/src/thing_wander.cpp index ac3f19ea7..18051f665 100644 --- a/src/thing_wander.cpp +++ b/src/thing_wander.cpp @@ -63,7 +63,7 @@ bool Thing::ai_create_path(point &nh, const point start, const point end) return false; } - dbg("AI: create path from %d,%d to %d,%d", start.x, start.y, end.x, end.y); + dbg2("AI: create path from %d,%d to %d,%d", start.x, start.y, end.x, end.y); TRACE_AND_INDENT(); Dmap dmap {}; @@ -177,7 +177,7 @@ bool Thing::ai_create_path(point &nh, const point start, const point end) } if (is_debug_type()) { - dbg("AI: created path %s", goal_path_str.c_str()); + dbg2("AI: created path %s", goal_path_str.c_str()); } auto hops = result.path; @@ -216,7 +216,7 @@ bool Thing::ai_create_path(point &nh, const point start, const point end) bool Thing::ai_choose_wander(point &nh) { - dbg("AI: choose wander dest (curr at %d,%d)", curr_at.x, curr_at.y); + dbg2("AI: choose wander dest (curr at %d,%d)", curr_at.x, curr_at.y); TRACE_AND_INDENT(); if (! maybe_aip()) { @@ -228,7 +228,7 @@ bool Thing::ai_choose_wander(point &nh) // auto dest = aip()->wander_dest; if ((curr_at.x == dest.x) && (curr_at.y == dest.y)) { - dbg("Reached dest"); + dbg2("Reached dest"); dest = point(-1, -1); } @@ -244,35 +244,35 @@ bool Thing::ai_choose_wander(point &nh) // aip()->wander_dest = point(0, 0); - dbg("AI: get random destination"); + dbg2("AI: get random destination"); TRACE_AND_INDENT(); dest = dest_random_get(); - dbg("Try wander to %s", dest.to_string().c_str()); + dbg2("Try wander to %s", dest.to_string().c_str()); // // Minions are constrained but we should stop the movement if it gets too far. // There may be nowhere else for it to try to move. // if (too_far_from_mob(dest)) { - dbg("Too far off the leash but allow wander anyway to %d,%d", dest.x, dest.y); + dbg2("Too far off the leash but allow wander anyway to %d,%d", dest.x, dest.y); } if (too_far_from_leader(dest)) { if (distance_from_leader() > too_far_from_leader(dest)) { - dbg("Wander closer to leader via %d,%d", dest.x, dest.y); + dbg2("Wander closer to leader via %d,%d", dest.x, dest.y); } else { - dbg("Too far from leader; but allow wander anyway to %d,%d", dest.x, dest.y); + dbg2("Too far from leader; but allow wander anyway to %d,%d", dest.x, dest.y); } } if (! ai_create_path(nh, curr_at, dest)) { - dbg("Could not wander; could not create path to %d,%d", dest.x, dest.y); + dbg2("Could not wander; could not create path to %d,%d", dest.x, dest.y); return false; } if (dest == curr_at) { - dbg("Could not wander; at dest"); + dbg2("Could not wander; at dest"); return false; } @@ -280,7 +280,7 @@ bool Thing::ai_choose_wander(point &nh) #ifdef ENABLE_DEBUG_AI_WANDER thing_new("ai_path2", fpoint(dest.x, dest.y)); #endif - dbg("Wander to %d,%d nh %d,%d", dest.x, dest.y, nh.x, nh.y); + dbg2("Wander to %d,%d nh %d,%d", dest.x, dest.y, nh.x, nh.y); if (game->robot_mode && is_player()) { game->tick_begin("need to wander"); @@ -291,17 +291,17 @@ bool Thing::ai_choose_wander(point &nh) bool Thing::ai_wander(void) { - dbg("AI: wander"); + dbg2("AI: wander"); TRACE_AND_INDENT(); if (! is_moveable()) { - dbg("AI: wander, no cannot move"); + dbg2("AI: wander, no cannot move"); return false; } if (is_monst()) { if (ai_tried_to_wander) { - dbg("AI: wander, no already tried to wander"); + dbg2("AI: wander, no already tried to wander"); return false; } ai_tried_to_wander = true; @@ -313,13 +313,13 @@ bool Thing::ai_wander(void) clear_move_path("AI: wander"); if (ai_blocked_completely()) { - dbg("AI: wander, blocked on all sides, try escape"); + dbg2("AI: wander, blocked on all sides, try escape"); if (ai_escape()) { return true; } if (is_able_to_jump()) { - dbg("AI: wander, blocked on all sides, try jumping"); + dbg2("AI: wander, blocked on all sides, try jumping"); if (health() < health_max() / 5) { // // May jump into something bad out of desperation @@ -333,12 +333,12 @@ bool Thing::ai_wander(void) } } } - dbg("AI: wander blocked"); + dbg2("AI: wander blocked"); return false; } if (ai_blocked()) { - dbg("AI: wander, blocked on all sides except current pos, try jumping"); + dbg2("AI: wander, blocked on all sides except current pos, try jumping"); if (is_able_to_jump()) { // // May jump into something bad out of desperation @@ -354,11 +354,11 @@ bool Thing::ai_wander(void) } } - dbg("AI: wander blocked"); + dbg2("AI: wander blocked"); return false; } - dbg("AI: wander tries"); + dbg2("AI: wander tries"); TRACE_AND_INDENT(); auto tries = THING_AI_WANDER_TRIES; @@ -376,6 +376,6 @@ bool Thing::ai_wander(void) } } - dbg("No wander goal"); + dbg2("No wander goal"); return false; }