// insert one job into the queue void datacloud::insertjob(int col,int row,const unsigned char *mapfile,int hlod,const unsigned char *texfile,int tlod,const unsigned char *fogfile,BOOLINT immediate,BOOLINT loprio) { double time; jobqueueelem *oldjob,*newjob; // check for already existing job oldjob=checkjob(col,row,mapfile,hlod,texfile,tlod,fogfile,immediate,loprio); // reset access time if (oldjob!=NULL) { time=gettime(); if (mapfile!=NULL) oldjob->hfield->access=time; if (texfile!=NULL) oldjob->texture->access=time; if (fogfile!=NULL) oldjob->fogmap->access=time; return; } // create new job newjob=new jobqueueelem; newjob->col=col; newjob->row=row; // schedule height field if (mapfile!=NULL) newjob->hfield=inserttile(mapfile,col,row,FALSE,immediate,loprio,hlod); else newjob->hfield=NULL; newjob->hlod=hlod; // schedule texture map if (texfile!=NULL) newjob->texture=inserttile(texfile,col,row,TRUE,immediate,loprio,tlod); else newjob->texture=NULL; newjob->tlod=tlod; // schedule fog field if (fogfile!=NULL) newjob->fogmap=inserttile(fogfile,col,row,FALSE,immediate,loprio,0); else newjob->fogmap=NULL; newjob->loprio=loprio; // insert job into job queue if (immediate) insertjob(NULL,newjob); // insert immediate job at head else insertjob(JOBQUEUETAIL,newjob); // insert job at tail }
// insert one job into the queue void datacloud::insertjob(int col,int row,unsigned char *mapfile,int hlod,unsigned char *texfile,int tlod,unsigned char *fogfile,BOOLINT immediate,BOOLINT loprio) { // check for already existing job if (checkjob(mapfile,texfile,fogfile,immediate,loprio)) return; jobqueueelem *newjob=new jobqueueelem; newjob->col=col; newjob->row=row; // schedule height field if (mapfile!=NULL) newjob->hfield=inserttile(mapfile,col,row,FALSE,immediate,loprio); else newjob->hfield=NULL; newjob->hlod=hlod; // schedule texture map if (texfile!=NULL) newjob->texture=inserttile(texfile,col,row,TRUE,immediate,loprio); else newjob->texture=NULL; newjob->tlod=tlod; // schedule fog field if (fogfile!=NULL) newjob->fogmap=inserttile(fogfile,col,row,FALSE,immediate,loprio); else newjob->fogmap=NULL; newjob->loprio=loprio; // insert immediate job at begin if (immediate) insertjob(NULL,newjob); // insert hi prio job before lo prio jobs else if (!loprio) { jobqueueelem *job=JOBQUEUETAIL; // scan past lo prio jobs in reverse order while (job!=NULL) { if (!job->loprio) break; job=job->prev; } // insert after last hi prio job insertjob(job,newjob); } // insert lo prio job at end else insertjob(JOBQUEUETAIL,newjob); }