Atrinik Client  4.0
Enumerations | Functions | Variables
characters.c File Reference
#include <global.h>
#include <toolkit/packet.h>
#include <toolkit/string.h>
#include <toolkit/datetime.h>

Go to the source code of this file.

Enumerations

enum  {
  TEXT_INPUT_CHARNAME, TEXT_INPUT_PASSWORD, TEXT_INPUT_PASSWORD_NEW, TEXT_INPUT_PASSWORD_NEW2,
  TEXT_INPUT_NUM
}
 

Functions

static void button_tab_switch (button_struct *button)
 
static int text_input_character_check (text_input_struct *text_input, char c)
 
static void list_text_color (list_struct *list, uint32_t row, uint32_t col, const char **color, const char **color_shadow)
 
static void list_post_column (list_struct *list, uint32_t row, uint32_t col)
 
static int text_anchor_handle (const char *anchor_action, const char *buf, size_t len, void *custom_data)
 
static void list_handle_enter (list_struct *list, SDL_Event *event)
 
static int popup_draw (popup_struct *popup)
 
static int popup_event (popup_struct *popup, SDL_Event *event)
 
static int popup_destroy_callback (popup_struct *popup)
 
void characters_open (void)
 
static int archname_to_character (const char *archname, size_t *race, size_t *gender)
 
void socket_command_characters (uint8_t *data, size_t len, size_t pos)
 

Variables

static progress_dots progress
 
static button_struct button_tab_characters
 
static button_struct button_tab_new
 
static button_struct button_tab_password
 
static button_struct button_character_male
 
static button_struct button_character_female
 
static button_struct button_character_left
 
static button_struct button_character_right
 
static button_struct button_login
 
static button_struct button_done
 
static text_input_struct text_inputs [TEXT_INPUT_NUM]
 
static list_structlist_characters
 
static size_t text_input_current
 
static size_t character_race
 
static size_t character_gender
 

Detailed Description

Implements the characters chooser.

Author
Alex Tokar

Definition in file characters.c.

Function Documentation

static int archname_to_character ( const char *  archname,
size_t *  race,
size_t *  gender 
)
static

Resolves an archname to race ID and gender ID, using the information in s_settings.

Parameters
archnameArchname.
[out]raceWill contain race ID.
[out]genderWill contain gender ID.
Returns
1 on success, 0 on failure.

Definition at line 569 of file characters.c.

static void button_tab_switch ( button_struct button)
static

Switch to the specified tab in the characters GUI.

Parameters
buttonThe button tab to switch to.

Definition at line 80 of file characters.c.

void characters_open ( void  )

Open the characters chooser popup.

Definition at line 501 of file characters.c.

static void list_handle_enter ( list_struct list,
SDL_Event *  event 
)
static

Function to handle enter key being pressed on a selected row, or a row being double clicked.

Parameters
listList.
EventEvent that triggered this.

Definition at line 190 of file characters.c.

static void list_post_column ( list_struct list,
uint32_t  row,
uint32_t  col 
)
static

Callback function to call after drawing one column in a list.

Parameters
listThe list.
rowThe row of the column that was drawn.
colThe column.

Definition at line 131 of file characters.c.

static void list_text_color ( list_struct list,
uint32_t  row,
uint32_t  col,
const char **  color,
const char **  color_shadow 
)
static

Hook to use for setting text color based on row/column.

Parameters
listList.
rowText row.
colColumn.
[out]colorWhat color to use.
[out]color_shadowWhat color to use for the text's shadow, NULL to disable shadow.

Definition at line 122 of file characters.c.

static int popup_destroy_callback ( popup_struct popup)
static

Function used right before the visible popup is destroyed using popup_destroy_visible().

Parameters
popupThe popup.
Returns
1 to proceed with the destruction of the popup, 0 otherwise.

Definition at line 473 of file characters.c.

static int popup_draw ( popup_struct popup)
static

Function used for drawing on the popup's surface.

Parameters
popupThe popup.
Returns
0 to destroy the popup, 1 otherwise.

Definition at line 203 of file characters.c.

static int popup_event ( popup_struct popup,
SDL_Event *  event 
)
static

Function used for handling mouse/key events when popup is visible.

Parameters
eventSDL event.
Return values
-1Did not handle the event.
0Did not handle the event, but allow other keyboard events.
1Handled the event.

Definition at line 322 of file characters.c.

void socket_command_characters ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 583 of file characters.c.

static int text_anchor_handle ( const char *  anchor_action,
const char *  buf,
size_t  len,
void *  custom_data 
)
static

Anchor handler function to try and execute before the defaults.

Parameters
anchor_actionThe action to execute, which can be empty (but not NULL) - for example, 'help'.
bufText to pass to the action decided by the anchor action; in case of links, the URL to open, for example. Will not contain any markup, and should not be freed.
lenLength of 'buf'.
custom_dataUser-supplied data. Can be NULL.
Returns
1 if handled the action and should not handle it using default actions, 0 otherwise.

Definition at line 171 of file characters.c.

static int text_input_character_check ( text_input_struct text_input,
char  c 
)
static

Definition at line 110 of file characters.c.

Variable Documentation

button_struct button_tab_characters
static

Button buffer.

Definition at line 53 of file characters.c.

size_t character_gender
static

Which gender is selected in the character creation tab.

Definition at line 73 of file characters.c.

size_t character_race
static

Which character race is selected in the character creation tab.

Definition at line 69 of file characters.c.

list_struct* list_characters
static

Characters list.

Definition at line 61 of file characters.c.

progress_dots progress
static

Progress dots buffer.

Definition at line 49 of file characters.c.

size_t text_input_current
static

Currently selected text input.

Definition at line 65 of file characters.c.

text_input_struct text_inputs[TEXT_INPUT_NUM]
static

Text input buffers.

Definition at line 57 of file characters.c.