projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed variable handling when typing name in main menu
[rocksndiamonds.git]
/
src
/
screens.c
diff --git
a/src/screens.c
b/src/screens.c
index 403e4247a0b33e878a9d956b36ad938238dc817f..24d440c7bb71e9c724be6a7282c61d8bb2a9711e 100644
(file)
--- a/
src/screens.c
+++ b/
src/screens.c
@@
-3980,6
+3980,7
@@
void HandleInfoScreen(int mx, int my, int dx, int dy, int button)
static void HandleTypeNameExt(boolean initialize, Key key)
{
static void HandleTypeNameExt(boolean initialize, Key key)
{
+ static char name[MAX_PLAYER_NAME_LEN + 1];
static char last_player_name[MAX_PLAYER_NAME_LEN + 1];
struct MainControlInfo *mci = getMainControlInfo(MAIN_CONTROL_NAME);
struct TextPosInfo *pos = mci->pos_input;
static char last_player_name[MAX_PLAYER_NAME_LEN + 1];
struct MainControlInfo *mci = getMainControlInfo(MAIN_CONTROL_NAME);
struct TextPosInfo *pos = mci->pos_input;
@@
-3997,16
+3998,17
@@
static void HandleTypeNameExt(boolean initialize, Key key)
if (initialize)
{
if (initialize)
{
- strcpy(last_player_name, setup.player_name);
+ strcpy(name, setup.player_name);
+ strcpy(last_player_name, name);
- xpos = strlen(
setup.player_
name);
+ xpos = strlen(name);
StartTextInput(sx, sy, pos->width, pos->height);
}
else if (is_valid_key_char && xpos < MAX_PLAYER_NAME_LEN)
{
StartTextInput(sx, sy, pos->width, pos->height);
}
else if (is_valid_key_char && xpos < MAX_PLAYER_NAME_LEN)
{
-
setup.player_
name[xpos] = key_char;
-
setup.player_
name[xpos + 1] = 0;
+ name[xpos] = key_char;
+ name[xpos + 1] = 0;
xpos++;
}
xpos++;
}
@@
-4014,37
+4016,39
@@
static void HandleTypeNameExt(boolean initialize, Key key)
{
xpos--;
{
xpos--;
-
setup.player_
name[xpos] = 0;
+ name[xpos] = 0;
}
else if (key == KSYM_Return && xpos > 0)
{
}
else if (key == KSYM_Return && xpos > 0)
{
+ strcpy(setup.player_name, name);
+
SaveSetup();
is_active = FALSE;
}
else if (key == KSYM_Escape)
{
SaveSetup();
is_active = FALSE;
}
else if (key == KSYM_Escape)
{
- strcpy(
setup.player_
name, last_player_name);
+ strcpy(name, last_player_name);
is_active = FALSE;
}
if (is_active)
{
is_active = FALSE;
}
if (is_active)
{
- pos->width = (strlen(
setup.player_
name) + 1) * font_width;
+ pos->width = (strlen(name) + 1) * font_width;
sx = mSX + ALIGNED_TEXT_XPOS(pos);
sx = mSX + ALIGNED_TEXT_XPOS(pos);
- DrawText(sx, sy,
setup.player_
name, font_active_nr);
+ DrawText(sx, sy, name, font_active_nr);
DrawText(sx + xpos * font_width, sy, "_", font_active_nr);
}
else
{
SetGameStatus(GAME_MODE_MAIN);
DrawText(sx + xpos * font_width, sy, "_", font_active_nr);
}
else
{
SetGameStatus(GAME_MODE_MAIN);
- pos->width = strlen(
setup.player_
name) * font_width;
+ pos->width = strlen(name) * font_width;
sx = mSX + ALIGNED_TEXT_XPOS(pos);
sx = mSX + ALIGNED_TEXT_XPOS(pos);
- DrawText(sx, sy,
setup.player_
name, font_nr);
+ DrawText(sx, sy, name, font_nr);
StopTextInput();
}
StopTextInput();
}