From: Holger Schemel Date: Mon, 19 Oct 2020 19:27:19 +0000 (+0200) Subject: added variable to improve readability X-Git-Tag: 4.2.1.0~29 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2a0aa9698a999f688e326d74810f3a365e64ee8f;p=rocksndiamonds.git added variable to improve readability --- diff --git a/src/screens.c b/src/screens.c index f2f385e8..3b9504bc 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4058,6 +4058,8 @@ static void getTypeNameValues(char *name, struct TextPosInfo *pos, int *xpos) static void setTypeNameValues(char *name, int *font, boolean success) { + TreeInfo *node = type_name_node; + if (!success) strcpy(name, type_name_last); @@ -4066,18 +4068,18 @@ static void setTypeNameValues(char *name, int *font, boolean success) if (setup.multiple_users) { - if (type_name_node == NULL) // should not happen + if (node == NULL) // should not happen return; if (success) { - type_name_node->color = FC_RED; + node->color = FC_RED; if (strEqual(name, EMPTY_PLAYER_NAME)) - type_name_node->color = FC_BLUE; + node->color = FC_BLUE; } - *font = FONT_TEXT_1 + type_name_node->color; + *font = FONT_TEXT_1 + node->color; } if (!success) @@ -4090,14 +4092,14 @@ static void setTypeNameValues(char *name, int *font, boolean success) if (setup.multiple_users) { - int edit_user_nr = posTreeInfo(type_name_node); + int edit_user_nr = posTreeInfo(node); // change name of edited user in global list of user names setString(&global.user_names[edit_user_nr], name); // change name of edited user in local menu tree structure - setString(&type_name_node->name, name); - setString(&type_name_node->name_sorting, name); + setString(&node->name, name); + setString(&node->name_sorting, name); // save setup of currently active user (may differ from edited user) SaveSetup();