| 1043 | #endif /* !SFCTOOL */ |
| 1044 | |
| 1045 | void |
| 1046 | getlev(NHFILE *nhfp, int pid, xint8 lev) |
| 1047 | { |
| 1048 | struct trap *trap; |
| 1049 | #ifndef SFCTOOL |
| 1050 | struct monst *mtmp; |
| 1051 | branch *br; |
| 1052 | int x, y; |
| 1053 | #endif |
| 1054 | long elapsed = 0L; |
| 1055 | int hpid = 0; |
| 1056 | xint8 dlvl = 0; |
| 1057 | int i, c, r; |
| 1058 | boolean ghostly = (nhfp->ftype == NHF_BONESFILE); |
| 1059 | coord *tmpc = 0; |
| 1060 | #ifdef TOS |
| 1061 | short tlev; |
| 1062 | #endif |
| 1063 | |
| 1064 | program_state.in_getlev = TRUE; |
| 1065 | #ifndef SFCTOOL |
| 1066 | |
| 1067 | if (ghostly) |
| 1068 | clear_id_mapping(); |
| 1069 | #endif /* !SFCTOOL */ |
| 1070 | |
| 1071 | #if 0 |
| 1072 | #if defined(MSDOS) || defined(OS2) |
| 1073 | if (nhfp->structlevel) |
| 1074 | setmode(nhfp->fd, O_BINARY); |
| 1075 | #endif |
| 1076 | #endif |
| 1077 | |
| 1078 | /* Load the old fruit info. We have to do it first, so the |
| 1079 | * information is available when restoring the objects. |
| 1080 | */ |
| 1081 | if (ghostly) |
| 1082 | go.oldfruit = loadfruitchn(nhfp); |
| 1083 | |
| 1084 | /* First some sanity checks */ |
| 1085 | Sfi_int(nhfp, &hpid, "gamestate-hackpid"); |
| 1086 | /* CHECK: This may prevent restoration */ |
| 1087 | Sfi_xint8(nhfp, &dlvl, "gamestate-dlvl"); |
| 1088 | #ifndef SFCTOOL |
| 1089 | if ((pid && pid != hpid) || (lev && dlvl != lev)) { |
| 1090 | char trickbuf[BUFSZ]; |
| 1091 | |
| 1092 | if (pid && pid != hpid) |
| 1093 | Sprintf(trickbuf, "PID (%d) doesn't match saved PID (%d)!", hpid, |
| 1094 | pid); |
| 1095 | else |
| 1096 | Sprintf(trickbuf, "This is level %d, not %d!", dlvl, lev); |
| 1097 | if (wizard) |
| 1098 | pline1(trickbuf); |
| 1099 | trickery(trickbuf); |
| 1100 | } |
| 1101 | #endif |
| 1102 | restcemetery(nhfp, &svl.level.bonesinfo); |
no test coverage detected