MCPcopy Index your code
hub / github.com/NetHack/NetHack / toggle_blindness

Function toggle_blindness

src/potion.c:335–364  ·  view source on GitHub ↗

blindness has just started or just ended--caller enforces that; called by Blindf_on(), Blindf_off(), and make_blinded() */

Source from the content-addressed store, hash-verified

333/* blindness has just started or just ended--caller enforces that;
334 called by Blindf_on(), Blindf_off(), and make_blinded() */
335void
336toggle_blindness(void)
337{
338 boolean Stinging = (uwep && (EWarn_of_mon & W_WEP) != 0L);
339
340 /* blindness has just been toggled */
341 disp.botl = TRUE; /* status conditions need update */
342 gv.vision_full_recalc = 1; /* vision has changed */
343 /* this vision recalculation used to be deferred until moveloop(),
344 but that made it possible for vision irregularities to occur
345 (cited case was force bolt hitting an adjacent potion of blindness
346 and then a secret door; hero was blinded by vapors but then got the
347 message "a door appears in the wall" because wall spot was IN_SIGHT) */
348 vision_recalc(0);
349 if (Blind_telepat || Infravision || Stinging)
350 see_monsters(); /* also counts EWarn_of_mon monsters */
351 /*
352 * Avoid either of the sequences
353 * "Sting starts glowing", [become blind], "Sting stops quivering" or
354 * "Sting starts quivering", [regain sight], "Sting stops glowing"
355 * by giving "Sting is quivering" when becoming blind or
356 * "Sting is glowing" when regaining sight so that the eventual
357 * "stops" message matches the most recent "Sting is ..." one.
358 */
359 if (Stinging)
360 Sting_effects(-1);
361 /* update dknown flag for inventory picked up while blind */
362 if (!Blind)
363 learn_unseen_invent();
364}
365
366DISABLE_WARNING_FORMAT_NONLITERAL
367

Callers 3

make_blindedFunction · 0.85
Blindf_onFunction · 0.85
Blindf_offFunction · 0.85

Calls 4

vision_recalcFunction · 0.85
see_monstersFunction · 0.85
Sting_effectsFunction · 0.85
learn_unseen_inventFunction · 0.85

Tested by

no test coverage detected