aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/love/love.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/love/love.c61
1 files changed, 10 insertions, 51 deletions
diff --git a/src/love/love.c b/src/love/love.c
index e30c292..5fe3c84 100644
--- a/src/love/love.c
+++ b/src/love/love.c
@@ -372,7 +372,7 @@ static Eina_Bool _addClient(void *data, int type, Ecore_Con_Event_Client_Add *ev
372 372
373static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *ev) 373static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *ev)
374{ 374{
375// gameGlobals *ourGlobals = data; 375 gameGlobals *ourGlobals = data;
376// char buf[PATH_MAX]; 376// char buf[PATH_MAX];
377 char SID[PATH_MAX]; 377 char SID[PATH_MAX];
378 const char *command; 378 const char *command;
@@ -393,63 +393,22 @@ static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *
393 ext[0] = '\0'; 393 ext[0] = '\0';
394 command = ext + 1; 394 command = ext + 1;
395 395
396#if 0 // Replace this with code to parse what viewers send. 396 if (0 == strncmp(command, "events.touch_start(", 19))
397 if (0 == strncmp(command, "compile(", 8))
398 {
399 char *temp;
400 char *file;
401
402 strcpy(buf, &command[8]);
403 temp = buf;
404 file = temp;
405 while (')' != temp[0])
406 temp++;
407 temp[0] = '\0';
408
409 PD("Compiling %s, %s.", SID, file);
410 if (compileLSL(ourGlobals, ev->client, SID, file, FALSE))
411 {
412 script *me = calloc(1, sizeof(script));
413
414 gettimeofday(&me->startTime, NULL);
415 strncpy(me->SID, SID, sizeof(me->SID));
416 strncpy(me->fileName, file, sizeof(me->fileName));
417 me->game = ourGlobals;
418 me->client = ev->client;
419 eina_hash_add(ourGlobals->scripts, me->SID, me);
420 eina_hash_add(ourGlobals->names, me->fileName, me);
421 sendBack(ev->client, SID, "compiled(true)");
422 }
423 else
424 sendBack(ev->client, SID, "compiled(false)");
425 }
426 else if (0 == strcmp(command, "run()"))
427 { 397 {
398 Eina_Iterator *scripts;
428 script *me; 399 script *me;
429 char buf[PATH_MAX];
430 400
431 me = eina_hash_find(ourGlobals->scripts, SID); 401 // TODO - For now, just send it to everyone.
432 if (me) 402 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
403 while(eina_iterator_next(scripts, (void **) &me))
433 { 404 {
434 sprintf(buf, "%s.lua.out", me->fileName); 405 sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedKeys({\"%s\"})", ownerKey);
435 newProc(buf, TRUE, me); 406 sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName);
407 sendForth(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)");
436 } 408 }
437 } 409 }
438 else if (0 == strcmp(command, "exit()"))
439 {
440 PD("Told to exit.");
441 ecore_main_loop_quit();
442 }
443 else 410 else
444 { 411 PW("Unknown command from client - %s", command);
445 const char *status = NULL;
446
447 status = sendToChannel(ourGlobals, SID, command);
448 if (status)
449 PE("Error sending command %s to script %s : %s", command, SID, status);
450 }
451#endif
452
453 } 412 }
454 413
455 // Get the next blob to check it. 414 // Get the next blob to check it.