Moved decl.c globals into instance globals.

This commit is contained in:
Bart House
2018-12-22 18:44:22 -08:00
parent 6c0df43a17
commit 74edf42f1c
83 changed files with 818 additions and 824 deletions

View File

@@ -890,7 +890,7 @@ makepicks:
Sprintf(plbuf, " %s", genders[GEND].adj);
else
*plbuf = '\0'; /* omit redundant gender */
Sprintf(pbuf, "%s, %s%s %s %s", plname, aligns[ALGN].adj, plbuf,
Sprintf(pbuf, "%s, %s%s %s %s", g.plname, aligns[ALGN].adj, plbuf,
races[RACE].adj,
(GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f
: roles[ROLE].name.m);
@@ -940,8 +940,8 @@ makepicks:
GEND, ALGN; we'll override that and honor only the name */
saveROLE = ROLE, saveRACE = RACE, saveGEND = GEND,
saveALGN = ALGN;
*plname = '\0';
plnamesuffix(); /* calls askname() when plname[] is empty */
*g.plname = '\0';
plnamesuffix(); /* calls askname() when g.plname[] is empty */
ROLE = saveROLE, RACE = saveRACE, GEND = saveGEND,
ALGN = saveALGN;
break; /* getconfirmation is still True */
@@ -1167,7 +1167,7 @@ int role, race, gend;
}
/*
* plname is filled either by an option (-u Player or -uPlayer) or
* g.plname is filled either by an option (-u Player or -uPlayer) or
* explicitly (by being the wizard) or by askname.
* It may still contain a suffix denoting the role, etc.
* Always called after init_nhwindows() and before display_gamewindows().
@@ -1187,7 +1187,7 @@ tty_askname()
case 0:
break; /* no game chosen; start new game */
case 1:
return; /* plname[] has been set */
return; /* g.plname[] has been set */
}
#endif /* SELECTSAVED */
@@ -1250,7 +1250,7 @@ tty_askname()
!(c >= '0' && c <= '9' && ct > 0))
c = '_';
#endif
if (ct < (int) (sizeof plname) - 1) {
if (ct < (int) (sizeof g.plname) - 1) {
#if defined(MICRO)
#if defined(MSDOS)
if (iflags.grmode) {
@@ -1261,13 +1261,13 @@ tty_askname()
#else
(void) putchar(c);
#endif
plname[ct++] = c;
g.plname[ct++] = c;
#ifdef WIN32CON
ttyDisplay->curx++;
#endif
}
}
plname[ct] = 0;
g.plname[ct] = 0;
} while (ct == 0);
/* move to next line to simulate echo of user's <return> */

View File

@@ -556,7 +556,7 @@ plselInitDialog(HWND hWnd)
Button_SetCheck(data->control_aligns[0], BST_CHECKED);
/* 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)));
plselRandomize(data);

View File

@@ -682,7 +682,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 */
}
@@ -1894,12 +1894,12 @@ mswin_outrip(winid wid, int how, time_t when)
}
/* Put name on stone */
Sprintf(buf, "%s", plname);
Sprintf(buf, "%s", g.plname);
buf[STONE_LINE_LEN] = 0;
putstr(wid, 0, buf);
/* Put $ on stone */
Sprintf(buf, "%ld Au", done_money);
Sprintf(buf, "%ld Au", g.done_money);
buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */
putstr(wid, 0, buf);

View File

@@ -216,19 +216,19 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
if (argc == 2) {
TCHAR *savefile = strdup(argv[1]);
TCHAR *plname;
TCHAR *name;
for (p = savefile; *p && *p != '-'; p++)
;
if (*p) {
/* we found a '-' */
plname = p + 1;
for (p = plname; *p && *p != '.'; p++)
name = p + 1;
for (p = name; *p && *p != '.'; p++)
;
if (*p) {
if (strcmp(p + 1, "NetHack-saved-game") == 0) {
*p = '\0';
argv[1] = "-u";
argv[2] = _strdup(plname);
argv[2] = _strdup(name);
argc = 3;
}
}