|
From: <gi...@cr...> - 2025-12-02 08:25:14
|
via cf93559967e9fa10e119568d4e0a9f0c938538e2 (commit)
from 40ba7039b06e1722f8741c5272b21c961b46c407 (commit)
-----------------------------------------------------------------------
commit cf93559967e9fa10e119568d4e0a9f0c938538e2
Author: Isaac Clancy <ik...@ya...>
Date: Tue Dec 2 20:54:23 2025 +1300
Fix sometimes getting incorect monster leaves view messages
If a monster enters view and then isn't in view at the start of the
player's next turn, we print a message so that the player isn't confused
about things like auto explore being interrupted with no monster in view
etc. However, because we printed the messages about monster's leaving
view before decaying clouds, a monster could move behind enough fog
clouds to be out of view and then we would print the message and then
the fog clouds would decay putting the monster back in view. This would
leave the player with a confusing message about a monster leaving view
when all the monster's were still in view.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/abyss.cc | 2 ++
crawl-ref/source/main.cc | 5 +++++
crawl-ref/source/mon-act.cc | 3 +--
crawl-ref/source/mon-act.h | 1 +
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 62b42ffa25..3907ebe8c9 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -37,6 +37,7 @@
#include "mapmark.h"
#include "maps.h"
#include "message.h"
+#include "mon-act.h"
#include "mon-cast.h"
#include "mon-death.h"
#include "mon-pathfind.h"
@@ -462,6 +463,7 @@ void check_banished()
if (you.banished)
{
you.banished = false;
+ mons_reset_just_seen();
ASSERT(brdepth[BRANCH_ABYSS] != -1);
if (!player_in_branch(BRANCH_ABYSS))
mprf(MSGCH_BANISHMENT, "You are cast into the Abyss!");
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 7622b423e2..ca68a25d1e 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2623,6 +2623,11 @@ void world_reacts()
handle_time();
manage_clouds();
+
+ // This needs to happen after `manage_clouds` is called as fog clouds
+ // decaying will affect whether a monster is still in view
+ print_mons_left_view_messages();
+
if (env.level_state & LSTATE_GOLUBRIA)
_update_golubria_traps(you.time_taken);
if (env.level_state & LSTATE_STILL_WINDS)
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index ac732199f6..b2bf44918a 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -2681,7 +2681,7 @@ void mons_reset_just_seen()
just_seen_queue.clear();
}
-static void _display_just_seen()
+void print_mons_left_view_messages()
{
// these are monsters that were marked as SC_NEWLY_SEEN at some point since
// last time this was called. We announce any that leave all at once so
@@ -2763,7 +2763,6 @@ void handle_monsters(bool with_noise)
break;
}
}
- _display_just_seen();
// Process noises now (before clearing the sleep flag).
if (with_noise)
diff --git a/crawl-ref/source/mon-act.h b/crawl-ref/source/mon-act.h
index 699c1da382..5718fd1de6 100644
--- a/crawl-ref/source/mon-act.h
+++ b/crawl-ref/source/mon-act.h
@@ -25,6 +25,7 @@ public:
void mons_set_just_seen(monster *mon);
void mons_reset_just_seen();
+void print_mons_left_view_messages();
bool mon_can_move_to_pos(const monster* mons, const coord_def& delta,
bool just_check = false);
--
Dungeon Crawl Stone Soup
|