void TMoverParameters::UpdatePantVolume(double dt) { // KURS90 - sprê¿arka pantografów; Ra 2014-07: teraz jest to zbiornik rozrz¹du, chocia¿ to jeszcze // nie tak if (EnginePowerSource.SourceType == CurrentCollector) // tylko jeœli pantografuj¹cy { // Ra 2014-07: zasadniczo, to istnieje zbiornik rozrz¹du i zbiornik pantografów - na razie // mamy razem // Ra 2014-07: kurek trójdrogowy ³¹czy spr.pom. z pantografami i wy³¹cznikiem ciœnieniowym // WS // Ra 2014-07: zbiornika rozrz¹du nie pompuje siê tu, tylko pantografy; potem mo¿na zamkn¹æ // WS i odpaliæ resztê if ((TrainType == dt_EZT) ? (PantPress < ScndPipePress) : bPantKurek3) // kurek zamyka po³¹czenie z ZG { // zbiornik pantografu po³¹czony ze zbiornikiem g³ównym - ma³¹ sprê¿ark¹ siê tego nie // napompuje // Ra 2013-12: Niebugoc³aw mówi, ¿e w EZT nie ma potrzeby odcinaæ kurkiem PantPress = EnginePowerSource.CollectorParameters .MaxPress; // ograniczenie ciœnienia do MaxPress (tylko w pantografach!) if (PantPress > ScndPipePress) PantPress = ScndPipePress; // oraz do ScndPipePress PantVolume = (PantPress + 1) * 0.1; // objêtoœæ, na wypadek odciêcia kurkiem } else { // zbiornik g³ówny odciêty, mo¿na pompowaæ pantografy if (PantCompFlag && Battery) // w³¹czona bateria i ma³a sprê¿arka PantVolume += dt * (TrainType == dt_EZT ? 0.003 : 0.005) * (2 * 0.45 - ((0.1 / PantVolume / 10) - 0.1)) / 0.45; // nape³nianie zbiornika pantografów // Ra 2013-12: Niebugoc³aw mówi, ¿e w EZT nabija 1.5 raz wolniej ni¿ jak by³o 0.005 PantPress = (10.0 * PantVolume) - 1.0; // tu by siê przyda³a objêtoœæ zbiornika } if (!PantCompFlag && (PantVolume > 0.1)) PantVolume -= dt * 0.0003; // nieszczelnoœci: 0.0003=0.3l/s if (Mains) // nie wchodziæ w funkcjê bez potrzeby if (EngineType == ElectricSeriesMotor) // nie dotyczy... czego w³aœciwie? if (PantPress < EnginePowerSource.CollectorParameters.MinPress) if ((TrainType & (dt_EZT | dt_ET40 | dt_ET41 | dt_ET42)) ? (GetTrainsetVoltage() < EnginePowerSource.CollectorParameters.MinV) : true) // to jest trochê proteza; zasilanie cz³onu mo¿e byæ przez sprzêg // WN if (MainSwitch(false)) EventFlag = true; // wywalenie szybkiego z powodu niskiego ciœnienia if (TrainType != dt_EZT) // w EN57 pompuje siê tylko w silnikowym // pierwotnie w CHK pantografy mia³y równie¿ rozrz¹dcze EZT for (int b = 0; b <= 1; ++b) if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll)) if (Couplers[b].Connected->PantVolume < PantVolume) // bo inaczej trzeba w obydwu cz³onach przestawiaæ Couplers[b].Connected->PantVolume = PantVolume; // przekazanie ciœnienia do s¹siedniego cz³onu // czy np. w ET40, ET41, ET42 pantografy cz³onów maj¹ po³¹czenie pneumatyczne? // Ra 2014-07: raczej nie - najpierw siê za³¹cza jeden cz³on, a potem mo¿na podnieœæ w // drugim } else { // a tu coœ dla SM42 i SM31, aby pokazywaæ na manometrze PantPress = CntrlPipePress; } };
void OctreeNode::OnTransformChanged() { SpatialNode::OnTransformChanged(); SetFlag(NF_BOUNDING_BOX_DIRTY, true); if (!TestFlag(NF_OCTREE_UPDATE_QUEUED) && octree) octree->QueueUpdate(this); }
void MAS::RadioButton::MsgLRelease() { bool pressed = TestFlag(D_PRESSED); bool oldSel = Selected(); CheckBox::MsgLRelease(); if (oldSel == Selected() && pressed) { GetParent()->DialogMessage(MSG_RADIO, group); } }
void SpatialNode::UpdateWorldTransform() const { if (TestFlag(NF_SPATIAL_PARENT)) worldTransform = static_cast<SpatialNode*>(Parent())->WorldTransform() * Matrix3x4(position, rotation, scale); else worldTransform = Matrix3x4(position, rotation, scale); SetFlag(NF_WORLD_TRANSFORM_DIRTY, false); }
/* * returns negative if the transfer is finished or error'd out * * returns zero or more if the transfer needs to be continued. */ nsresult nsMailboxProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream, PRUint32 offset, PRUint32 length) { nsresult rv = NS_OK; PRInt32 status = 0; ClearFlag(MAILBOX_PAUSE_FOR_READ); /* already paused; reset */ while(!TestFlag(MAILBOX_PAUSE_FOR_READ)) { switch(m_nextState) { case MAILBOX_READ_MESSAGE: if (inputStream == nsnull) SetFlag(MAILBOX_PAUSE_FOR_READ); else status = ReadMessageResponse(inputStream, offset, length); break; case MAILBOX_READ_FOLDER: if (inputStream == nsnull) SetFlag(MAILBOX_PAUSE_FOR_READ); // wait for file socket to read in the next chunk... else status = ReadFolderResponse(inputStream, offset, length); break; case MAILBOX_DONE: case MAILBOX_ERROR_DONE: { nsCOMPtr <nsIMsgMailNewsUrl> anotherUrl = do_QueryInterface(m_runningUrl); rv = m_nextState == MAILBOX_DONE ? NS_OK : NS_ERROR_FAILURE; anotherUrl->SetUrlState(PR_FALSE, rv); m_nextState = MAILBOX_FREE; } break; case MAILBOX_FREE: // MAILBOX is a one time use connection so kill it if we get here... CloseSocket(); return rv; /* final end */ default: /* should never happen !!! */ m_nextState = MAILBOX_ERROR_DONE; break; } /* check for errors during load and call error * state if found */ if(status < 0 && m_nextState != MAILBOX_FREE) { m_nextState = MAILBOX_ERROR_DONE; /* don't exit! loop around again and do the free case */ ClearFlag(MAILBOX_PAUSE_FOR_READ); } } /* while(!MAILBOX_PAUSE_FOR_READ) */ return rv; }
void MAS::Image::UpdateSize() { if ((!bmp && bitmap < 0) || !TestFlag(D_AUTOSIZE)) { return; } Bitmap bmp = this->bmp ? this->bmp : skin->GetBitmap(bitmap); if (bmp) { Resize(bmp.size()); } }
static gii_event_mask GII_xdga_eventpoll(gii_input *inp, void *arg) { xdga_priv *priv = XDGA_PRIV(inp); XEvent xev; XDGAEvent *dgaev = (XDGAEvent *)&xev; gii_event giiev; int n; int rc = 0; int dga_event_base = priv->event_base; XSync( priv->disp, False ); for(n=XEventsQueued(priv->disp, QueuedAfterReading); n ; n-- ) { int keycode; XNextEvent(priv->disp, &xev); keycode = dgaev->xkey.keycode; _giiEventBlank( &giiev, sizeof(gii_event) ); switch(dgaev->type - dga_event_base ) { case KeyPress: prepare_key_event(inp, &giiev, keycode, dgaev); if( TestFlag( priv->key_vector, keycode) ) { giiev.any.type = evKeyRepeat; rc |= emKeyRepeat; } else { giiev.any.type = evKeyPress; rc |= emKeyPress; } /*DPRINT("press(%c)\n", giiev.key.sym);*/ SetFlag(priv->key_vector, keycode); _giiEvQueueAdd(inp, &giiev ); break; case KeyRelease: prepare_key_event(inp, &giiev, keycode, dgaev); giiev.any.type = evKeyRelease; rc |= emKeyRelease; /* DPRINT("release(%c)\n", giiev.key.sym);*/ ClearFlag(priv->key_vector, keycode); _giiEvQueueAdd(inp, &giiev); break; } } return rc; }
// Sets up the network for training. Initializes weights using weights of // scale `range` picked according to the random number generator `randomizer`. int LSTM::InitWeights(float range, TRand* randomizer) { Network::SetRandomizer(randomizer); num_weights_ = 0; for (int w = 0; w < WT_COUNT; ++w) { if (w == GFS && !Is2D()) continue; num_weights_ += gate_weights_[w].InitWeightsFloat( ns_, na_ + 1, TestFlag(NF_ADAM), range, randomizer); } if (softmax_ != NULL) { num_weights_ += softmax_->InitWeights(range, randomizer); } return num_weights_; }
double TMoverParameters::ShowEngineRotation(int VehN) { // pokazywanie obrotów silnika, równie¿ dwóch dalszych pojazdów (3×SN61) int b; switch (VehN) { // numer obrotomierza case 1: return fabs(enrot); case 2: for (b = 0; b <= 1; ++b) if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll)) if (Couplers[b].Connected->Power > 0.01) return fabs(Couplers[b].Connected->enrot); break; case 3: // to nie uwzglêdnia ewentualnego odwrócenia pojazdu w œrodku for (b = 0; b <= 1; ++b) if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll)) if (Couplers[b].Connected->Power > 0.01) if (TestFlag(Couplers[b].Connected->Couplers[b].CouplingFlag, ctrain_controll)) if (Couplers[b].Connected->Couplers[b].Connected->Power > 0.01) return fabs(Couplers[b].Connected->Couplers[b].Connected->enrot); break; }; return 0.0; };
int TMoverParameters::DettachStatus(Byte ConnectNo) { // Ra: sprawdzenie, czy odleg³oœæ jest dobra do roz³¹czania // powinny byæ 3 informacje: =0 sprzêg ju¿ roz³¹czony, <0 da siê roz³¹czyæ. >0 nie da siê // roz³¹czyæ if (!Couplers[ConnectNo].Connected) return 0; // nie ma nic, to roz³¹czanie jest OK if ((Couplers[ConnectNo].CouplingFlag & ctrain_coupler) == 0) return -Couplers[ConnectNo].CouplingFlag; // hak nie po³¹czony - roz³¹czanie jest OK if (TestFlag(DamageFlag, dtrain_coupling)) return -Couplers[ConnectNo].CouplingFlag; // hak urwany - roz³¹czanie jest OK // ABu021104: zakomentowane 'and (CouplerType<>Articulated)' w warunku, nie wiem co to bylo, ale // za to teraz dziala odczepianie... :) } // if (CouplerType==Articulated) return false; //sprzêg nie do rozpiêcia - mo¿e byæ tylko urwany // Couplers[ConnectNo].CoupleDist=Distance(Loc,Couplers[ConnectNo].Connected->Loc,Dim,Couplers[ConnectNo].Connected->Dim); CouplerDist(ConnectNo); if (Couplers[ConnectNo].CouplerType == Screw ? Couplers[ConnectNo].CoupleDist < 0.0 : true) return -Couplers[ConnectNo].CouplingFlag; // mo¿na roz³¹czaæ, jeœli dociœniêty return (Couplers[ConnectNo].CoupleDist > 0.2) ? -Couplers[ConnectNo].CouplingFlag : Couplers[ConnectNo].CouplingFlag; };
void CSoundGroup::Reload() { m_index = 0; // reset our index snd_group.clear(); for (size_t i = 0; i < filenames.size(); i++) { VfsPath thePath = m_filepath/filenames[i]; ISoundItem* temp = g_SoundManager->LoadItem(thePath); if (temp == NULL) HandleError(L"error loading sound", thePath, ERR::FAIL); else snd_group.push_back(temp); } if (TestFlag(eRandOrder)) random_shuffle(snd_group.begin(), snd_group.end()); }
void CSoundGroup::Reload() { m_index = 0; // reset our index #if CONFIG2_AUDIO ReleaseGroup(); if ( g_SoundManager ) { for (size_t i = 0; i < filenames.size(); i++) { VfsPath thePath = m_filepath/filenames[i]; CSoundData* itemData = CSoundData::SoundDataFromFile(thePath); if (itemData == NULL) HandleError(L"error loading sound", thePath, ERR::FAIL); else snd_group.push_back(itemData->IncrementCount()); } if (TestFlag(eRandOrder)) random_shuffle(snd_group.begin(), snd_group.end()); } #endif // CONFIG2_AUDIO }
void CSoundGroup::UploadPropertiesAndPlay(int theIndex, const CVector3D& position) { bool isOnscreen; ALfloat initialRolllOff = 0.02f; ALfloat itemRollOff = initialRolllOff; float offSet = RadiansOffCenter(position, isOnscreen, itemRollOff); if (isOnscreen || TestFlag(eDistanceless) || TestFlag(eOmnipresent)) { if (snd_group.size() == 0) Reload(); ISoundItem* hSound = snd_group[theIndex]; CVector3D origin = g_Game->GetView()->GetCamera()->GetOrientation().GetTranslation(); float sndDist = origin.Y; if (!TestFlag(eOmnipresent)) { hSound->SetLocation(CVector3D((sndDist * sin(offSet)), 0, sndDist * cos(offSet))); if (TestFlag(eDistanceless)) hSound->SetRollOff(initialRolllOff); else hSound->SetRollOff(itemRollOff); } if (TestFlag(eRandPitch)) hSound->SetPitch(RandFloat(m_PitchLower, m_PitchUpper)); else hSound->SetPitch(m_Pitch); ALfloat theGain = m_Gain; if (TestFlag(eRandGain)) theGain = RandFloat(m_GainLower, m_GainUpper); hSound->SetCone(m_ConeInnerAngle, m_ConeOuterAngle, m_ConeOuterGain); g_SoundManager->PlayGroupItem(hSound, theGain); } }
bool JITTimeProfileInfo::IsEquivalentObjTypeSpecDisabled() const { return TestFlag(Flags_disableEquivalentObjTypeSpec); }
void print_record(void *record, char *s) { char as[40], ds[40], datestr1[64], datestr2[64],proto[16], flags[6] = {'.','.','.','.','.','.'}; time_t when; struct tm *ts; master_record_t *r = (master_record_t *) record; float duration ; #ifdef IPV6 if ((r->flags & FLAG_IPV6_ADDR) != 0) { // IPv6 r->v6.srcaddr[0] = htonll(r->v6.srcaddr[0]); r->v6.srcaddr[1] = htonll(r->v6.srcaddr[1]); r->v6.dstaddr[0] = htonll(r->v6.dstaddr[0]); r->v6.dstaddr[1] = htonll(r->v6.dstaddr[1]); inet_ntop(AF_INET6, r->v6.srcaddr, as, sizeof(as)); inet_ntop(AF_INET6, r->v6.dstaddr, ds, sizeof(ds)); } else #endif { // IPv4*/ r->v4.srcaddr = htonl(r->v4.srcaddr); r->v4.dstaddr = htonl(r->v4.dstaddr); inet_ntop(AF_INET, &r->v4.srcaddr, as, sizeof(as)); inet_ntop(AF_INET, &r->v4.dstaddr, ds, sizeof(ds)); } as[40 - 1] = 0; ds[40 - 1] = 0; when = r->first; ts = localtime(&when); strftime(datestr1, 63, "%Y-%m-%d %H:%M:%S", ts); when = r->last; ts = localtime(&when); strftime(datestr2, 63, "%Y-%m-%d %H:%M:%S", ts); duration = r->last - r->first; /* * 000001 FIN. * 000010 SYN * 000100 RESET * 001000 PUSH * 010000 ACK * 100000 URGENT */ if(TestFlag(r->tcp_flags,tcpflags[0]) == tcpflags[0]) flags[5] = 'F'; if(TestFlag(r->tcp_flags,tcpflags[1]) == tcpflags[1]) flags[4] = 'S'; if(TestFlag(r->tcp_flags,tcpflags[2]) == tcpflags[2]) flags[3] = 'R'; if(TestFlag(r->tcp_flags,tcpflags[3]) == tcpflags[3]) flags[2] = 'P'; if(TestFlag(r->tcp_flags,tcpflags[4]) == tcpflags[4]) flags[1] = 'A'; if(TestFlag(r->tcp_flags,tcpflags[5]) == tcpflags[5]) flags[0] = 'U'; //procol Proto_string(r->prot, proto); snprintf(s,1023,"%s.%03u\t%2.3f\t%s\t%s:%u\t->\t%s:%u\t%s\t%u\t%lu\t%lu\t%lu", datestr1,r->msec_first,duration,proto,as,r->srcport,ds,r->dstport,flags,r->tos,r->dPkts,r->dOctets,r->aggr_flows); s[strlen(s)] = '\n'; } // End of print_record
bool JITTimeProfileInfo::IsObjTypeSpecDisabledInJitLoopBody() const { return TestFlag(Flags_disableObjTypeSpec_jitLoopBody); }
bool GSplitter::Border() { return TestFlag(WndFlags, GWF_BORDER); }
void CSoundGroup::UploadPropertiesAndPlay(size_t theIndex, const CVector3D& position, entity_id_t source) { #if CONFIG2_AUDIO if ( g_SoundManager ) { bool isOnscreen; ALfloat initialRolllOff = 0.1f; ALfloat itemRollOff = initialRolllOff; float offSet = RadiansOffCenter(position, isOnscreen, itemRollOff); if (isOnscreen || TestFlag(eDistanceless) || TestFlag(eOmnipresent)) { if (snd_group.size() == 0) Reload(); if ( snd_group.size() > theIndex ) { if ( CSoundData* sndData = snd_group[theIndex] ) { CVector3D origin = g_Game->GetView()->GetCamera()->GetOrientation().GetTranslation(); float sndDist = origin.Y; float itemDist = ( position - origin ).Length(); if ( (sndDist * 2) < itemDist ) sndDist = itemDist; ISoundItem* hSound = ((CSoundManager*)g_SoundManager)->ItemForEntity( source, sndData); if ( hSound ) { if (!TestFlag(eOmnipresent)) { if (TestFlag(eDistanceless)) itemRollOff = 0; if ( sndData->IsStereo() ) LOGWARNING( L"OpenAL: stereo sounds can't be positioned: %ls", sndData->GetFileName()->string().c_str() ); hSound->SetLocation(CVector3D((sndDist * sin(offSet)), 0, - sndDist * cos(offSet))); hSound->SetRollOff(itemRollOff); } if (TestFlag(eRandPitch)) hSound->SetPitch(RandFloat(m_PitchLower, m_PitchUpper)); else hSound->SetPitch(m_Pitch); ALfloat theGain = m_Gain; if (TestFlag(eRandGain)) theGain = RandFloat(m_GainLower, m_GainUpper); hSound->SetCone(m_ConeInnerAngle, m_ConeOuterAngle, m_ConeOuterGain); ((CSoundManager*)g_SoundManager)->PlayGroupItem(hSound, theGain); } } } } } #else // !CONFIG2_AUDIO UNUSED2(theIndex); UNUSED2(position); UNUSED2(source); #endif // !CONFIG2_AUDIO }
bool JITTimeProfileInfo::IsMemOpDisabled() const { return TestFlag(Flags_disableMemOp); }
bool JITTimeProfileInfo::HasLdFldCallSiteInfo() const { return TestFlag(Flags_hasLdFldCallSiteInfo); }
bool JITTimeProfileInfo::IsLdLenIntSpecDisabled() const { return TestFlag(Flags_disableLdLenIntSpec); }
bool JITTimeProfileInfo::IsFloorInliningDisabled() const { return TestFlag(Flags_disableFloorInlining); }
bool JITTimeProfileInfo::IsNoProfileBailoutsDisabled() const { return TestFlag(Flags_disableNoProfileBailouts); }
bool JITTimeProfileInfo::IsPowIntIntTypeSpecDisabled() const { return TestFlag(Flags_disablePowIntIntTypeSpec); }
bool JITTimeProfileInfo::IsLoopImplicitCallInfoDisabled() const { return TestFlag(Flags_disableLoopImplicitCallInfo); }
bool JITTimeProfileInfo::IsFloatTypeSpecDisabled() const { return TestFlag(Flags_disableFloatTypeSpec); }
bool GPanel::Pour(GRegion &r) { int Sx = CalcWidth(); GRect *Best = 0; if (Open()) { Best = FindLargest(r); } else { Best = FindSmallestFit(r, Sx, ClosedSize); if (!Best) { Best = FindLargest(r); } } if (Best) { GRect r = *Best; if (OpenSize > 0) { int Size = ((Open()) ? OpenSize : ClosedSize); int Limit = 30; if (TestFlag(Align, GV_EDGE_RIGHT) || TestFlag(Align, GV_EDGE_LEFT)) { Limit = min(Size, r.X()-1); } else /* if (TestFlag(Align, GV_EDGE_BOTTOM) || TextFlag(Align, GV_EDGE_TOP)) */ { Limit = min(Size, r.Y()-1); } if (Align & GV_EDGE_RIGHT) { r.x1 = r.x2 - Limit; } else if (Align & GV_EDGE_BOTTOM) { r.y1 = r.y2 - Limit; } else if (Align & GV_EDGE_LEFT) { r.x2 = r.x1 + Limit; } else // if (Align & GV_EDGE_TOP) { r.y2 = r.y1 + Limit; } if (!Open()) { r.x2 = r.x1 + Sx - 1; } } else { r.y2 = r.y1 - OpenSize; } SetPos(r, true); return true; } return false; }
bool JITTimeProfileInfo::IsTrackCompoundedIntOverflowDisabled() const { return TestFlag(Flags_disableTrackCompoundedIntOverflow); }
bool JITTimeProfileInfo::IsStackArgOptDisabled() const { return TestFlag(Flags_disableStackArgOpt); }
bool JITTimeProfileInfo::IsCheckThisDisabled() const { return TestFlag(Flags_disableCheckThis); }