Changes needed in various ports due to globals changes.

This commit is contained in:
Bart House
2018-12-24 14:47:51 -08:00
parent 62e1a45b60
commit e5e906dc3b
33 changed files with 112 additions and 112 deletions

View File

@@ -677,13 +677,13 @@ do_positionbar()
p = pbar;
/* up stairway */
if (upstair.sx
&& (glyph_to_cmap(level.locations[upstair.sx][upstair.sy].glyph)
if (g.upstair.sx
&& (glyph_to_cmap(level.locations[g.upstair.sx][g.upstair.sy].glyph)
== S_upstair
|| glyph_to_cmap(level.locations[upstair.sx][upstair.sy].glyph)
|| glyph_to_cmap(level.locations[g.upstair.sx][g.upstair.sy].glyph)
== S_upladder)) {
*p++ = '<';
*p++ = upstair.sx;
*p++ = g.upstair.sx;
}
if (g.sstairs.sx
&& (glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph)

View File

@@ -164,9 +164,9 @@ coord *startp;
* Arrive at an up or down stairwell if it is in line of sight from the
* hero.
*/
if (couldsee(upstair.sx, upstair.sy)) {
startp->x = upstair.sx;
startp->y = upstair.sy;
if (couldsee(g.upstair.sx, g.upstair.sy)) {
startp->x = g.upstair.sx;
startp->y = g.upstair.sy;
return TRUE;
}
if (couldsee(g.dnstair.sx, g.dnstair.sy)) {

View File

@@ -186,7 +186,7 @@ time_t when;
SetDrMd(rp, JAM1);
/* Put name on stone */
Sprintf(buf, "%s", plname);
Sprintf(buf, "%s", g.plname);
buf[STONE_LINE_LEN] = 0;
tomb_text(buf);

View File

@@ -420,10 +420,10 @@ amii_askname()
amii_getlin("Who are you?", plnametmp);
} while (strlen(plnametmp) == 0);
strncpy(plname, plnametmp, PL_NSIZ - 1); /* Avoid overflowing plname[] */
plname[PL_NSIZ - 1] = 0;
strncpy(g.plname, plnametmp, PL_NSIZ - 1); /* Avoid overflowing plname[] */
g.plname[PL_NSIZ - 1] = 0;
if (*plname == '\33') {
if (*g.plname == '\33') {
clearlocks();
exit_nhwindows(NULL);
nh_terminate(0);
@@ -457,9 +457,9 @@ amii_player_selection()
#if 0 /* Don't query the user ... instead give random character -jhsa */
#if 0 /* OBSOLETE */
if( *pl_character ){
pl_character[ 0 ] = toupper( pl_character[ 0 ] );
if( index( pl_classes, pl_character[ 0 ] ) )
if( *g.pl_character ){
g.pl_character[ 0 ] = toupper( g.pl_character[ 0 ] );
if( index( pl_classes, g.pl_character[ 0 ] ) )
return;
}
#endif
@@ -513,19 +513,19 @@ amii_player_selection()
case VANILLAKEY:
if( index( pl_classes, toupper( code ) ) )
{
pl_character[0] = toupper( code );
g.pl_character[0] = toupper( code );
aredone = 1;
}
else if( code == ' ' || code == '\n' || code == '\r' )
{
flags.initrole = randrole();
#if 0 /* OBSOLETE */
strcpy( pl_character, roles[ rnd( 11 ) ] );
strcpy( g.pl_character, roles[ rnd( 11 ) ] );
#endif
aredone = 1;
amii_clear_nhwindow( WIN_BASE );
CloseShWindow( cwin );
RandomWindow( pl_character );
RandomWindow( g.pl_character );
return;
}
else if( code == 'q' || code == 'Q' )
@@ -545,15 +545,15 @@ amii_player_selection()
case 1: /* Random Character */
flags.initrole = randrole();
#if 0 /* OBSOLETE */
strcpy( pl_character, roles[ rnd( 11 ) ] );
strcpy( g.pl_character, roles[ rnd( 11 ) ] );
#endif
amii_clear_nhwindow( WIN_BASE );
CloseShWindow( cwin );
RandomWindow( pl_character );
RandomWindow( g.pl_character );
return;
default:
pl_character[0] = gd->GadgetID;
g.pl_character[0] = gd->GadgetID;
break;
}
aredone = 1;

View File

@@ -348,7 +348,7 @@ menu_item **retmip;
nw->Screen = HackScreen;
if (win == WIN_INVEN) {
sprintf(title, "%s the %s's Inventory", plname, pl_character);
sprintf(title, "%s the %s's Inventory", g.plname, g.pl_character);
nw->Title = title;
if (lastinvent.MaxX != 0) {
nw->LeftEdge = lastinvent.MinX;

View File

@@ -132,14 +132,14 @@ whoami(void)
*/
char *s;
if (*plname)
if (*g.plname)
return;
if (s = nh_getenv("USER")) {
(void) strncpy(plname, s, sizeof(plname) - 1);
(void) strncpy(g.plname, s, sizeof(g.plname) - 1);
return;
}
if (s = nh_getenv("LOGNAME")) {
(void) strncpy(plname, s, sizeof(plname) - 1);
(void) strncpy(g.plname, s, sizeof(g.plname) - 1);
return;
}
}
@@ -177,11 +177,11 @@ process_options(int argc, char **argv)
#endif
case 'u':
if (argv[0][2])
(void) strncpy(plname, argv[0] + 2, sizeof(plname) - 1);
(void) strncpy(g.plname, argv[0] + 2, sizeof(g.plname) - 1);
else if (argc > 1) {
argc--;
argv++;
(void) strncpy(plname, argv[0], sizeof(plname) - 1);
(void) strncpy(g.plname, argv[0], sizeof(g.plname) - 1);
} else
raw_print("Player name expected after -u");
break;
@@ -236,7 +236,7 @@ getlock(void)
{
int fd;
Sprintf(lock, "%d%s", getuid(), plname);
Sprintf(lock, "%d%s", getuid(), g.plname);
regularize(lock);
set_levelfile_name(lock, 0);
fd = creat(lock, FCMASK);

View File

@@ -228,7 +228,7 @@ macopen(const char *name, int flags, long fileType)
Handle name;
Str255 plnamep;
C2P(plname, plnamep);
C2P(g.plname, plnamep);
name = (Handle)NewString(plnamep);
if (name)
replace_resource(name, 'STR ', PLAYER_NAME_RES_ID,

View File

@@ -225,7 +225,7 @@ process_openfile(short src_vol, long src_dir, Str255 fName, OSType ftype)
Handle name = Get1Resource('STR ', PLAYER_NAME_RES_ID);
if (name) {
Str255 save_f_p;
P2C(*(StringHandle) name, plname);
P2C(*(StringHandle) name, g.plname);
set_savefile_name(TRUE);
C2P(fqname(SAVEF, SAVEPREFIX, 0), save_f_p);
force_hdelete(theDirs.dataRefNum, theDirs.dataDirID,

View File

@@ -493,8 +493,8 @@ mac_askname()
SetPortDialogPort(askdialog);
/* Initialize the name text item */
ask_restring(plname, str);
if (plname[0]) {
ask_restring(g.plname, str);
if (g.plname[0]) {
GetDialogItem(askdialog, RSRC_ASK_NAME, &type, &handle, &rect);
SetDialogItemText(handle, str);
}
@@ -502,8 +502,8 @@ mac_askname()
{
Str32 pName;
pName [0] = 0;
if (plname && plname [0]) {
strcpy ((char *) pName, plname);
if (g.plname && g.plname [0]) {
strcpy ((char *) pName, g.plname);
c2pstr ((char *) pName);
} else {
Handle h;
@@ -548,7 +548,7 @@ mac_askname()
if (flags.initrole >= 0)
currrole = flags.initrole;
/* Check for backward compatibility */
else if ((currrole = str2role(pl_character)) < 0)
else if ((currrole = str2role(g.pl_character)) < 0)
currrole = randrole();
/* Initialize the race popup menu */
@@ -735,8 +735,8 @@ mac_askname()
GetDialogItemText(handle, str);
if (str[0] > PL_NSIZ - 1)
str[0] = PL_NSIZ - 1;
BlockMove(&str[1], plname, str[0]);
plname[str[0]] = '\0';
BlockMove(&str[1], g.plname, str[0]);
g.plname[str[0]] = '\0';
/* Destroy the dialog */
for (i = RSRC_ASK_ROLE; i <= RSRC_ASK_MODE; i++) {
@@ -758,14 +758,14 @@ mac_askname()
break;
case 2: /* Debug */
wizard = 1;
strcpy(plname, WIZARD_NAME);
strcpy(g.plname, WIZARD_NAME);
break;
default: /* Quit */
ExitToShell();
}
/* Process the role */
strcpy(pl_character, roles[currrole].name.m);
strcpy(g.pl_character, roles[currrole].name.m);
flags.initrole = currrole;
/* Process the race */

View File

@@ -24,7 +24,7 @@ getlock(void)
int fd;
int pid = getpid(); /* Process ID */
Sprintf(lock, "%d%s", getuid(), plname);
Sprintf(lock, "%d%s", getuid(), g.plname);
set_levelfile_name(lock, 0);
if ((fd = open(lock, O_RDWR | O_EXCL | O_CREAT, LEVL_TYPE)) == -1) {

View File

@@ -38,7 +38,7 @@ unsigned char shift;
{
boolean opening_dialog;
opening_dialog = pl_character[0] ? FALSE : TRUE;
opening_dialog = g.pl_character[0] ? FALSE : TRUE;
switch (scancode) {
#ifdef SIMULATE_CURSOR
case 0x3d: /* F3 = toggle cursor type */

View File

@@ -421,20 +421,20 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
* overwritten without confirmation when a user starts up
* another game with the same player name.
*/
Strcpy(lock, plname);
Strcpy(lock, g.plname);
regularize(lock);
getlock();
#else /* What follows is !PC_LOCKING */
#ifdef AMIGA /* We'll put the bones & levels in the user specified directory \
-jhsa */
Strcat(lock, plname);
Strcat(lock, g.plname);
Strcat(lock, ".99");
#else
#ifndef MFLOPPY
/* I'm not sure what, if anything, is left here, but MFLOPPY has
* conflicts with set_lock_and_bones() in files.c.
*/
Strcpy(lock, plname);
Strcpy(lock, g.plname);
Strcat(lock, ".99");
regularize(lock); /* is this necessary? */
/* not compatible with full path a la AMIGA */
@@ -565,11 +565,11 @@ char *argv[];
#endif
case 'u':
if (argv[0][2])
(void) strncpy(plname, argv[0] + 2, sizeof(plname) - 1);
(void) strncpy(g.plname, argv[0] + 2, sizeof(g.plname) - 1);
else if (argc > 1) {
argc--;
argv++;
(void) strncpy(plname, argv[0], sizeof(plname) - 1);
(void) strncpy(g.plname, argv[0], sizeof(g.plname) - 1);
} else
raw_print("Player name expected after -u");
break;
@@ -747,7 +747,7 @@ port_help()
boolean
authorize_wizard_mode()
{
if (!strcmp(plname, WIZARD_NAME))
if (!strcmp(g.plname, WIZARD_NAME))
return TRUE;
return FALSE;
}

View File

@@ -229,11 +229,11 @@ char *argv[];
* dash matches role, race, gender, or alignment.
*/
/* guard against user names with hyphens in them */
int len = (int) strlen(plname);
int len = (int) strlen(g.plname);
/* append the current role, if any, so that last dash is ours */
if (++len < (int) sizeof plname)
(void) strncat(strcat(plname, "-"), pl_character,
sizeof plname - len - 1);
if (++len < (int) sizeof g.plname)
(void) strncat(strcat(g.plname, "-"), g.pl_character,
sizeof g.plname - len - 1);
}
/* strip role,race,&c suffix; calls askname() if plname[] is empty
or holds a generic user name like "player" or "games" */
@@ -275,12 +275,12 @@ attempt_restore:
* clock, &c not currently in use in the playground directory
* (for locknum > 0).
*/
if (*plname) {
if (*g.plname) {
getlock();
program_state.preserve_locks = 0; /* after getlock() */
}
if (*plname && (fd = restore_saved_game()) >= 0) {
if (*g.plname && (fd = restore_saved_game()) >= 0) {
const char *fq_save = fqname(SAVEF, SAVEPREFIX, 1);
(void) chmod(fq_save, 0); /* disallow parallel restores */
@@ -311,7 +311,7 @@ attempt_restore:
}
if (!resuming) {
boolean neednewlock = (!*plname);
boolean neednewlock = (!*g.plname);
/* new game: start by choosing role, race, etc;
player might change the hero's name while doing that,
in which case we try to restore under the new name
@@ -320,7 +320,7 @@ attempt_restore:
if (!plsel_once)
player_selection();
plsel_once = TRUE;
if (neednewlock && *plname)
if (neednewlock && *g.plname)
goto attempt_restore;
if (iflags.renameinprogress) {
/* player has renamed the hero while selecting role;
@@ -388,11 +388,11 @@ char *argv[];
#endif
case 'u':
if (argv[0][2]) {
(void) strncpy(plname, argv[0] + 2, sizeof plname - 1);
(void) strncpy(g.plname, argv[0] + 2, sizeof g.plname - 1);
} else if (argc > 1) {
argc--;
argv++;
(void) strncpy(plname, argv[0], sizeof plname - 1);
(void) strncpy(g.plname, argv[0], sizeof g.plname - 1);
} else {
raw_print("Player name expected after -u");
}
@@ -540,7 +540,7 @@ whoami()
* Note that we trust the user here; it is possible to play under
* somebody else's name.
*/
if (!*plname) {
if (!*g.plname) {
register const char *s;
s = nh_getenv("USER");
@@ -550,8 +550,8 @@ whoami()
s = getlogin();
if (s && *s) {
(void) strncpy(plname, s, sizeof plname - 1);
if (index(plname, '-'))
(void) strncpy(g.plname, s, sizeof g.plname - 1);
if (index(g.plname, '-'))
return TRUE;
}
}
@@ -661,7 +661,7 @@ char *optstr;
if (!pw)
return FALSE;
if (sysopt.check_plname)
pwname = plname;
pwname = g.plname;
else
pwname = pw->pw_name;
pwlen = strlen(pwname);

View File

@@ -120,7 +120,7 @@ getlock()
'a','b',&c below; override the default and use <uid><charname>
if we aren't restricting the number of simultaneous games */
if (!locknum)
Sprintf(lock, "%u%s", (unsigned) getuid(), plname);
Sprintf(lock, "%u%s", (unsigned) getuid(), g.plname);
regularize(lock);
set_levelfile_name(lock, 0);

View File

@@ -257,11 +257,11 @@ char *argv[];
#endif
case 'u':
if (argv[0][2])
(void) strncpy(plname, argv[0] + 2, sizeof(plname) - 1);
(void) strncpy(g.plname, argv[0] + 2, sizeof(g.plname) - 1);
else if (argc > 1) {
argc--;
argv++;
(void) strncpy(plname, argv[0], sizeof(plname) - 1);
(void) strncpy(g.plname, argv[0], sizeof(g.plname) - 1);
} else
raw_print("Player name expected after -u");
break;
@@ -368,8 +368,8 @@ whoami()
*/
register char *s;
if (!*plname && (s = nh_getenv("USER")))
(void) lcase(strncpy(plname, s, sizeof(plname) - 1));
if (!*g.plname && (s = nh_getenv("USER")))
(void) lcase(strncpy(g.plname, s, sizeof(g.plname) - 1));
}
static void

View File

@@ -459,7 +459,7 @@ plselInitDialog(HWND hWnd)
TCHAR wbuf[BUFSZ];
/* set player name */
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(plname, wbuf, sizeof(wbuf)));
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(g.plname, wbuf, sizeof(wbuf)));
/* check flags for consistency */
if (flags.initrole >= 0) {

View File

@@ -826,7 +826,7 @@ mswin_layout_main_window(HWND changed_child)
/* show command window only if it exists and
the game is ready (plname is set) */
if (GetNHApp()->bCmdPad && cmd_size.cx > 0 && cmd_size.cy > 0
&& *plname) {
&& *g.plname) {
MoveWindow(GetNHApp()->hCmdWnd, cmd_org.x, cmd_org.y, cmd_size.cx,
cmd_size.cy, TRUE);
ShowWindow(GetNHApp()->hCmdWnd, SW_SHOW);

View File

@@ -182,7 +182,7 @@ FormatStatusString(char *text, int format)
int hp, hpmax;
int cap = near_capacity();
Strcpy(text, plname);
Strcpy(text, g.plname);
if ('a' <= text[0] && text[0] <= 'z')
text[0] += 'A' - 'a';
text[10] = 0;

View File

@@ -645,7 +645,7 @@ mswin_askname(void)
{
logDebug("mswin_askname()\n");
if (mswin_getlin_window("who are you?", plname, PL_NSIZ) == IDCANCEL) {
if (mswin_getlin_window("who are you?", g.plname, PL_NSIZ) == IDCANCEL) {
bail("bye-bye");
/* not reached */
}

View File

@@ -1011,9 +1011,9 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
QButtonGroup* namebox = new QButtonGroup(1,Horizontal,"Name",this);
QLineEdit* name = new QLineEdit(namebox);
name->setMaxLength(sizeof(plname)-1);
if ( strncmp(plname,"player",6) && strncmp(plname,"games",5) )
name->setText(plname);
name->setMaxLength(sizeof(g.plname)-1);
if ( strncmp(g.plname,"player",6) && strncmp(g.plname,"games",5) )
name->setText(g.plname);
connect(name, SIGNAL(textChanged(const QString&)),
this, SLOT(selectName(const QString&)) );
name->setFocus();
@@ -1169,7 +1169,7 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
void NetHackQtPlayerSelector::selectName(const QString& n)
{
strncpy(plname,n.latin1(),sizeof(plname)-1);
strncpy(g.plname,n.latin1(),sizeof(g.plname)-1);
}
void NetHackQtPlayerSelector::selectRole()
@@ -2529,7 +2529,7 @@ void NetHackQtStatusWindow::updateStats()
encumber.setLabel(enc);
encumber.show();
}
Strcpy(buf, plname);
Strcpy(buf, g.plname);
if ('a' <= buf[0] && buf[0] <= 'z') buf[0] += 'A'-'a';
Strcat(buf, " the ");
if (u.mtimedone) {
@@ -3302,7 +3302,7 @@ static char** rip_line=0;
long year;
/* Put name on stone */
Sprintf(rip_line[NAME_LINE], "%s", plname);
Sprintf(rip_line[NAME_LINE], "%s", g.plname);
/* Put $ on stone */
Sprintf(rip_line[GOLD_LINE], "%ld Au", done_money);
@@ -4621,7 +4621,7 @@ void NetHackQtBind::qt_askname()
NetHackQtSavedGameSelector sgsel((const char**)saved);
ch = sgsel.choose();
if ( ch >= 0 )
strcpy(plname,saved[ch]);
strcpy(g.plname,saved[ch]);
}
free_saved_games(saved);

View File

@@ -184,7 +184,7 @@ void NetHackQtBind::qt_askname()
NetHackQtSavedGameSelector sgsel((const char**)saved);
ch = sgsel.choose();
if ( ch >= 0 )
str_copy(plname, saved[ch], SIZE(plname));
str_copy(g.plname, saved[ch], SIZE(g.plname));
}
free_saved_games(saved);

View File

@@ -667,7 +667,7 @@ static char** rip_line=0;
int line;
/* Put name on stone */
snprintf(rip_line[NAME_LINE], STONE_LINE_LEN+1, "%s", plname);
snprintf(rip_line[NAME_LINE], STONE_LINE_LEN+1, "%s", g.plname);
/* Put $ on stone */
snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN+1, "%ld Au", money_cnt(invent));

View File

@@ -172,9 +172,9 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
QVBoxLayout *namelayout = new QVBoxLayout(namebox);
QLineEdit* name = new QLineEdit(namebox);
namelayout->addWidget(name);
name->setMaxLength(sizeof(plname)-1);
if ( strncmp(plname,"player",6) && strncmp(plname,"games",5) )
name->setText(plname);
name->setMaxLength(sizeof(g.plname)-1);
if ( strncmp(g.plname,"player",6) && strncmp(g.plname,"games",5) )
name->setText(g.plname);
connect(name, SIGNAL(textChanged(const QString&)),
this, SLOT(selectName(const QString&)) );
name->setFocus();
@@ -370,7 +370,7 @@ void NetHackQtPlayerSelector::Randomize()
void NetHackQtPlayerSelector::selectName(const QString& n)
{
str_copy(plname,n.toLatin1().constData(),SIZE(plname));
str_copy(g.plname,n.toLatin1().constData(),SIZE(g.plname));
}
void NetHackQtPlayerSelector::selectRole(int crow, int ccol, int prow, int pcol)

View File

@@ -434,7 +434,7 @@ void NetHackQtStatusWindow::updateStats()
buf = rank_of(u.ulevel, pl_character[0], ::flags.female);
}
QString buf2;
buf2.sprintf("%s the %s", plname, buf.toLatin1().constData());
buf2.sprintf("%s the %s", g.plname, buf.toLatin1().constData());
name.setLabel(buf2, NetHackQtLabelledIcon::NoNum, u.ulevel);
char buf3[BUFSZ];

View File

@@ -1713,7 +1713,7 @@ Cardinal *num_params;
nhUse(num_params);
nh_XtPopdown(w);
(void) strcpy(plname, "Mumbles"); /* give them a name... ;-) */
(void) strcpy(g.plname, "Mumbles"); /* give them a name... ;-) */
exit_x_event = TRUE;
}
@@ -1741,11 +1741,11 @@ XtPointer call_data;
}
/* Truncate name if necessary */
if (len >= sizeof plname - 1)
len = sizeof plname - 1;
if (len >= sizeof g.plname - 1)
len = sizeof g.plname - 1;
(void) strncpy(plname, s, len);
plname[len] = '\0';
(void) strncpy(g.plname, s, len);
g.plname[len] = '\0';
XtFree(s);
nh_XtPopdown(XtParent(dialog));
@@ -1778,7 +1778,7 @@ X11_askname()
(XtCallbackProc) 0);
SetDialogPrompt(dialog, nhStr("What is your name?")); /* set prompt */
SetDialogResponse(dialog, plname, PL_NSIZ); /* set default answer */
SetDialogResponse(dialog, g.plname, PL_NSIZ); /* set default answer */
XtRealizeWidget(popup);
positionpopup(popup, TRUE); /* center,bottom */

View File

@@ -358,11 +358,11 @@ plsel_dialog_acceptvalues()
XtSetArg(args[0], nhStr(XtNstring), &s);
XtGetValues(plsel_name_input, args, ONE);
(void) strncpy(plname, (char *) s, sizeof plname - 1);
plname[sizeof plname - 1] = '\0';
(void) mungspaces(plname);
if (strlen(plname) < 1)
(void) strcpy(plname, "Mumbles");
(void) strncpy(g.plname, (char *) s, sizeof g.plname - 1);
g.plname[sizeof g.plname - 1] = '\0';
(void) mungspaces(g.plname);
if (strlen(g.plname) < 1)
(void) strcpy(g.plname, "Mumbles");
iflags.renameinprogress = FALSE;
}
@@ -829,8 +829,8 @@ Widget form;
XtSetArg(args[num_args], nhStr(XtNeditType),
!plsel_ask_name ? XawtextRead : XawtextEdit); num_args++;
XtSetArg(args[num_args], nhStr(XtNresize), XawtextResizeWidth); num_args++;
XtSetArg(args[num_args], nhStr(XtNstring), plname); num_args++;
XtSetArg(args[num_args], XtNinsertPosition, strlen(plname)); num_args++;
XtSetArg(args[num_args], nhStr(XtNstring), g.plname); num_args++;
XtSetArg(args[num_args], XtNinsertPosition, strlen(g.plname)); num_args++;
XtSetArg(args[num_args], nhStr(XtNaccelerators),
XtParseAcceleratorTable(plsel_input_accelerators)); num_args++;
plsel_name_input = XtCreateManagedWidget("name_input",
@@ -1564,15 +1564,15 @@ void
X11_player_selection()
{
if (iflags.wc_player_selection == VIA_DIALOG) {
if (!*plname) {
if (!*g.plname) {
#ifdef UNIX
char *defplname = get_login_name();
#else
char *defplname = (char *)0;
#endif
(void) strncpy(plname, defplname ? defplname : "Mumbles",
sizeof plname - 1);
plname[sizeof plname - 1] = '\0';
(void) strncpy(g.plname, defplname ? defplname : "Mumbles",
sizeof g.plname - 1);
g.plname[sizeof g.plname - 1] = '\0';
iflags.renameinprogress = TRUE;
}
X11_player_selection_dialog();

View File

@@ -1060,7 +1060,7 @@ long new_value;
if (attr_rec->type == SV_LABEL) {
if (attr_rec == &shown_stats[F_NAME]) {
Strcpy(buf, plname);
Strcpy(buf, g.plname);
buf[0] = highc(buf[0]);
Strcat(buf, " the ");
if (Upolyd) {

View File

@@ -492,7 +492,7 @@ calculate_rip_text(int how, time_t when)
long year;
/* Put name on stone */
Sprintf(rip_line[NAME_LINE], "%s", plname);
Sprintf(rip_line[NAME_LINE], "%s", g.plname);
/* Put $ on stone */
Sprintf(rip_line[GOLD_LINE], "%ld Au", done_money);

View File

@@ -198,7 +198,7 @@ curses_player_selection()
void
curses_askname()
{
curses_line_input_dialog("Who are you?", plname, PL_NSIZ);
curses_line_input_dialog("Who are you?", g.plname, PL_NSIZ);
}

View File

@@ -1152,7 +1152,7 @@ draw_horizontal(int x, int y, int hp, int hpmax)
wmove(win, y, x);
get_playerrank(rank);
sprintf(buf, "%s the %s", plname, rank);
sprintf(buf, "%s the %s", g.plname, rank);
/* Use the title as HP bar (similar to hitpointbar) */
draw_bar(TRUE, hp, hpmax, buf);
@@ -1239,7 +1239,7 @@ draw_horizontal_new(int x, int y, int hp, int hpmax)
char race[BUFSZ];
Strcpy(race, urace.adj);
race[0] = highc(race[0]);
wprintw(win, "%s the %s %s%s%s", plname,
wprintw(win, "%s the %s %s%s%s", g.plname,
(u.ualign.type == A_CHAOTIC ? "Chaotic" :
u.ualign.type == A_NEUTRAL ? "Neutral" : "Lawful"),
Upolyd ? "" : race, Upolyd ? "" : " ",
@@ -1358,7 +1358,7 @@ draw_vertical(int x, int y, int hp, int hpmax)
get_playerrank(rank);
int ranklen = strlen(rank);
int namelen = strlen(plname);
int namelen = strlen(g.plname);
int maxlen = 19;
#ifdef STATUS_COLORS
if (!iflags.hitpointbar)
@@ -1375,7 +1375,7 @@ draw_vertical(int x, int y, int hp, int hpmax)
while ((ranklen + namelen) > maxlen)
ranklen--; /* Still doesn't fit, strip rank */
}
sprintf(buf, "%-*s the %-*s", namelen, plname, ranklen, rank);
sprintf(buf, "%-*s the %-*s", namelen, g.plname, ranklen, rank);
draw_bar(TRUE, hp, hpmax, buf);
wmove(win, y++, x);
wprintw(win, "%s", dungeons[u.uz.dnum].dname);

View File

@@ -499,7 +499,7 @@ Gem_player_selection()
void
Gem_askname()
{
strncpy(plname, mar_ask_name(), PL_NSIZ);
strncpy(g.plname, mar_ask_name(), PL_NSIZ);
}
void
@@ -1074,7 +1074,7 @@ time_t when;
}
/* Follows same algorithm as genl_outrip() */
/* Put name on stone */
Sprintf(rip_line[NAME_LINE], "%s", plname);
Sprintf(rip_line[NAME_LINE], "%s", g.plname);
/* Put $ on stone */
Sprintf(rip_line[GOLD_LINE], "%ld Au", done_money);
/* Put together death description */

View File

@@ -355,7 +355,7 @@ gnome_askname()
/* Ask for a name and stuff the response into plname, a nethack global */
ret = ghack_ask_string_dialog("What is your name?", "gandalf",
"GnomeHack", plname);
"GnomeHack", g.plname);
/* Quit if they want to quit... */
if (ret == -1) {
@@ -1169,7 +1169,7 @@ gnome_outrip(winid wid, int how, time_t when)
long year;
/* Put name on stone */
Sprintf(buf, "%s\n", plname);
Sprintf(buf, "%s\n", g.plname);
Strcat(ripString, buf);
/* Put $ on stone */

View File

@@ -440,7 +440,7 @@ ghack_status_window_update_stats()
long umoney;
/* First, fill in the player name and the dungeon level */
strcpy(buf, plname);
strcpy(buf, g.plname);
if ('a' <= buf[0] && buf[0] <= 'z')
buf[0] += 'A' - 'a';
strcat(buf, " the ");