void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const { if( !m_Pt_param || !aConfig ) return; EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT("NONE") ) ); if( itmp == UNSPECIFIED_COLOR ) itmp = m_Default; *m_Pt_param = itmp; }
void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); wxConfigPathChanger cpc( aCfg, m_configPath ); EDA_COLOR_T itmp = ColorByName( aCfg->Read( LIBVIEW_BGCOLOR, wxT( "WHITE" ) ) ); SetDrawBgColor( itmp ); aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 100 ); aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 100 ); // Set parameters to a reasonable value. if( m_libListWidth > m_FrameSize.x/2 ) m_libListWidth = m_FrameSize.x/2; if( m_cmpListWidth > m_FrameSize.x/2 ) m_cmpListWidth = m_FrameSize.x/2; }
/* * G_ClientUserInfoChanged */ void G_ClientUserInfoChanged(g_edict_t *ent, const char *user_info) { const char *s; char *c; char name[MAX_NET_NAME]; int player_num, i; boolean_t color; g_client_t *cl; // check for malformed or illegal info strings if (!ValidateUserInfo(user_info)) { user_info = "\\name\\newbie\\skin\\qforcer/enforcer"; } cl = ent->client; // set name, use a temp buffer to compute length and crutch up bad names s = GetUserInfo(user_info, "name"); strncpy(name, s, sizeof(name) - 1); name[sizeof(name) - 1] = 0; color = false; c = name; i = 0; // trim to 15 printable chars while (i < 15) { if (!*c) break; if (IS_COLOR(c)) { color = true; c += 2; continue; } c++; i++; } name[c - name] = 0; if (!i) // name had nothing printable strcpy(name, "newbie"); if (color) // reset to white strcat(name, "^7"); if (strncmp(cl->persistent.net_name, name, sizeof(cl->persistent.net_name))) { if (*cl->persistent.net_name != '\0') gi.BroadcastPrint(PRINT_MEDIUM, "%s changed name to %s\n", cl->persistent.net_name, name); strncpy(cl->persistent.net_name, name, sizeof(cl->persistent.net_name) - 1); cl->persistent.net_name[sizeof(cl->persistent.net_name) - 1] = 0; } #ifdef HAVE_MYSQL if(mysql != NULL) { // escape name for safe db insertions StripColor(cl->persistent.net_name, name); mysql_real_escape_string(mysql, name, cl->persistent.sql_name, sizeof(cl->persistent.sql_name)); } #endif // set skin if ((g_level.teams || g_level.ctf) && cl->persistent.team) // players must use team_skin to change s = cl->persistent.team->skin; else s = GetUserInfo(user_info, "skin"); if (*s != '\0') // something valid-ish was provided strncpy(cl->persistent.skin, s, sizeof(cl->persistent.skin) - 1); else { strcpy(cl->persistent.skin, "qforcer/enforcer"); cl->persistent.skin[sizeof(cl->persistent.skin) - 1] = 0; } // set color s = GetUserInfo(user_info, "color"); cl->persistent.color = ColorByName(s, 243); player_num = ent - g_game.edicts - 1; // combine name and skin into a config_string gi.ConfigString(CS_CLIENT_INFO + player_num, va("%s\\%s", cl->persistent.net_name, cl->persistent.skin)); // save off the user_info in case we want to check something later strncpy(ent->client->persistent.user_info, user_info, sizeof(ent->client->persistent.user_info) - 1); }