Crossfire Client, Trunk
|
#include "client.h"
#include <gtk/gtk.h>
#include "image.h"
#include "main.h"
#include "metaserver.h"
#include "gtk2proto.h"
Go to the source code of this file.
Macros | |
#define | CLASS_OPT_ENG NUM_OPT_FIELDS - 1 |
#define | CLASS_OPT_START NUM_OPT_FIELDS/2 |
#define | NUM_OPT_FIELDS 6 |
#define | RACE_OPT_END CLASS_OPT_START - 1 |
#define | RACE_OPT_START 0 |
#define | STARTING_MAP_PANE 0 |
#define | WINDOW_CHOOSE_MAP 2 |
#define | WINDOW_CREATE_CHARACTER 1 |
#define | WINDOW_NONE 0 |
Functions | |
static int | character_data_ok () |
static void | create_character_set_sensitive (int sensitive) |
void | create_character_window_hide () |
void | create_character_window_show () |
void | init_create_character_window () |
void | new_char_window_update_info () |
void | on_button_cc_cancel (GtkButton *button, gpointer user_data) |
void | on_button_cc_done (GtkButton *button, gpointer user_data) |
void | on_button_choose_starting_map (GtkButton *button, gpointer user_data) |
void | on_button_csm_cancel (GtkButton *button, gpointer user_data) |
void | on_combobox_rcs_changed (GtkComboBox *box, gpointer user_data) |
void | on_combobox_starting_map_changed (GtkComboBox *box, gpointer user_data) |
void | on_spinbutton_cc (GtkSpinButton *spinbutton, gpointer user_data) |
static void | send_create_player_to_server () |
static void | show_window (int window) |
void | starting_map_update_info () |
static void | update_all_stats () |
Variables | |
static GtkWidget * | button_cc_cancel |
static GtkWidget * | button_choose_starting_map |
static GtkWidget * | button_csm_cancel |
static GtkWidget * | button_csm_done |
static GtkWidget * | choose_starting_map_window |
static GtkWidget * | combobox_cs |
static GtkWidget * | combobox_rs |
static GtkWidget * | combobox_starting_map |
Info_Pane | create_char_pane [1] |
static GtkWidget * | create_character_window |
static GtkWidget * | entry_new_character_name |
static int | has_init =0 |
static GtkWidget * | label_cc_desc |
static GtkWidget * | label_cc_status_update |
static GtkWidget * | label_cc_unspent |
static GtkWidget * | label_cs [NUM_NEW_CHAR_STATS] |
static GtkWidget * | label_rs [NUM_NEW_CHAR_STATS] |
static GtkWidget * | label_tot [NUM_NEW_CHAR_STATS] |
static int | negative_stat =0 |
static GtkWidget * | opt_combobox [NUM_OPT_FIELDS] |
static GtkWidget * | opt_label [NUM_OPT_FIELDS] |
static GtkWidget * | spinbutton_cc [NUM_NEW_CHAR_STATS] |
static GtkTextMark * | text_mark_cs |
static GtkTextMark * | text_mark_rs |
GtkTextBuffer * | textbuf_starting_map |
static GtkWidget * | textview_cs_desc |
static GtkWidget * | textview_rs_desc |
Handle new character creation
Definition in file create_char.c.
#define CLASS_OPT_ENG NUM_OPT_FIELDS - 1 |
Definition at line 47 of file create_char.c.
#define CLASS_OPT_START NUM_OPT_FIELDS/2 |
Definition at line 45 of file create_char.c.
#define NUM_OPT_FIELDS 6 |
Definition at line 43 of file create_char.c.
#define RACE_OPT_END CLASS_OPT_START - 1 |
Definition at line 46 of file create_char.c.
#define RACE_OPT_START 0 |
Definition at line 44 of file create_char.c.
#define STARTING_MAP_PANE 0 |
Definition at line 68 of file create_char.c.
#define WINDOW_CHOOSE_MAP 2 |
Definition at line 73 of file create_char.c.
#define WINDOW_CREATE_CHARACTER 1 |
Definition at line 72 of file create_char.c.
#define WINDOW_NONE 0 |
Definition at line 71 of file create_char.c.
|
static |
This checks the various spin buttons, combox boxes, etc to make sure everything that should be set has been set, and in the case of attributes, that they are within range. This will show/hide the relevant window and throw up dialog windows if necessary
Definition at line 396 of file create_char.c.
References choose_starting_map_window, combobox_starting_map, create_character_window, entry_new_character_name, label_cc_status_update, negative_stat, NUM_NEW_CHAR_STATS, show_window(), spinbutton_cc, starting_map_number, stat_points, WINDOW_CHOOSE_MAP, and WINDOW_CREATE_CHARACTER.
Referenced by on_button_cc_done().
|
static |
This function makes the widgets in the window sensitive (or not). This is used because having the player fiddle with the attributes before we get the information from the server doesn't make sense.
sensitive | passed to gtk_widget_set_sensitive, to either make the widget sensitive or not |
Definition at line 119 of file create_char.c.
References button_choose_starting_map, combobox_cs, combobox_rs, entry_new_character_name, NUM_NEW_CHAR_STATS, spinbutton_cc, and starting_map_number.
Referenced by create_character_window_show(), and new_char_window_update_info().
void create_character_window_hide | ( | ) |
Basically opposite as above - hide the create character windows - this is called from hide_all_login_windows(), which is called when the client gets an addme success command.
Definition at line 195 of file create_char.c.
References show_window(), and WINDOW_NONE.
Referenced by hide_all_login_windows().
void create_character_window_show | ( | ) |
This function is here so that other files, in particular account.c:on_button_create_character_clicked() can pop up this window. This function also requests necessary data from server if we don't already have it.
Definition at line 152 of file create_char.c.
References classes, create_character_set_sensitive(), create_character_window, cs_print_string(), csocket, ClientSocket::fd, label_cc_status_update, races, and stat_points.
Referenced by on_button_create_character_clicked().
void init_create_character_window | ( | ) |
Initializes the create character window.
Definition at line 791 of file create_char.c.
References add_style_to_textbuffer(), add_tags_to_textbuffer(), button_cc_cancel, button_choose_starting_map, button_csm_cancel, button_csm_done, choose_starting_map_window, combobox_cs, combobox_rs, combobox_starting_map, connect_window, create_char_pane, create_character_window, dialog_xml, entry_new_character_name, has_init, label_cc_desc, label_cc_status_update, label_cc_unspent, label_cs, label_rs, label_tot, NUM_NEW_CHAR_STATS, NUM_OPT_FIELDS, on_button_cc_cancel(), on_button_cc_done(), on_button_choose_starting_map(), on_button_csm_cancel(), on_spinbutton_cc(), opt_combobox, opt_label, spinbutton_cc, STARTING_MAP_PANE, stat_mapping, text_mark_cs, text_mark_rs, textbuf_starting_map, Info_Pane::textmark, Info_Pane::textview, textview_cs_desc, textview_rs_desc, and window_root.
Referenced by init_ui().
void new_char_window_update_info | ( | ) |
We have gotten some new information from the server, so we need to update the information - race/class choices or stat points/min stat/max stat information.
Definition at line 633 of file create_char.c.
References classes, combobox_cs, combobox_rs, create_character_set_sensitive(), label_cc_status_update, label_cc_unspent, num_classes, NUM_NEW_CHAR_STATS, num_races, on_combobox_rcs_changed(), races, spinbutton_cc, stat_maximum, stat_min, stat_points, used_classes, and used_races.
Referenced by get_class_info(), get_new_char_info(), and get_race_info().
void on_button_cc_cancel | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
User has hit the 'return to character selection' button - basically meaning that we have to hide the current window and show the choose_char_window.
button | ignored |
user_data | ignored |
Definition at line 365 of file create_char.c.
References choose_char_window_show(), show_window(), and WINDOW_NONE.
Referenced by init_create_character_window().
void on_button_cc_done | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
User has hit the done button. Need to verify input, and if it looks good, send it to the server. Note: This callback is used for the 'Done' button in both the character character window and starting map window.
button | ignored |
user_data | ignored |
Definition at line 496 of file create_char.c.
References character_data_ok(), label_cc_status_update, send_create_player_to_server(), show_main_client(), show_window(), and WINDOW_CREATE_CHARACTER.
Referenced by init_create_character_window().
void on_button_choose_starting_map | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
User has hit the choose starting map button. Not much to do, other than make that window visible
button | ignored |
user_data | ignored |
Definition at line 380 of file create_char.c.
References show_window(), and WINDOW_CHOOSE_MAP.
Referenced by init_create_character_window().
void on_button_csm_cancel | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
User has hit the 'return to character creation' button - basically meaning that we have to hide the current window and show the create_character_window.
button | ignored |
user_data | ignored |
Definition at line 721 of file create_char.c.
References show_window(), and WINDOW_CREATE_CHARACTER.
Referenced by init_create_character_window().
void on_combobox_rcs_changed | ( | GtkComboBox * | box, |
gpointer | user_data | ||
) |
User has changed one of the fields in the race/class combobox. Since the logic for the two is somewhat the same, we use one function to handle the event - as such, we really need to pay attention to what box is set to.
box | The combobox that generated the event. |
user_data | ignored |
Definition at line 534 of file create_char.c.
References RC_Choice::choice_desc, CLASS_OPT_START, classes, combobox_cs, combobox_rs, label_cs, label_rs, LOG(), LOG_ERROR, NUM_NEW_CHAR_STATS, NUM_OPT_FIELDS, Race_Class_Info::num_rc_choice, RC_Choice::num_values, opt_combobox, opt_label, RACE_OPT_START, races, Race_Class_Info::rc_choice, Stat_Mapping::rc_offset, Race_Class_Info::stat_adj, stat_mapping, text_mark_cs, text_mark_rs, textview_cs_desc, textview_rs_desc, update_all_stats(), and RC_Choice::value_desc.
Referenced by new_char_window_update_info().
void on_combobox_starting_map_changed | ( | GtkComboBox * | box, |
gpointer | user_data | ||
) |
Definition at line 728 of file create_char.c.
References add_marked_text_to_pane(), create_char_pane, starting_map_info, STARTING_MAP_PANE, and textbuf_starting_map.
Referenced by starting_map_update_info().
void on_spinbutton_cc | ( | GtkSpinButton * | spinbutton, |
gpointer | user_data | ||
) |
User has changed one of the spinbutton values. We need to total back up the values.
Definition at line 515 of file create_char.c.
References update_all_stats().
Referenced by init_create_character_window().
|
static |
Definition at line 263 of file create_char.c.
References account_password, CLASS_OPT_START, classes, combobox_cs, combobox_rs, combobox_starting_map, csocket, entry_new_character_name, ClientSocket::fd, keybindings_init(), MAX_BUF, NUM_NEW_CHAR_STATS, Race_Class_Info::num_rc_choice, opt_combobox, RACE_OPT_START, races, SockList_AddChar(), SockList_AddString(), SockList_Init(), SockList_Send(), spinbutton_cc, starting_map_info, starting_map_number, and stat_mapping.
Referenced by on_button_cc_done().
|
static |
This is a little helper window which shows the window specified and hides the other window(s). This is just a bit cleaner than having a bunch if gtk_widget_show()/ gtk_wdiget_hide() calls. Also, if more than 2 windows are ever used, this will also make it easier to make sure the correct window is displayed.
window | WINDOW_... define as listed at top of this file which defines the winow. Special is WINDOW_NONE, which will just result in this hiding all windows. |
Definition at line 88 of file create_char.c.
References choose_starting_map_window, create_character_window, WINDOW_CHOOSE_MAP, WINDOW_CREATE_CHARACTER, and WINDOW_NONE.
Referenced by character_data_ok(), create_character_window_hide(), on_button_cc_cancel(), on_button_cc_done(), on_button_choose_starting_map(), and on_button_csm_cancel().
void starting_map_update_info | ( | ) |
We have gotten starting map information from the server - now update the combo boxes.
Definition at line 753 of file create_char.c.
References button_choose_starting_map, combobox_starting_map, on_combobox_starting_map_changed(), starting_map_info, and starting_map_number.
Referenced by get_starting_map_info().
|
static |
Whenever something in the window changes, this is called to update everything - in the case of most any value, we need to recalculate everything - trying to do a delta from the old to new is probably more effort than it is worth and is more prone to errors.
Definition at line 206 of file create_char.c.
References label_cc_status_update, label_cc_unspent, label_cs, label_rs, label_tot, MAX_BUF, negative_stat, NUM_NEW_CHAR_STATS, spinbutton_cc, and stat_points.
Referenced by on_combobox_rcs_changed(), and on_spinbutton_cc().
|
static |
Definition at line 54 of file create_char.c.
Referenced by init_create_character_window().
|
static |
Definition at line 55 of file create_char.c.
Referenced by create_character_set_sensitive(), init_create_character_window(), and starting_map_update_info().
|
static |
Definition at line 62 of file create_char.c.
Referenced by init_create_character_window().
|
static |
Definition at line 62 of file create_char.c.
Referenced by init_create_character_window().
|
static |
Definition at line 61 of file create_char.c.
Referenced by character_data_ok(), init_create_character_window(), and show_window().
|
static |
Definition at line 55 of file create_char.c.
Referenced by create_character_set_sensitive(), init_create_character_window(), new_char_window_update_info(), on_combobox_rcs_changed(), and send_create_player_to_server().
|
static |
Definition at line 54 of file create_char.c.
Referenced by create_character_set_sensitive(), init_create_character_window(), new_char_window_update_info(), on_combobox_rcs_changed(), and send_create_player_to_server().
|
static |
Definition at line 62 of file create_char.c.
Referenced by character_data_ok(), init_create_character_window(), send_create_player_to_server(), and starting_map_update_info().
Info_Pane create_char_pane[1] |
Definition at line 69 of file create_char.c.
Referenced by init_create_character_window(), and on_combobox_starting_map_changed().
|
static |
Definition at line 54 of file create_char.c.
Referenced by character_data_ok(), create_character_window_show(), init_create_character_window(), and show_window().
|
static |
Definition at line 55 of file create_char.c.
Referenced by character_data_ok(), create_character_set_sensitive(), init_create_character_window(), and send_create_player_to_server().
|
static |
Definition at line 66 of file create_char.c.
Referenced by init_create_character_window().
|
static |
Definition at line 53 of file create_char.c.
Referenced by init_create_character_window().
|
static |
Definition at line 53 of file create_char.c.
Referenced by character_data_ok(), create_character_window_show(), init_create_character_window(), new_char_window_update_info(), on_button_cc_done(), and update_all_stats().
|
static |
Definition at line 53 of file create_char.c.
Referenced by init_create_character_window(), new_char_window_update_info(), and update_all_stats().
|
static |
Definition at line 52 of file create_char.c.
Referenced by init_create_character_window(), on_combobox_rcs_changed(), and update_all_stats().
|
static |
Definition at line 51 of file create_char.c.
Referenced by init_create_character_window(), on_combobox_rcs_changed(), and update_all_stats().
|
static |
Definition at line 52 of file create_char.c.
Referenced by init_create_character_window(), and update_all_stats().
|
static |
Definition at line 66 of file create_char.c.
Referenced by character_data_ok(), and update_all_stats().
|
static |
Definition at line 56 of file create_char.c.
Referenced by init_create_character_window(), on_combobox_rcs_changed(), and send_create_player_to_server().
|
static |
Definition at line 56 of file create_char.c.
Referenced by init_create_character_window(), and on_combobox_rcs_changed().
|
static |
Definition at line 51 of file create_char.c.
Referenced by character_data_ok(), create_character_set_sensitive(), init_create_character_window(), new_char_window_update_info(), send_create_player_to_server(), and update_all_stats().
|
static |
Definition at line 58 of file create_char.c.
Referenced by init_create_character_window(), and on_combobox_rcs_changed().
|
static |
Definition at line 58 of file create_char.c.
Referenced by init_create_character_window(), and on_combobox_rcs_changed().
GtkTextBuffer* textbuf_starting_map |
Definition at line 64 of file create_char.c.
Referenced by init_create_character_window(), and on_combobox_starting_map_changed().
|
static |
Definition at line 55 of file create_char.c.
Referenced by init_create_character_window(), and on_combobox_rcs_changed().
|
static |
Definition at line 53 of file create_char.c.
Referenced by init_create_character_window(), and on_combobox_rcs_changed().