void read_segment( void *arg) { if(!Maps::IsValid()) { return; } static bool firstLoad = 1; ssConfig.threadstarted = 1; WorldSegment* segment = NULL; { CoreSuspender suspend; //read cursor if (ssConfig.follow_DFcursor) { Gui::getCursorCoords(ssState.dfCursor.x, ssState.dfCursor.y, ssState.dfCursor.z); ssState.dfSelection.x = df::global::selection_rect->start_x; ssState.dfSelection.y = df::global::selection_rect->start_y; ssState.dfSelection.z = df::global::selection_rect->start_z; } if (firstLoad || ssConfig.track_mode != GameConfiguration::TRACKING_NONE) { firstLoad = 0; if (ssConfig.track_mode == GameConfiguration::TRACKING_CENTER) { followCurrentDFCenter(); } else if (ssConfig.track_mode == GameConfiguration::TRACKING_WINDOW) { followCurrentDFWindow(); } else if (ssConfig.track_mode == GameConfiguration::TRACKING_FOCUS) { followCurrentDFFocus(); ssConfig.follow_DFcursor = true; } } segment = map_segment.getRead(); readMapSegment(segment, ssState); ssConfig.threadstarted = 0; } if(segment) { beautifySegment(segment); //putting these here to increase responsiveness of the UI and to make megashots work //segment->segState.Position = ssState.Position; //segment->segState.dfCursor = ssState.dfCursor; segment->AssembleAllTiles(); //only need to lock the drawing segment because the reading segment is already locked map_segment.lockDraw(); map_segment.swap(); map_segment.unlockDraw(); } }
void read_segment( void *arg) { if(!Maps::IsValid()) { return; } static bool firstLoad = 1; ssConfig.threadstarted = 1; WorldSegment* segment = NULL; { CoreSuspender suspend; if (firstLoad || ssConfig.follow_DFscreen) { firstLoad = 0; if (ssConfig.track_center) { FollowCurrentDFCenter(); } else { FollowCurrentDFWindow(); } } segment = map_segment.getRead(); readMapSegment(segment, parms.x, parms.y, parms.z,parms.sizex, parms.sizey, parms.sizez); ssConfig.threadstarted = 0; } if(segment) { beautifySegment(segment); //putting these here to increase responsiveness of the UI and to make megashots work segment->segState.DisplayedSegment = ssState.DisplayedSegment; segment->AssembleAllTiles(); //only need to lock the drawing segment because the reading segment is already locked map_segment.lockDraw(); map_segment.swap(); map_segment.unlockDraw(); } }