Hi,
I notice that dunelegacy lags quite badly on my modern x230t thinkpad running OpenBSD, but only when fog of war is enabled and when I am zoomed right out.
A friend and I did some experimentation and found that the lines of code which caused the lag are (in the fog loop in Game.cpp):
SDL_Surface** hiddenSurf = pGFXManager->getObjPic(ObjPic_Terrain_Hidden);
and
SDL_UnlockSurface(hiddenSurf[currentZoomlevel]);
Assuming that hiddenSurf does not change in all iterations of the fog loop, we can move the allocation, lock and unlocking of hiddenSurf outside the fog loop to remove the lag. The attached patch does exactly this and it appears to work. The question now is, is it correct?
Cheers!
Anyone?
The patch was not 100% correct as the surface was also used for blitting inside the loop which is not possible when being locked. But I included your idea of moving the locking outside the inner loop.