small bugfix (lua_Process.cpp) and onTick rate slowed

Signed-off-by: Warmist <Warmist@gmail.com>
develop
Warmist 2011-07-28 04:08:57 +03:00
parent 0799cde3af
commit 6c2a822494
2 changed files with 10 additions and 10 deletions

@ -3,6 +3,7 @@
#include <dfhack/Export.h> #include <dfhack/Export.h>
#include <dfhack/PluginManager.h> #include <dfhack/PluginManager.h>
#include <dfhack/Process.h> #include <dfhack/Process.h>
#include "dfhack/extra/stopwatch.h"
#include <vector> #include <vector>
#include <string> #include <string>
@ -20,6 +21,7 @@ using std::string;
using namespace DFHack; using namespace DFHack;
static tthread::mutex* mymutex=0; static tthread::mutex* mymutex=0;
uint64_t timeLast=0;
DFhackCExport command_result dfusion (Core * c, vector <string> & parameters); DFhackCExport command_result dfusion (Core * c, vector <string> & parameters);
DFhackCExport command_result lua_run (Core * c, vector <string> & parameters); DFhackCExport command_result lua_run (Core * c, vector <string> & parameters);
@ -53,14 +55,11 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
DFhackCExport command_result plugin_onupdate ( Core * c ) DFhackCExport command_result plugin_onupdate ( Core * c )
{ {
/*if(timering == true) //TODO maybe reuse this to make it run less often. uint64_t time2 = GetTimeMs64();
{ uint64_t delta = time2-timeLast;
uint64_t time2 = GetTimeMs64(); if(delta<100)
uint64_t delta = time2-timeLast; return CR_OK;
timeLast = time2; timeLast = time2;
c->con.print("Time delta = %d ms\n", delta);
}
return CR_OK;*/
mymutex->lock(); mymutex->lock();
lua::state s=lua::glua::Get(); lua::state s=lua::glua::Get();
s.getglobal("OnTick"); s.getglobal("OnTick");
@ -89,6 +88,7 @@ void InterpreterLoop(Core* c)
con.lineedit(">>",curline); con.lineedit(">>",curline);
while (curline!="quit") { while (curline!="quit") {
con.history_add(curline);
try try
{ {
s.loadstring(curline); s.loadstring(curline);

@ -229,7 +229,7 @@ static int lua_Process_setPermisions(lua_State *S)
range.start=st.as<uint64_t>(); range.start=st.as<uint64_t>();
st.pop(); st.pop();
st.getfield("end",1); st.getfield("end",1);
range.start=st.as<uint64_t>(); range.end=st.as<uint64_t>();
st.pop(); st.pop();
st.getfield("read",2); st.getfield("read",2);