diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index 1af05f176..1691cbb22 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -121,7 +121,7 @@ void lightingEngineViewscreen::reinit() ocupancy.resize(size); lights.resize(size); } -void plotCircle(int xm, int ym, int r,std::function setPixel) +void plotCircle(int xm, int ym, int r,const std::function& setPixel) { int x = -r, y = 0, err = 2-2*r; /* II. Quadrant */ do { @@ -134,7 +134,7 @@ void plotCircle(int xm, int ym, int r,std::function setPixel) if (r > x || err > y) err += ++x*2+1; /* e_xy+e_x > 0 or no 2nd y-step */ } while (x < 0); } -void plotSquare(int xm, int ym, int r,std::function setPixel) +void plotSquare(int xm, int ym, int r,const std::function& setPixel) { for(int x = 0; x <= r; x++) { @@ -148,7 +148,7 @@ void plotSquare(int xm, int ym, int r,std::function setPixel) setPixel(xm-x, ym+r); /* IV.2 Quadrant */ } } -void plotLine(int x0, int y0, int x1, int y1,rgbf power,std::function setPixel) +void plotLine(int x0, int y0, int x1, int y1,rgbf power,const std::function& setPixel) { int dx = abs(x1-x0), sx = x0 setPixelAA) +void plotLineAA(int x0, int y0, int x1, int y1,rgbf power,const std::function& setPixelAA) { int dx = abs(x1-x0), sx = x0lightGrid.size()) { reinit(); - myRenderer->invalidate(); + myRenderer->invalidate();//needs a lock? } rect2d vp=getMapViewport(); const rgbf dim(levelDim,levelDim,levelDim); diff --git a/plugins/rendermax/rendermax.cpp b/plugins/rendermax/rendermax.cpp index 8cfe463bd..b5a5618a6 100644 --- a/plugins/rendermax/rendermax.cpp +++ b/plugins/rendermax/rendermax.cpp @@ -292,6 +292,8 @@ static void enable_hooks(bool enable) DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) { + if(current_mode!=MODE_LIGHT) + return CR_OK; switch(event) { case SC_VIEWSCREEN_CHANGED: @@ -403,8 +405,7 @@ static command_result rendermax(color_ostream &out, vector & parameters { if(parameters[1]=="reload") { - CoreSuspender suspend; - engine->loadSettings(); + enable_hooks(true); } else if(parameters[1]=="sun" && parameters.size()==3) {