aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-11 21:55:11 +1000
committerDavid Walter Seikel2012-02-11 21:55:11 +1000
commit85f531b985079da4f3e7b23567286451e541053e (patch)
tree76bba0010f01d53b6b362a100f6ed7b936df4e7c /LuaSL/src
parentLuaSL now sends information back to the clients. (diff)
downloadSledjHamr-85f531b985079da4f3e7b23567286451e541053e.zip
SledjHamr-85f531b985079da4f3e7b23567286451e541053e.tar.gz
SledjHamr-85f531b985079da4f3e7b23567286451e541053e.tar.bz2
SledjHamr-85f531b985079da4f3e7b23567286451e541053e.tar.xz
Cleaner quitting (letting the loop actually run), and clean up unused function.
Diffstat (limited to 'LuaSL/src')
-rw-r--r--LuaSL/src/LuaSL_test.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/LuaSL/src/LuaSL_test.c b/LuaSL/src/LuaSL_test.c
index 8faa041..c93b8d8 100644
--- a/LuaSL/src/LuaSL_test.c
+++ b/LuaSL/src/LuaSL_test.c
@@ -91,18 +91,26 @@ static void dirList_compile(const char *name, const char *path, void *data)
91 common_dirList(game, name, path, ".lsl", "compile"); 91 common_dirList(game, name, path, ".lsl", "compile");
92} 92}
93 93
94static void dirList_run(const char *name, const char *path, void *data) 94static void dirList_quit(const char *name, const char *path, void *data)
95{ 95{
96 gameGlobals *game = data; 96 gameGlobals *game = data;
97 97
98 common_dirList(game, name, path, ".out", "start"); 98 common_dirList(game, name, path, ".out", "quit");
99} 99}
100 100
101static void dirList_quit(const char *name, const char *path, void *data) 101static Eina_Bool _quit_timer_cb(void *data)
102{ 102{
103 gameGlobals *game = data; 103 gameGlobals *game = data;
104 char buf[PATH_MAX];
104 105
105 common_dirList(game, name, path, ".out", "quit"); 106 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR);
107 eina_file_dir_list(buf, EINA_TRUE, dirList_quit, game);
108
109 ecore_con_server_send(game->server, ".exit()\n", 8);
110 ecore_con_server_flush(game->server);
111 ecore_main_loop_quit();
112
113 return ECORE_CALLBACK_CANCEL;
106} 114}
107 115
108static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) 116static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev)
@@ -113,15 +121,8 @@ static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Ad
113 game->server = ev->server; 121 game->server = ev->server;
114 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); 122 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR);
115 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game); 123 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game);
116 eina_file_dir_list(buf, EINA_TRUE, dirList_run, game);
117 // Wait awhile, then quit all scripts we started, for testing. 124 // Wait awhile, then quit all scripts we started, for testing.
118 sleep(2); 125 ecore_timer_add(2.0, _quit_timer_cb, game);
119 eina_file_dir_list(buf, EINA_TRUE, dirList_quit, game);
120
121 ecore_con_server_send(game->server, ".exit()\n", 8);
122 ecore_con_server_flush(game->server);
123 ecore_main_loop_quit();
124
125 return ECORE_CALLBACK_RENEW; 126 return ECORE_CALLBACK_RENEW;
126} 127}
127 128