diff options
author | David Walter Seikel | 2014-05-14 14:33:50 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-14 14:33:50 +1000 |
commit | d06706b346854cd73631aeb6297418ff82cabdf9 (patch) | |
tree | 1628f237c47b833c1f4e1e59dd5d8d5944256950 /src/LuaSL/LuaSL_main.c | |
parent | Display LSL script names instead of lengthy paths and UUIDs. (diff) | |
download | SledjHamr-d06706b346854cd73631aeb6297418ff82cabdf9.zip SledjHamr-d06706b346854cd73631aeb6297418ff82cabdf9.tar.gz SledjHamr-d06706b346854cd73631aeb6297418ff82cabdf9.tar.bz2 SledjHamr-d06706b346854cd73631aeb6297418ff82cabdf9.tar.xz |
Actually implement LSL script resetting, and some associated fixes.
Diffstat (limited to '')
-rw-r--r-- | src/LuaSL/LuaSL_main.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 33b15c6..cb2726e 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c | |||
@@ -45,10 +45,27 @@ static script *findThem(gameGlobals *ourGlobals, const char *base, const char *t | |||
45 | 45 | ||
46 | static void resetScript(script *victim) | 46 | static void resetScript(script *victim) |
47 | { | 47 | { |
48 | // gameGlobals *ourGlobals = victim->game; | 48 | gameGlobals *ourGlobals = victim->game; |
49 | 49 | script *me; | |
50 | PD("Resetting %s", victim->fileName); | 50 | char buf[PATH_MAX]; |
51 | // TODO - now what? | 51 | |
52 | PD("RESETTING %s", victim->name); | ||
53 | sendToChannel(ourGlobals, victim->SID, "quit()"); | ||
54 | eina_hash_del(ourGlobals->scripts, victim->SID, NULL); | ||
55 | eina_hash_del(ourGlobals->names, victim->fileName, NULL); | ||
56 | |||
57 | // The old one will eventually die, create a new one. | ||
58 | me = calloc(1, sizeof(script)); | ||
59 | gettimeofday(&me->startTime, NULL); | ||
60 | strncpy(me->SID, victim->SID, sizeof(me->SID)); | ||
61 | strncpy(me->fileName, victim->fileName, sizeof(me->fileName)); | ||
62 | me->name = &me->fileName[sizeof(PACKAGE_DATA_DIR)]; | ||
63 | me->game = ourGlobals; | ||
64 | me->client = victim->client; | ||
65 | eina_hash_add(ourGlobals->scripts, me->SID, me); | ||
66 | eina_hash_add(ourGlobals->names, me->fileName, me); | ||
67 | sprintf(buf, "%s.lua.out", me->fileName); | ||
68 | newProc(buf, TRUE, me); | ||
52 | } | 69 | } |
53 | 70 | ||
54 | void scriptSendBack(void * data) | 71 | void scriptSendBack(void * data) |