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

Function mac_askname

outdated/sys/mac/macmenu.c:476–781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474}
475
476void
477mac_askname()
478{
479 GrafPtr oldport;
480 DialogRef askdialog;
481 short i, j, item, type;
482 Handle handle;
483 Rect rect;
484 Str255 str;
485 Point pt;
486 UserItemUPP redraw = NewUserItemUPP(ask_redraw);
487 ModalFilterUPP filter = NewModalFilterUPP(ask_filter);
488
489 /* Create the dialog */
490 if (!(askdialog = GetNewDialog(RSRC_ASK, NULL, (WindowRef) -1)))
491 noresource('DLOG', RSRC_ASK);
492 GetPort(&oldport);
493 SetPortDialogPort(askdialog);
494
495 /* Initialize the name text item */
496 ask_restring(svp.plname, str);
497 if (svp.plname[0]) {
498 GetDialogItem(askdialog, RSRC_ASK_NAME, &type, &handle, &rect);
499 SetDialogItemText(handle, str);
500 }
501#if 0
502 {
503 Str32 pName;
504 pName [0] = 0;
505 if (svp.plname && svp.plname [0]) {
506 strcpy ((char *) pName, svp.plname);
507 c2pstr ((char *) pName);
508 } else {
509 Handle h;
510 h = GetResource ('STR ', -16096);
511 if (((Handle) 0 != h) && (GetHandleSize (h) > 0)) {
512 DetachResource (h);
513 HLock (h);
514 if (**h > 31) {
515 **h = 31;
516 }
517 BlockMove (*h, pName, **h + 1);
518 DisposeHandle (h);
519 }
520 }
521 if (pName [0]) {
522 GetDialogItem(askdialog, RSRC_ASK_NAME, &type, &handle, &rect);
523 SetDialogItemText(handle, pName);
524 if (pName [0] > 2 && pName [pName [0] - 1] == '-') {
525 short role = (*pANR).anMenu[anRole];
526 char suffix = (char) pName[pName[0]],
527 *sfxindx = strchr(pl_classes, suffix);
528
529 if (sfxindx)
530 role = (short) (sfxindx - pl_classes);
531 else if (suffix == '@')
532 role = (short) rn2((int) strlen(pl_classes));
533 (*pANR).anMenu[anRole] = role;

Callers

nothing calls this directly

Calls 12

ask_restringFunction · 0.85
rn2Function · 0.85
str2roleFunction · 0.85
randroleFunction · 0.85
randraceFunction · 0.85
randgendFunction · 0.85
randalignFunction · 0.85
ask_enableFunction · 0.85
validraceFunction · 0.85
validgendFunction · 0.85
validalignFunction · 0.85
NewMenuClass · 0.50

Tested by

no test coverage detected