From 67b60f58289b0556f0a05177513089b8c8903a45 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 11 Feb 2012 21:53:40 +1000 Subject: LuaSL now sends information back to the clients. --- LuaSL/src/LuaSL_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'LuaSL/src/LuaSL_main.c') diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c index 0aaf3c5..e209023 100644 --- a/LuaSL/src/LuaSL_main.c +++ b/LuaSL/src/LuaSL_main.c @@ -5,6 +5,14 @@ static int CPUs = 4; static Eina_Strbuf *clientStream; +static void sendBack(gameGlobals *game, Ecore_Con_Client *client, const char *SID, const char *message) +{ + char buf[PATH_MAX]; + + sprintf(buf, "%s.%s\n", SID, message); + ecore_con_client_send(client, buf, strlen(buf)); + ecore_con_client_flush(client); +} static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) { @@ -35,10 +43,11 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D command = ext + 1; if (0 == strcmp(command, "compile()")) { + PD("Compiling %s.", SID); if (compileLSL(game, SID, FALSE)) - PD("The compile of %s worked.", SID); + sendBack(game, ev->client, SID, "compiled(true)"); else - PE("The compile of %s failed!", SID); + sendBack(game, ev->client, SID, "compiled(false)"); } else if (0 == strcmp(command, "start()")) { @@ -57,7 +66,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D snprintf(temp, sizeof(temp), "%s.events", SID); status = sendToChannel(temp, command, NULL, NULL); if (status) - PE("Error sending command %s to script %s : %s", command, temp, status); + PE("Error sending command %s to script %s : %s", command, SID, status); } } -- cgit v1.1