--- dialogs.c.orig Wed Apr 10 08:21:20 2002 +++ dialogs.c Tue May 14 22:46:16 2002 @@ -115,6 +115,8 @@ static int city_style_ridx[64]; /* translation table the other way */ /* they in fact limit the num of styles to 64 */ static int b_s_num; /* number of basic city styles, i.e. those that you can start with */ +static int is_name_unique = 0; +static char unique_name[256]; static int is_showing_government_dialog; @@ -1865,6 +1867,10 @@ leader_strings = NULL; /* fill leader names combo box */ + if (is_name_unique) { + leader_strings = g_list_append(leader_strings, unique_name); + } + leaders = get_nation_leader_names( selected_nation, &leader_num); for( j=0; jentry), - leaders[selected_leader]); - - /* initialize leader sex */ - selected_sex = get_nation_leader_sex(selected_nation, - leaders[selected_leader]); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON( - races_sex_toggles[selected_sex?0:1]), TRUE); + if (!is_name_unique) { + selected_leader = myrand(leader_num); + gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(races_name)->entry), + leaders[selected_leader]); + + /* initialize leader sex */ + selected_sex = get_nation_leader_sex(selected_nation, + leaders[selected_leader]); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON( + races_sex_toggles[selected_sex?0:1]), TRUE); + } } /**************************************************************** @@ -2139,8 +2147,26 @@ **************************************************************************/ static void races_toggles_callback( GtkWidget *w, gpointer race_id_p ) { - selected_nation = GPOINTER_TO_INT(race_id_p); + char *current_name, **leaders; + int j, leader_num; + + /* checks if the player entered a unique name already */ + leaders = get_nation_leader_names( selected_nation, &leader_num); + current_name = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(races_name)->entry)); + for( j=0; j