private void OnClickPreloadMap(object sender, EventArgs e) { if (PreloadWorker.IsBusy) { return; } ProgressBar.Minimum = 0; ProgressBar.Maximum = (currmap.Width >> 3) * (currmap.Height >> 3); ProgressBar.Step = 1; ProgressBar.Value = 0; ProgressBar.Visible = true; PreloadWorker.RunWorkerAsync(new Object[] { currmap, showStaticsToolStripMenuItem1.Checked }); }
private void PreLoadDoWork(object sender, DoWorkEventArgs e) { //Ultima.Map workmap = (Ultima.Map)((object[])e.Argument)[0]; // TODO: unused variable? bool statics = (bool)((object[])e.Argument)[1]; int width = _currMap.Width >> 3; int height = _currMap.Height >> 3; for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { _currMap.PreloadRenderedBlock(x, y, statics); PreloadWorker.ReportProgress(1); } } }