MCPcopy Create free account
hub / github.com/NetHack/NetHack / saveRezStrings

Function saveRezStrings

outdated/sys/mac/mrecover.c:1037–1091  ·  view source on GitHub ↗

add friendly, non-essential resource strings to save file */

Source from the content-addressed store, hash-verified

1035
1036/* add friendly, non-essential resource strings to save file */
1037static short
1038saveRezStrings()
1039{
1040 short sRefNum;
1041 StringHandle strHnd;
1042 short i, rezID;
1043 unsigned char *plName;
1044
1045 HCreateResFile(vRefNum, dirID, savename);
1046
1047 sRefNum = HOpenResFile(vRefNum, dirID, savename, fsRdWrPerm);
1048 if (sRefNum <= 0) {
1049 note(noErr, alidNote, "\pOK: Minor resource map error");
1050 return 1;
1051 }
1052
1053 /* savename and hpid get mutilated here... */
1054 plName = savename + 5; /* save/ */
1055 *savename -= 5;
1056 do {
1057 plName++;
1058 (*savename)--;
1059 hpid /= 10;
1060 } while (hpid);
1061 *plName = *savename;
1062
1063 for (i = 1; i <= 2; i++) {
1064 switch (i) {
1065 case 1:
1066 rezID = PLAYER_NAME_RES_ID;
1067 strHnd = NewString(*(Str255 *) plName);
1068 break;
1069
1070 case 2:
1071 rezID = APP_NAME_RES_ID;
1072 strHnd = NewString(*(Str255 *) "\pNetHack");
1073 break;
1074 }
1075
1076 if (!strHnd) {
1077 note(noErr, alidNote, "\pOK: Minor \'STR \' resource error");
1078 CloseResFile(sRefNum);
1079 return 1;
1080 }
1081
1082 /* should check for errors... */
1083 AddResource((Handle) strHnd, 'STR ', rezID, *(Str255 *) "\p");
1084 }
1085
1086 memActivity++;
1087
1088 /* should check for errors... */
1089 CloseResFile(sRefNum);
1090 return 0;
1091}
1092
1093static void
1094set_levelfile_name(long lev)

Callers 1

continueRecoverFunction · 0.85

Calls 1

noteFunction · 0.85

Tested by

no test coverage detected