43 #define NUM_OPT_FIELDS 6
44 #define RACE_OPT_START 0
45 #define CLASS_OPT_START NUM_OPT_FIELDS/2
46 #define RACE_OPT_END CLASS_OPT_START - 1
47 #define CLASS_OPT_ENG NUM_OPT_FIELDS - 1
68 #define STARTING_MAP_PANE 0
72 #define WINDOW_CREATE_CHARACTER 1
73 #define WINDOW_CHOOSE_MAP 2
154 int reset_needed = 0;
182 "Getting race & class information from the server");
208 int i, stat_points_used=0, statval, tmp;
215 tmp = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(
spinbutton_cc[i]));
216 stat_points_used += tmp;
223 tval = gtk_label_get_text(GTK_LABEL(
label_cs[i]));
224 statval += atoi(tval);
226 tval = gtk_label_get_text(GTK_LABEL(
label_rs[i]));
227 statval += atoi(tval);
237 snprintf(buf,
sizeof(buf),
"%d", statval);
238 gtk_label_set_text(GTK_LABEL(
label_tot[i]), buf);
242 snprintf(buf,
sizeof(buf),
"%d", tmp);
251 "You have used more than your allotted total attribute points");
254 "Attributes less than 1 are not allowed - adjust your selections before finishing");
265 const gchar *char_name;
266 int i, on_choice, tmp;
286 i = gtk_combo_box_get_active(GTK_COMBO_BOX(
combobox_rs));
301 snprintf(buf,
MAX_BUF,
"choice %s %s",
races[i].rc_choice[on_choice].choice_name,
302 races[i].rc_choice[on_choice].value_arch[j]);
310 i = gtk_combo_box_get_active(GTK_COMBO_BOX(
combobox_cs));
321 snprintf(buf,
MAX_BUF,
"choice %s %s",
classes[i].rc_choice[on_choice].choice_name,
322 classes[i].rc_choice[on_choice].value_arch[j]);
344 tmp = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(
spinbutton_cc[i]));
398 const gchar *char_name;
403 if (!char_name || char_name[0] == 0) {
405 "You must enter a character name");
415 tmp[i] = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(
spinbutton_cc[i]));
416 stat_points_used += tmp[i];
421 "You have used more than your allotted total attribute points");
431 "Attributes less than 1 are not allowed - adjust your selections before finishing");
448 GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
451 "You have not spent all your attribute points.",
452 "You will be unable to spend these later.",
453 "Create character anyways?");
454 result = gtk_dialog_run(GTK_DIALOG(dialog));
455 gtk_widget_destroy(dialog);
456 if (result == GTK_RESPONSE_NO) {
475 GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
477 "You must choose a starting map before you can start playing");
478 gtk_dialog_run(GTK_DIALOG(dialog));
479 gtk_widget_destroy(dialog);
503 "Sending new character information to server");
536 int active_entry, i, opt_start;
537 GtkWidget **label_stat;
541 active_entry = gtk_combo_box_get_active(box);
546 if (active_entry == -1) {
554 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(
textview_cs_desc)),
555 classes[active_entry].description,
556 strlen(
classes[active_entry].description));
565 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(
textview_rs_desc)),
566 races[active_entry].description,
567 strlen(
races[active_entry].description));
570 rc = &
races[active_entry];
574 LOG(
LOG_ERROR,
"gtk-v2/src/create_char.c:on_combobox_rcs_changed",
575 "Passed in combobox does not match any combobox");
585 LOG(
LOG_ERROR,
"gtk-v2/src/create_char.c:on_combobox_rcs_changed",
586 "Number of racial option exceeds allocated amount (%d > %d)",
591 store = gtk_combo_box_get_model(GTK_COMBO_BOX(
opt_combobox[i + opt_start]));
592 gtk_list_store_clear(GTK_LIST_STORE(store));
595 gtk_list_store_append(GTK_LIST_STORE(store), &iter);
598 gtk_combo_box_set_active(GTK_COMBO_BOX(
opt_combobox[i+opt_start]), 0);
600 gtk_label_set_text(GTK_LABEL(
opt_label[i + opt_start]),
611 gtk_widget_hide(
opt_label[i + opt_start]);
621 gtk_label_set_text(GTK_LABEL(label_stat[i]), buf);
638 GtkCellRenderer *renderer;
654 store = gtk_list_store_new(1, G_TYPE_STRING);
657 gtk_list_store_append(store, &iter);
658 gtk_list_store_set(store, &iter, 0,
races[i].public_name, -1);
661 gtk_combo_box_set_model(GTK_COMBO_BOX(
combobox_rs), GTK_TREE_MODEL(store));
662 gtk_cell_layout_clear(GTK_CELL_LAYOUT(
combobox_rs));
664 renderer = gtk_cell_renderer_text_new();
665 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(
combobox_rs), renderer, FALSE);
666 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(
combobox_rs), renderer,
669 g_signal_connect ((gpointer)
combobox_rs,
"changed",
672 gtk_combo_box_set_active(GTK_COMBO_BOX(
combobox_rs), 0);
674 store = gtk_list_store_new(1, G_TYPE_STRING);
677 gtk_list_store_append(store, &iter);
678 gtk_list_store_set(store, &iter, 0,
classes[i].public_name, -1);
682 gtk_combo_box_set_model(GTK_COMBO_BOX(
combobox_cs), GTK_TREE_MODEL(store));
683 gtk_cell_layout_clear(GTK_CELL_LAYOUT(
combobox_cs));
685 renderer = gtk_cell_renderer_text_new();
686 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(
combobox_cs), renderer, FALSE);
687 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(
combobox_cs), renderer,
689 g_signal_connect ((gpointer)
combobox_cs,
"changed",
691 gtk_combo_box_set_active(GTK_COMBO_BOX(
combobox_cs), 0);
732 active_entry = gtk_combo_box_get_active(box);
737 if (active_entry == -1) {
757 GtkCellRenderer *renderer;
761 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
764 gtk_list_store_append(store, &iter);
772 renderer = gtk_cell_renderer_text_new();
795 GtkCellRenderer *renderer;
817 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(
textview_rs_desc)),
819 gtk_text_buffer_add_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(
textview_rs_desc)),
824 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(
textview_cs_desc)),
826 gtk_text_buffer_add_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(
textview_cs_desc)),
830 snprintf(tmpbuf, 80,
"spinbutton_cc_%s",
stat_mapping[i].widget_suffix);
833 g_signal_connect ((gpointer)
spinbutton_cc[i],
"value-changed",
836 snprintf(tmpbuf, 80,
"label_rs_%s",
stat_mapping[i].widget_suffix);
839 snprintf(tmpbuf, 80,
"label_cs_%s",
stat_mapping[i].widget_suffix);
842 snprintf(tmpbuf, 80,
"label_tot_%s",
stat_mapping[i].widget_suffix);
850 snprintf(tmpbuf, 80,
"opt_label%d", i+1);
853 snprintf(tmpbuf, 80,
"opt_combobox%d", i+1);
856 gtk_cell_layout_clear(GTK_CELL_LAYOUT(
opt_combobox[i]));
857 renderer = gtk_cell_renderer_text_new();
858 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(
opt_combobox[i]), renderer, FALSE);
859 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(
opt_combobox[i]), renderer,
861 store = gtk_list_store_new(1, G_TYPE_STRING);
862 gtk_combo_box_set_model(GTK_COMBO_BOX(
opt_combobox[i]), GTK_TREE_MODEL(store));