[Change] Bringing communication system inline with new toolkit changes.

This commit is contained in:
Allanis 2014-01-13 00:32:10 +00:00
parent b4c29d1157
commit 49bed575a5

View File

@ -17,9 +17,8 @@
#define BUTTON_HEIGHT 30 /*<< Button height. */ #define BUTTON_HEIGHT 30 /*<< Button height. */
static Pilot* comm_pilot = NULL; /**< Pilot currently talking to. */ static Pilot* comm_pilot = NULL; /**< Pilot currently talking to. */
static int comm_wid = 0; /**< Communication window ID. */
static void comm_close(char* str); static void comm_close(unsigned int wid, char* str);
/** /**
* @brief Open the communication dialogue with a pilot. * @brief Open the communication dialogue with a pilot.
@ -28,6 +27,7 @@ static void comm_close(char* str);
*/ */
int comm_open(unsigned int pilot) { int comm_open(unsigned int pilot) {
char buf[128]; char buf[128];
unsigned int wid;
/* Get the pilot. */ /* Get the pilot. */
comm_pilot = pilot_get(pilot); comm_pilot = pilot_get(pilot);
@ -36,19 +36,16 @@ int comm_open(unsigned int pilot) {
/* Create the window. */ /* Create the window. */
snprintf(buf, 128, "Comm - %s", comm_pilot->name); snprintf(buf, 128, "Comm - %s", comm_pilot->name);
comm_wid = window_create(buf, -1, -1, COMM_WIDTH, COMM_HEIGHT); wid = window_create(buf, -1, -1, COMM_WIDTH, COMM_HEIGHT);
window_addButton(comm_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, window_addButton(wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnClose", "Close Channel", comm_close); "btnClose", "Close Channel", comm_close);
return 0; return 0;
} }
static void comm_close(char* str) { static void comm_close(unsigned int wid, char* str) {
(void)str; (void)str;
if(comm_wid > 0) { window_destroy(wid);
window_destroy(comm_wid);
comm_wid = 0;
}
} }