From db0441bf022bbefb65df8489433ea419dac46d79 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 5 Mar 2023 12:34:33 +0200 Subject: [PATCH] Split level temperature message into function --- src/do.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/do.c b/src/do.c index fc9e1b967..316abe3ce 100644 --- a/src/do.c +++ b/src/do.c @@ -20,6 +20,7 @@ static boolean u_stuck_cannot_go(const char *); static NHFILE *currentlevel_rewrite(void); static void familiar_level_msg(void); static void final_level(void); +static void temperature_change_msg(schar); /* static boolean badspot(coordxy,coordxy); */ @@ -1830,16 +1831,7 @@ goto_level( } } - if (prev_temperature != gl.level.flags.temperature) { - if (gl.level.flags.temperature) - hellish_smoke_mesg(); - else if (prev_temperature > 0) - pline_The("heat %s gone.", - In_hell(&u.uz0) - ? "and smoke are" : "is"); - else if (prev_temperature < 0) - You("are out of the cold."); - } + temperature_change_msg(prev_temperature); /* this was originally done earlier; moved here to be logged after any achievement related to entering a dungeon branch @@ -1903,6 +1895,22 @@ hellish_smoke_mesg(void) olfaction(gy.youmonst.data) ? "smell" : "sense"); } +/* give a message when the level temperature is different from previous */ +static void +temperature_change_msg(schar prev_temperature) +{ + if (prev_temperature != gl.level.flags.temperature) { + if (gl.level.flags.temperature) + hellish_smoke_mesg(); + else if (prev_temperature > 0) + pline_The("heat %s gone.", + In_hell(&u.uz0) + ? "and smoke are" : "is"); + else if (prev_temperature < 0) + You("are out of the cold."); + } +} + /* usually called from goto_level(); might be called from Sting_effects() */ void maybe_lvltport_feedback(void)