From 49bed575a51efd7c1a08aed9a014adfe83bd7127 Mon Sep 17 00:00:00 2001 From: Allanis Date: Mon, 13 Jan 2014 00:32:10 +0000 Subject: [PATCH] [Change] Bringing communication system inline with new toolkit changes. --- src/comm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/comm.c b/src/comm.c index 9a6ba11..239c6b9 100644 --- a/src/comm.c +++ b/src/comm.c @@ -17,9 +17,8 @@ #define BUTTON_HEIGHT 30 /*<< Button height. */ 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. @@ -28,6 +27,7 @@ static void comm_close(char* str); */ int comm_open(unsigned int pilot) { char buf[128]; + unsigned int wid; /* Get the pilot. */ comm_pilot = pilot_get(pilot); @@ -36,19 +36,16 @@ int comm_open(unsigned int pilot) { /* Create the window. */ 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); return 0; } -static void comm_close(char* str) { +static void comm_close(unsigned int wid, char* str) { (void)str; - if(comm_wid > 0) { - window_destroy(comm_wid); - comm_wid = 0; - } + window_destroy(wid); }