Be careful not to call panic from here! */
| 1017 | |
| 1018 | /* Be careful not to call panic from here! */ |
| 1019 | void |
| 1020 | done(int how) |
| 1021 | { |
| 1022 | boolean survive = FALSE; |
| 1023 | |
| 1024 | if (how == TRICKED) { |
| 1025 | if (svk.killer.name[0]) { |
| 1026 | paniclog("trickery", svk.killer.name); |
| 1027 | svk.killer.name[0] = '\0'; |
| 1028 | } |
| 1029 | if (wizard) { |
| 1030 | You("are a very tricky wizard, it seems."); |
| 1031 | svk.killer.format = KILLED_BY_AN; /* reset to 0 */ |
| 1032 | return; |
| 1033 | } |
| 1034 | } |
| 1035 | if (program_state.panicking |
| 1036 | #ifdef HANGUPHANDLING |
| 1037 | || program_state.done_hup |
| 1038 | #endif |
| 1039 | || (how == QUIT && done_stopprint)) { |
| 1040 | /* skip status update if panicking or disconnected |
| 1041 | or answer of 'q' to "Really quit?" */ |
| 1042 | disp.botl = disp.botlx = disp.time_botl = FALSE; |
| 1043 | } else { |
| 1044 | /* otherwise force full status update */ |
| 1045 | disp.botlx = TRUE; |
| 1046 | bot(); |
| 1047 | } |
| 1048 | |
| 1049 | /* hero_seq is (moves<<3 + n) where n is number of moves made |
| 1050 | by the hero on the current turn (since the 'moves' variable |
| 1051 | actually counts turns); its details shouldn't matter here; |
| 1052 | used by fuzzer_savelife() and for hangup below */ |
| 1053 | if (gd.done_seq < gh.hero_seq) |
| 1054 | gd.done_seq = gh.hero_seq; |
| 1055 | |
| 1056 | if (iflags.debug_fuzzer) { |
| 1057 | if (fuzzer_savelife(how)) |
| 1058 | return; |
| 1059 | } |
| 1060 | |
| 1061 | if (how == ASCENDED || (!svk.killer.name[0] && how == GENOCIDED)) |
| 1062 | svk.killer.format = NO_KILLER_PREFIX; |
| 1063 | /* Avoid killed by "a" burning or "a" starvation */ |
| 1064 | if (!svk.killer.name[0] && (how == STARVING || how == BURNING)) |
| 1065 | svk.killer.format = KILLED_BY; |
| 1066 | if (!svk.killer.name[0] || how >= PANICKED) |
| 1067 | Strcpy(svk.killer.name, deaths[how]); |
| 1068 | |
| 1069 | if (how < PANICKED) { |
| 1070 | u.umortality++; |
| 1071 | /* in case caller hasn't already done this */ |
| 1072 | if (u.uhp != 0 || (Upolyd && u.mh != 0)) { |
| 1073 | /* force HP to zero in case it is still positive (some |
| 1074 | deaths aren't triggered by loss of hit points), or |
| 1075 | negative (-1 is used as a flag in some circumstances |
| 1076 | which don't apply when actually dying due to HP loss) */ |
no test coverage detected