MCPcopy Create free account
hub / github.com/crawl/crawl / _input

Function _input

crawl-ref/source/main.cc:1079–1345  ·  view source on GitHub ↗

This function handles the player's input. It's called from main(), from inside an endless loop.

Source from the content-addressed store, hash-verified

1077// from inside an endless loop.
1078//
1079static void _input()
1080{
1081 if (crawl_state.seen_hups)
1082 save_game(true, "Game saved, see you later!");
1083
1084 crawl_state.clear_mon_acting();
1085
1086 disable_check player_disabled(you.incapacitated());
1087 religion_turn_start();
1088 god_conduct_turn_start();
1089
1090 // Currently only set if Xom accidentally kills the player.
1091 you.reset_escaped_death();
1092
1093 reset_damage_counters();
1094
1095 if (you.pending_revival)
1096 {
1097 revive();
1098 bring_to_safety();
1099 redraw_screen();
1100 update_screen();
1101 }
1102
1103 if (you.props.exists(DREAMSHARD_KEY))
1104 you.props.erase(DREAMSHARD_KEY);
1105 crawl_state.potential_pursuers.clear();
1106
1107 apply_exp();
1108
1109 // Unhandled things that should have caused death.
1110 ASSERT(you.hp > 0);
1111
1112 if (crawl_state.is_replaying_keys() && crawl_state.is_repeating_cmd()
1113 && kbhit())
1114 {
1115 // User pressed a key, so stop repeating commands and discard
1116 // the keypress.
1117 crawl_state.cancel_cmd_repeat("Key pressed, interrupting command "
1118 "repetition.");
1119 crawl_state.prev_cmd = CMD_NO_CMD;
1120 flush_prev_message();
1121 return;
1122 }
1123
1124 _prep_input();
1125
1126 update_monsters_in_view();
1127
1128 hints_new_turn();
1129
1130 if (you.cannot_act())
1131 {
1132 if (crawl_state.repeat_cmd != CMD_WIZARD)
1133 {
1134 crawl_state.cancel_cmd_repeat("Cannot control self, cancelling command "
1135 "repetition.");
1136 }

Callers 3

_launch_gameFunction · 0.85
_run_input_with_keysFunction · 0.85
_do_cmd_repeatFunction · 0.85

Calls 15

save_gameFunction · 0.85
religion_turn_startFunction · 0.85
god_conduct_turn_startFunction · 0.85
reset_damage_countersFunction · 0.85
reviveFunction · 0.85
bring_to_safetyFunction · 0.85
redraw_screenFunction · 0.85
apply_expFunction · 0.85
flush_prev_messageFunction · 0.85
_prep_inputFunction · 0.85
update_monsters_in_viewFunction · 0.85
hints_new_turnFunction · 0.85

Tested by

no test coverage detected