| 305 | static int interjection[INTERJECTION_TYPES]; |
| 306 | |
| 307 | void |
| 308 | interject_assistance(int num, int interjection_type, genericptr_t ptr1, genericptr_t ptr2) |
| 309 | { |
| 310 | switch (num) { |
| 311 | case 1: { |
| 312 | char *panicmsg = (char *) ptr1; |
| 313 | char *datadir = (char *) ptr2; |
| 314 | char *tempdir = nh_getenv("TEMP"); |
| 315 | interjection_type = INTERJECT_PANIC; |
| 316 | interjection[INTERJECT_PANIC] = 1; |
| 317 | /* |
| 318 | * ptr1 = the panic message about to be delivered. |
| 319 | * ptr2 = the directory prefix of the dungeon file |
| 320 | * that failed to open. |
| 321 | * Check to see if datadir matches tempdir or a |
| 322 | * common windows temp location. If it does, inform |
| 323 | * the user that they are probably trying to run the |
| 324 | * game from within their unzip utility, so the required |
| 325 | * files really don't exist at the location. Instruct |
| 326 | * them to unpack them first. |
| 327 | */ |
| 328 | if (panicmsg && datadir) { |
| 329 | if (!strncmpi(datadir, "C:\\WINDOWS\\TEMP", 15) |
| 330 | || strstri(datadir, "TEMP") |
| 331 | || (tempdir && strstri(datadir, tempdir))) { |
| 332 | (void) strncpy( |
| 333 | interjection_buf[INTERJECT_PANIC], |
| 334 | "\nOne common cause of this error is attempting to " |
| 335 | "execute\n" |
| 336 | "the game by double-clicking on it while it is " |
| 337 | "displayed\n" |
| 338 | "inside an unzip utility.\n\n" |
| 339 | "You have to unzip the contents of the zip file into a\n" |
| 340 | "folder on your system, and then run \"NetHack.exe\" or " |
| 341 | "\n" |
| 342 | "\"NetHackW.exe\" from there.\n\n" |
| 343 | "If that is not the situation, you are encouraged to\n" |
| 344 | "report the error as shown above.\n\n", |
| 345 | 1023); |
| 346 | } |
| 347 | } |
| 348 | } break; |
| 349 | } |
| 350 | nhUse(interjection_type); |
| 351 | } |
| 352 | |
| 353 | void |
| 354 | interject(int interjection_type) |
no test coverage detected