Changes needed in various ports due to globals changes.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 ");
|
||||
|
||||
Reference in New Issue
Block a user