#include <include.h>Go to the source code of this file.
Defines | |
| #define | COINS_ARRAY_SIZE (int) (sizeof(coins) / sizeof(coins_struct)) |
Functions | |
| static void | shop_add_button (int x, int y, const char *text) |
| void | widget_show_shop (widgetdata *widget) |
| void | shop_open () |
| void | shop_buy_item () |
| void | initialize_shop (int shop_state) |
| void | clear_shop (int send_to_server) |
| void | shop_add_close_button (int x, int y) |
| int | shop_put_item (int x, int y) |
| void | shop_object_remove (sint32 tag) |
| int | check_shop_keys (SDL_KeyboardEvent *key) |
| char * | shop_show_input (char *text, struct _Font *font, int wlen, int append_underscore) |
| int | shop_price2int (char *text) |
| char * | shop_int2price (int value) |
Variables | |
| _shop_gui_struct * | shop_gui = NULL |
| coins_struct | coins [] |
Handles the player shop GUI code.
Definition in file player_shop.c.
| #define COINS_ARRAY_SIZE (int) (sizeof(coins) / sizeof(coins_struct)) |
Size of the coin types array
Definition at line 47 of file player_shop.c.
| int check_shop_keys | ( | SDL_KeyboardEvent * | key | ) |
Handle key presses if shop widget is open.
| key | SDL Keyboard event |
Definition at line 736 of file player_shop.c.
| void clear_shop | ( | int | send_to_server | ) |
Clear and deinitialize shop GUI.
| send_to_server | Whether to send a command to the server to free and close the shop. |
Definition at line 415 of file player_shop.c.
| void initialize_shop | ( | int | shop_state | ) |
Initialize the shop GUI.
| shop_state | Shop state. See shop state declarations for possible values. |
Definition at line 376 of file player_shop.c.
| static void shop_add_button | ( | int | x, | |
| int | y, | |||
| const char * | text | |||
| ) | [static] |
Add a button in the shop GUI.
| x | X position of the button | |
| y | Y position of the button | |
| text | Text of the button |
Definition at line 500 of file player_shop.c.
| void shop_add_close_button | ( | int | x, | |
| int | y | |||
| ) |
Add a close button.
| x | X position of the button | |
| y | Y position of the button |
Definition at line 455 of file player_shop.c.
| void shop_buy_item | ( | ) |
Buy a shop item.
Definition at line 331 of file player_shop.c.
| char* shop_int2price | ( | int | value | ) |
Does the reverse of shop_price2int().
| value | Integer value to parse |
Definition at line 1079 of file player_shop.c.
| void shop_object_remove | ( | sint32 | tag | ) |
Remove an item from the linked list of shop items.
| tag | Tag of the item to remove. |
Definition at line 688 of file player_shop.c.
| void shop_open | ( | ) |
Open the player shop.
Definition at line 275 of file player_shop.c.
| int shop_price2int | ( | char * | text | ) |
Parse a price string from the shop interface to an integer.
For example, the string
10 m 15 g 90 s 40 c
would become
100159040
| text | The string to parse |
Definition at line 1020 of file player_shop.c.
| int shop_put_item | ( | int | x, | |
| int | y | |||
| ) |
Put an item to the shop GUI. Called when dropping a dragged item.
| x | X position of the item | |
| y | Y position of the item |
Definition at line 573 of file player_shop.c.
| char* shop_show_input | ( | char * | text, | |
| struct _Font * | font, | |||
| int | wlen, | |||
| int | append_underscore | |||
| ) |
Show shop input text and calculate the maximum width the string can have so the text doesn't overflow the input area.
| text | The input text | |
| font | Font used to display the text | |
| wlen | Maximum width of the text | |
| append_underscore | Whether to append underscore at the end of the input text. |
Definition at line 957 of file player_shop.c.
| void widget_show_shop | ( | widgetdata * | widget | ) |
Show the shop GUI widget.
| x | X position of the widget | |
| y | Y position of the widget |
Definition at line 55 of file player_shop.c.
{
{"m", 10000000},
{"g", 10000},
{"s", 100},
{"c", 1},
}
Array of all possible coin types, including the coin value and name. Used by shop_int2price() and shop_price2int().
Definition at line 38 of file player_shop.c.
| _shop_gui_struct* shop_gui = NULL |
The shop GUI.
Definition at line 33 of file player_shop.c.
1.7.1