Removed thready argument to dfusion, replaced with init (just sets stuff up, running everything in non interactive mode)

develop
Warmist 2011-12-27 23:07:23 +02:00
parent 71e2321fef
commit 52a049cec3
1 changed files with 12 additions and 7 deletions

@ -56,7 +56,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
st.setglobal("WINDOWS"); st.setglobal("WINDOWS");
#endif #endif
commands.push_back(PluginCommand("dfusion","Init dfusion system. Use 'dfusion thready' to spawn a different thread.",dfusion)); commands.push_back(PluginCommand("dfusion","Init dfusion system. Use 'dfusion init' to run dfusion in init mode (not interactive).",dfusion));
commands.push_back(PluginCommand("lua", "Run interactive interpreter. Use 'lua <filename>' to run <filename> instead.",lua_run)); commands.push_back(PluginCommand("lua", "Run interactive interpreter. Use 'lua <filename>' to run <filename> instead.",lua_run));
mymutex=new tthread::mutex; mymutex=new tthread::mutex;
@ -174,13 +174,18 @@ void RunDfusion(void *p)
} }
DFhackCExport command_result dfusion (Core * c, vector <string> & parameters) DFhackCExport command_result dfusion (Core * c, vector <string> & parameters)
{ {
if(thread_dfusion==0) if(parameters[0]=="init")
thread_dfusion=new tthread::thread(RunDfusion,c);
if(parameters[0]!="thready")
{ {
thread_dfusion->join(); lua::state s=lua::glua::Get();
delete thread_dfusion; s.push(1);
thread_dfusion=0; s.setglobal("INIT");
}
else
{
lua::state s=lua::glua::Get();
s.push();
s.setglobal("INIT");
} }
RunDfusion(c);
return CR_OK; return CR_OK;
} }