int RunLengthMakeFirtLine(PointerArray ptarray,pItemArray pita , int len , int * poslist,pKColSet pclmnset) { int i =0 ,tag=1; DBtype type ; void * ulist=NULL; pItem ilist =NULL; //compress len-column data parallel for( i = 0 ; i < len ; i++ ) { poslist[i]=0 ; //becase it is first line // null value if(pita[i][0].len==0) { pnArray nlist = NULL ; nlist = (pnArray)pclmnset->kcolarray[i]->pdata ; if(nlist==NULL) { debug("pdata is null"); return ERR; } set_null_list(nlist ,0 ); //mark the null position nlist=NULL ; continue ; } type = ptarray[i].type; tag = (i==len-1)?0:1; ulist= ptarray[i].pt.p; ilist= pita[i]; SetUnit(ulist,0,ilist,0,0,tag,type); poslist[i]++ ; ulist=NULL; ilist=NULL; } return OK ; }
void Kill(Unit *unit) { Player *owner = GetPlayerFromColor(GetUnitColor(*unit)); DelUnit(owner, unit); SetUnit(GetGrid(GetLocation(*unit)), 0); DestroyUnit(unit); SetUpkeep(owner, GetUpkeep(*owner) - 1); }
void InfoWidget::SetDrawInfo(Draw *draw) { DrawInfo *info = draw->GetDrawInfo(); if (info == NULL) return; SetUnit(info->GetUnit()); SetColor(info->GetDrawColor()); SetPrec(info->GetPrec()); SetPeriod(draw->GetPeriod()); }
CpuTemperature::CpuTemperature(uint8_t nSensor): RDMSensor(nSensor) { SetType(E120_SENS_TEMPERATURE); SetUnit(E120_UNITS_CENTIGRADE); SetPrefix(E120_PREFIX_NONE); SetRangeMin(RDM_SENSOR_TEMPERATURE_ABS_ZERO); SetRangeMax(RDM_SENSOR_RANGE_MAX); SetNormalMin(RDM_SENSOR_TEMPERATURE_ABS_ZERO); SetNormalMax((int16_t) Hardware::Get()->GetCoreTemperatureMax()); SetDescription("CPU"); }
SensorSI7021Humidity::SensorSI7021Humidity(uint8_t nSensor, uint8_t nAddress): RDMSensor(nSensor) { SetType(E120_SENS_HUMIDITY); SetUnit(E120_UNITS_NONE); SetPrefix(E120_PREFIX_NONE); SetRangeMin(0); SetRangeMax(100); SetNormalMin(RDM_SENSOR_RANGE_MIN); SetNormalMax(RDM_SENSOR_RANGE_MAX); SetDescription("Relative Humidity"); memset(&sDeviceInfo, 0, sizeof(struct _device_info)); sDeviceInfo.slave_address = nAddress; }
int RunLengthMakeUpdateRest(PointerArray ptarray,pItemArray pita , int cols , int * poslist ,int row,pKColSet pclmnset) { int next=0 , tag =0 ,i = 0 ,clen=0,id=0; void * ulist=NULL; pItem ilist =NULL; DBtype type; for( i = 0 ; i < cols ; i++ ) { if(pita[i][row].len==0) { pnArray nlist=NULL ; nlist = (pnArray)pclmnset->kcolarray[i]->pdata; if(ERR == set_null_list(nlist,row) ) { debug("error: set null list "); return ERR; } nlist=NULL ; } else if(0==isNeedNewUnit(row, pita[i])) { id = poslist[i] ; if(i<cols-1) { clen = pclmnset->kcolarray[i+1]->len; #if 1 next = poslist[i+1]-1; next = (next>=clen-1)?clen:next; if(next<0) next=0; #else next = ((poslist[i+1]-1) >= clen-1) ? (clen-1): (poslist[i+1]-1); #endif tag = 1; } else { next = 0; tag = 0; } ulist = ptarray[i].pt.p; ilist = pita[i]; type = ilist[0].type; SetUnit(ulist,id,ilist,row,next,tag,type); poslist[i]++ ; ulist=NULL; ilist=NULL; id =-1; } } return OK ; }
void PagePumpTrans::InitTransModel(int nType,CString strUnit,int nCurModel) { m_nType = nType; m_strUnit = strUnit; m_nTransModel = nCurModel; if(m_nType == 0) { InitDataCmb(Pump::ms_TransModel2,8,m_cmbTransModel,m_nTransModel); m_dlgNoInerialTrans.SetType(None,_T("转速"));//泵曲线(离心泵) } else { InitDataCmb(Pump::ms_TransModel1,2,m_cmbTransModel,m_nTransModel); m_dlgNoInerialTrans.SetType(None,FlowString());//指定流量(溶剂泵)变速泵 } CombineDlg(m_nTransModel); SetUnit(strUnit); }
UnitContainer::UnitContainer( Unit *un ) : unit( NULL ) { SetUnit( un ); VSCONSTRUCT1( 'U' ); }