void FEPlayer::Deserialize(TiXmlDocument* _poXmlDoc, TiXmlElement* _poParent) { TiXmlElement* poElement = _poParent->FirstChildElement("Player"); if(poElement) { int isMovable, isDeletable; poElement->QueryIntAttribute("is_movable", &isMovable); poElement->QueryIntAttribute("is_deletable", &isDeletable); if(isMovable) AddFlags(EFEFlag_Movable); else RemoveFlags(EFEFlag_Movable); if(isDeletable) AddFlags(EFEFlag_Deletable); else RemoveFlags(EFEFlag_Deletable); TiXmlElement* poPosElement = poElement->FirstChildElement("Position"); D_CHECK(poPosElement); double x, y; poPosElement->QueryDoubleAttribute("x", &x); poPosElement->QueryDoubleAttribute("y", &y); SetPosition(Vec3(x, y, 0.f)); SetColor(GetColor(m_id)); } }
/** * name: SaveState * class: CPsTree * desc: saves the current tree to database * param: none * return: nothing **/ void CPsTree::SaveState() { CPsTreeItem *pti = CurrentItem(); if (_hWndTree && (_dwFlags & (PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED|PSTVF_STATE_CHANGED))) { SHORT i; int iItem = 0; // save all visible items WORD numErrors = SaveItemsState(TREE_ROOTITEM, TVGN_ROOT, iItem); // save all invisible items of the current subtree for (i = 0; i < _numItems; i++) { if (!_pItems[i]->Hti()) { LPSTR pszGroup; if (!IsIndexValid(_pItems[i]->Parent()) || !(pszGroup = _pItems[_pItems[i]->Parent()]->Name())) pszGroup = TREE_ROOTITEM; numErrors += _pItems[i]->DBSaveItemState(pszGroup, iItem++, DBTVIS_INVISIBLE, _dwFlags); } } // remove changed flags RemoveFlags(PSTVF_STATE_CHANGED|PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED); } // save current selected item if (pti) db_set_utf(NULL, MODNAME, SET_LASTITEM, pti->Name()); else db_unset(NULL, MODNAME, SET_LASTITEM); }
// TODO: Alle WellenNPCs müssen sofort beim Ruf erscheinen, und zufällig (in Gruppen) nacheinander aktiviert werden! void SpawnWave(Creature * summoner) { if (TempSummon * TS = summoner->SummonCreature(NPC_WAVE_MERCENARY, MercenarySpawnPos[urand(0, ENCOUNTER_WAVE_MERCENARY-1)])) RemoveFlags(TS); if (TempSummon * TS = summoner->SummonCreature(NPC_WAVE_FOOTMAN, FootmenSpawnPos[urand(0, ENCOUNTER_WAVE_FOOTMAN-1)])) RemoveFlags(TS); if (TempSummon * TS = summoner->SummonCreature(NPC_WAVE_RIFLEMAN, RiflemanSpawnPos[urand(0, ENCOUNTER_WAVE_RIFLEMAN-1)])) RemoveFlags(TS); if (TempSummon * TS = summoner->SummonCreature(NPC_WAVE_PRIEST, PriestSpawnPos[urand(0, ENCOUNTER_WAVE_PRIEST-1)])) RemoveFlags(TS); if (TempSummon * TS = summoner->SummonCreature(NPC_WAVE_MAGE, MageSpawnPos[urand(0, ENCOUNTER_WAVE_MAGE-1)])) RemoveFlags(TS); }
PLDynVarVector3iTreeItem::PLDynVarVector3iTreeItem(PLCore::DynVar *dynVar, TreeItemBase *parent) : PLDynVarStringTreeItem(dynVar, PLDynVarTreeItemTypes::Vector3i, parent) { RemoveFlags(1, Qt::ItemIsEditable); if (m_dynVar && m_dynVar->GetTypeID() == PLCore::Type<PLMath::Vector3i>::TypeID) { new Vector3iXValueTreeItem(this, this); new Vector3iYValueTreeItem(this, this); new Vector3iZValueTreeItem(this, this); } }
void LFGPlayerState::SetRoles(uint8 roles) { rolesMask = LFGRoleMask(roles); if (Group* group = m_player->GetGroup()) { if (group->GetLeaderGuid() == m_player->GetObjectGuid()) rolesMask = LFGRoleMask(rolesMask | LFG_ROLE_MASK_LEADER); else rolesMask = LFGRoleMask(rolesMask & ~LFG_ROLE_MASK_LEADER); } else rolesMask = LFGRoleMask(rolesMask & ~LFG_ROLE_MASK_LEADER); rolesMask != LFG_ROLE_MASK_NONE ? AddFlags(LFG_MEMBER_FLAG_ROLES) : RemoveFlags(LFG_MEMBER_FLAG_ROLES); };
void WindowNavigated(JSContext *cx, XPCWrappedNative *innerObj) { NS_ABORT_IF_FALSE(innerObj->NeedsXOW(), "About to write to unowned memory"); // First, disconnect the old XOW from the XOW cache. XPCWrappedNativeWithXOW *wnxow = static_cast<XPCWrappedNativeWithXOW *>(innerObj); JSObject *oldXOW = wnxow->GetXOW(); if (oldXOW) { jsval flags = GetFlags(cx, oldXOW); NS_ASSERTION(HAS_FLAGS(flags, FLAG_IS_CACHED), "Wrapper should be cached"); SetFlags(cx, oldXOW, RemoveFlags(flags, FLAG_IS_CACHED)); NS_ASSERTION(wnxow->GetXOW() == oldXOW, "bad XOW in cache"); wnxow->SetXOW(nsnull); } }
void nekoGUISelectionButtons::Update(float32 frameTime) { if(mButtons.empty()) return; // 사이즈를 재계산해주자! if(mFlags & EBIF_UPDATE_NEEDED) { int32 blockGap = 0; list<nekoOneButton *>::iterator iter = mButtons.begin(); for(;iter != mButtons.end();++iter) { if((*iter)->mImage[0] && (*iter)->mImage[0]->GetState() == EHRS_LOADED) { blockGap += (*iter)->mImage[0]->GetSize().y; } else { return; } } blockGap = (mBoundingBox.GetHeight() - blockGap) / (mButtons.size() + 1); int32 y = blockGap; for(iter = mButtons.begin();iter != mButtons.end();++iter, y += blockGap) { (*iter)->rect = nekoRectangle( (mBoundingBox.GetWidth() - (*iter)->mImage[0]->GetSize().x) / 2, mBoundingBox.top + y); (*iter)->rect.SetSize((*iter)->mImage[0]->GetSize().x, (*iter)->mImage[0]->GetSize().y); y += (*iter)->mImage[0]->GetSize().y; } RemoveFlags(EBIF_UPDATE_NEEDED); } }
/** * name: DBSaveItemState * class: CPsTreeItem * desc: saves the current treeitem to database * param: pszGroup - name of the parent item * iItemPosition - iterated index to remember the order of the tree * iState - expanded|collapsed|invisible * dwFlags - tells what to save * return: handle to new (moved) treeitem if successful or NULL otherwise **/ WORD CPsTreeItem::DBSaveItemState(LPCSTR pszGroup, int iItemPosition, UINT iState, DWORD dwFlags) { WORD numErrors = 0; // save group if ((dwFlags & PSTVF_GROUPS) && (dwFlags & PSTVF_POS_CHANGED)) numErrors += db_set_utf(NULL, MODNAME, PropertyKey(SET_ITEM_GROUP), (LPSTR)pszGroup); // save label if ((dwFlags & PSTVF_LABEL_CHANGED) && (_dwFlags & PSTVF_LABEL_CHANGED)) numErrors += db_set_ts(NULL, MODNAME, GlobalPropertyKey(SET_ITEM_LABEL), Label()); // save position if ((dwFlags & PSTVF_POS_CHANGED) && !(dwFlags & PSTVF_SORTTREE)) numErrors += db_set_b(NULL, MODNAME, PropertyKey(SET_ITEM_POS), iItemPosition); // save state if (dwFlags & PSTVF_STATE_CHANGED) numErrors += db_set_b(NULL, MODNAME, PropertyKey(SET_ITEM_STATE), _hItem ? ((iState & TVIS_EXPANDED) ? DBTVIS_EXPANDED : DBTVIS_NORMAL) : DBTVIS_INVISIBLE); RemoveFlags(PSTVF_STATE_CHANGED|PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED); return numErrors; }
void LevelEditor::mouseInputCalback(const inputEvent& event,const int& x,const int& y){ if(m_Level && m_Camera){ switch(event){ case MOUSE_LB_PRESSED:{ UiElement* uiElements[9] = { m_BaseTiles, m_Objects, m_NameBox, m_ObjectsUp, m_ObjectsDown, m_BaseTilesUp, m_BaseTilesDown, m_SaveLevel, m_ReturnToMenu }; for(int i = 0;i < 9;i++){ if(Util::instance()->rectIntersection(x,y,1,1,uiElements[i]->getScreenPosX(), uiElements[i]->getScreenPosY(),uiElements[i]->getWidth(),uiElements[i]->getHeight())){ return; } } Tile* tile; Tile* tileToReplace; unsigned int currentTileType = 0; if(m_BaseTiles->getSelectedEntry() == "Wall"){ currentTileType = Wall; } else if(m_BaseTiles->getSelectedEntry() == "Empty"){ currentTileType = Empty; } else if(m_BaseTiles->getSelectedEntry() == "Ground"){ currentTileType = Ground; } if(ContainsFlags(currentTileType,(Wall|Ground|Empty))){ tileToReplace = m_Level->getTileForPosition( Util::instance()->screenToWorldCoordX(x,m_Camera), Util::instance()->screenToWorldCoordY(y,m_Camera)); if(tileToReplace && !ContainsFlags(tileToReplace->getTileTypes(),currentTileType)){ tile = new Tile(currentTileType); tile->setPosition(tileToReplace->getPositionX(), tileToReplace->getPositionY()); m_Level->changeTile(tile); } } } break; case MOUSE_RB_PRESSED:{ UiElement* uiElements[9] = { m_BaseTiles, m_Objects, m_NameBox, m_ObjectsUp, m_ObjectsDown, m_BaseTilesUp, m_BaseTilesDown, m_SaveLevel, m_ReturnToMenu }; for(int i = 0;i < 9;i++){ if(Util::instance()->rectIntersection(x,y,1,1,uiElements[i]->getScreenPosX(), uiElements[i]->getScreenPosY(),uiElements[i]->getWidth(),uiElements[i]->getHeight())){ return; } } unsigned int tileObject = 0; unsigned int unwalkables = 0; if(m_Objects->getSelectedEntry() == "None"){ tileObject = 0; unwalkables = 0; } if(m_Objects->getSelectedEntry() == "GruntSpawn"){ tileObject = GruntStart; unwalkables = BLOB_UNWALKABLES; } else if(m_Objects->getSelectedEntry() == "GlobSpawn"){ tileObject = GlobStart; unwalkables = BLOB_UNWALKABLES; } else if(m_Objects->getSelectedEntry() == "TeleSpawn"){ tileObject = TeleStart; unwalkables = BLOB_UNWALKABLES; } else if(m_Objects->getSelectedEntry() == "MotherSpawn"){ tileObject = MotherStart; unwalkables = BLOB_UNWALKABLES; } else if(m_Objects->getSelectedEntry() == "PEnemySpawn"){ tileObject = PistolEnemy; unwalkables = ENEMY_UNWALKABLES; } else if(m_Objects->getSelectedEntry() == "SGEnemySpawn"){ tileObject = ShotgunEnemy; unwalkables = ENEMY_UNWALKABLES; } Tile* tile = m_Level->getTileForPosition( Util::instance()->screenToWorldCoordX(x,m_Camera), Util::instance()->screenToWorldCoordY(y,m_Camera)); if(tile && !ContainsFlags(tile->getTileTypes(),tileObject) && !ContainsFlags(tile->getTileTypes(),unwalkables)){ unsigned int tileTypes = tile->getTileTypes(); int objectTypes[7] = {GruntStart,TeleStart,GlobStart,MotherStart,EnemySpawner,PistolEnemy,ShotgunEnemy}; RemoveFlags(&tileTypes,objectTypes,7); for(int i = 0;i < m_ObjectSprites->size();i++){ if((*m_ObjectSprites)[i]->getOwner() == tile){ SpriteManager::instance()->deleteSprite((*m_ObjectSprites)[i]); break; } } tile->setTileTypes(tileTypes|tileObject); switch(tileObject){ case GruntStart: m_ObjectSprites->push_back( SpriteManager::instance()->createSprite(tile,"PathGuy.png",1)); break; case GlobStart: m_ObjectSprites->push_back( SpriteManager::instance()->createSprite(tile,"PathGuy.png",1)); break; case TeleStart: m_ObjectSprites->push_back( SpriteManager::instance()->createSprite(tile,"PathGuy.png",1)); break; case MotherStart: m_ObjectSprites->push_back( SpriteManager::instance()->createSprite(tile,"PathGuy.png",1)); break; case PistolEnemy: case ShotgunEnemy: m_ObjectSprites->push_back( SpriteManager::instance()->createSprite(tile,"TestEnemy.png",1)); break; default: break; } } break; }//case MOUSE_RB_PRESSED } } }
/** * \brief Initializes signal lock and signal values. * * Start() must be called to actually begin continuous * signal monitoring. The timeout is set to 3 seconds, * and the signal threshold is initialized to 0%. * * \param db_cardnum Recorder number to monitor, * if this is less than 0, SIGNAL events will not be * sent to the frontend even if SetNotifyFrontend(true) * is called. * \param _channel DVBChannel for card * \param _flags Flags to start with */ DVBSignalMonitor::DVBSignalMonitor(int db_cardnum, DVBChannel* _channel, uint64_t _flags) : DTVSignalMonitor(db_cardnum, _channel, _flags), // This snr setup is incorrect for API 3.x but works better // than int16_t range in practice, however this is correct // for the 4.0 DVB API which uses a uint16_t for the snr signalToNoise (QObject::tr("Signal To Noise"), "snr", 0, true, 0, 65535, 0), bitErrorRate (QObject::tr("Bit Error Rate"), "ber", 65535, false, 0, 65535, 0), uncorrectedBlocks(QObject::tr("Uncorrected Blocks"), "ucb", 65535, false, 0, 65535, 0), rotorPosition (QObject::tr("Rotor Progress"), "pos", 100, true, 0, 100, 0), streamHandlerStarted(false), streamHandler(NULL) { // These two values should probably come from the database... int wait = 3000; // timeout when waiting on signal int threshold = 0; // signal strength threshold signalLock.SetTimeout(wait); signalStrength.SetTimeout(wait); signalStrength.SetThreshold(threshold); // This is incorrect for API 3.x but works better than int16_t range // in practice, however this is correct for the 4.0 DVB API signalStrength.SetRange(0, 65535); bool ok; _channel->HasLock(&ok); if (!ok) VERBOSE(VB_IMPORTANT, LOC_ERR + "Cannot read DVB status" + ENO); uint64_t rmflags = 0; #define DVB_IO(FLAG, METHOD, MSG) \ do { if (HasFlags(FLAG)) { bool ok; _channel->METHOD(&ok); \ if (!ok) { \ VERBOSE(VB_IMPORTANT, LOC_WARN+"Cannot "+MSG+ENO); \ rmflags |= FLAG; } \ else { \ VERBOSE(VB_CHANNEL, LOC + "Can " + MSG); } } } while (false) DVB_IO(kSigMon_WaitForSig, GetSignalStrength, "measure Signal Strength"); DVB_IO(kDVBSigMon_WaitForSNR, GetSNR, "measure S/N"); DVB_IO(kDVBSigMon_WaitForBER, GetBitErrorRate, "measure Bit Error Rate"); DVB_IO(kDVBSigMon_WaitForUB, GetUncorrectedBlockCount, "count Uncorrected Blocks"); #undef DVB_IO RemoveFlags(rmflags); VERBOSE(VB_CHANNEL, LOC + "DVBSignalMonitor::ctor " + QString("initial flags %1").arg(sm_flags_to_string(flags))); minimum_update_rate = _channel->GetMinSignalMonitorDelay(); if (minimum_update_rate > 30) usleep(minimum_update_rate * 1000); streamHandler = DVBStreamHandler::Get(_channel->GetCardNum()); }
/** \fn DVBSignalMonitor::UpdateValues() * \brief Fills in frontend stats and emits status Qt signals. * * This is automatically called by MonitorLoop(), after Start() * has been used to start the signal monitoring thread. */ void DVBSignalMonitor::UpdateValues(void) { if (!running || exit) return; if (streamHandlerStarted) { if (!streamHandler->IsRunning()) { error = QObject::tr("Error: stream handler died"); update_done = true; return; } EmitStatus(); if (IsAllGood()) SendMessageAllGood(); // TODO dtv signals... update_done = true; return; } AddFlags(kSigMon_WaitForSig); DVBChannel *dvbchannel = GetDVBChannel(); if (!dvbchannel) return; // Handle retuning after rotor has turned if (HasFlags(SignalMonitor::kDVBSigMon_WaitForPos)) { if (dvbchannel->GetRotor()) { if (!streamHandler->IsRetuneAllowed()) streamHandler->SetRetuneAllowed(true, this, dvbchannel); streamHandler->RetuneMonitor(); } else RemoveFlags(SignalMonitor::kDVBSigMon_WaitForPos); } bool wasLocked = false, isLocked = false; uint sig = 0, snr = 0, ber = 0, ublocks = 0; // Get info from card bool has_lock = dvbchannel->HasLock(); if (HasFlags(kSigMon_WaitForSig)) sig = (uint) (dvbchannel->GetSignalStrength() * 65535); if (HasFlags(kDVBSigMon_WaitForSNR)) snr = (uint) (dvbchannel->GetSNR() * 65535); if (HasFlags(kDVBSigMon_WaitForBER)) ber = (uint) dvbchannel->GetBitErrorRate(); if (HasFlags(kDVBSigMon_WaitForUB)) ublocks = (uint) dvbchannel->GetUncorrectedBlockCount(); has_lock |= streamHandler->IsRunning(); // Set SignalMonitorValues from info from card. { QMutexLocker locker(&statusLock); // BER and UB are actually uint32 values, but we // clamp them at 64K. This is because these values // are acutally cumulative, but we don't try to // normalize these to a time period. wasLocked = signalLock.IsGood(); signalLock.SetValue((has_lock) ? 1 : 0); isLocked = signalLock.IsGood(); if (HasFlags(kSigMon_WaitForSig)) signalStrength.SetValue(sig); if (HasFlags(kDVBSigMon_WaitForSNR)) signalToNoise.SetValue(snr); if (HasFlags(kDVBSigMon_WaitForBER)) bitErrorRate.SetValue(ber); if (HasFlags(kDVBSigMon_WaitForUB)) uncorrectedBlocks.SetValue(ublocks); } // Debug output if (wasLocked != isLocked) { VERBOSE(VB_CHANNEL, LOC + "UpdateValues -- Signal " <<(isLocked ? "Locked" : "Lost")); } EmitStatus(); if (IsAllGood()) SendMessageAllGood(); // Start table monitoring if we are waiting on any table // and we have a lock. if (isLocked && GetStreamData() && (!HasFlags(kDVBSigMon_WaitForPos) || rotorPosition.IsGood()) && HasAnyFlag(kDTVSigMon_WaitForPAT | kDTVSigMon_WaitForPMT | kDTVSigMon_WaitForMGT | kDTVSigMon_WaitForVCT | kDTVSigMon_WaitForNIT | kDTVSigMon_WaitForSDT)) { GetStreamData()->AddListeningPID(MPEG_PAT_PID); streamHandler->AddListener(GetStreamData(), true, false); streamHandlerStarted = true; } update_done = true; }
void Texture::Unlock() { RemoveFlags( FL_LOCKED ); }
void FEElement::Deselect(const Vec2& pos) { RemoveFlags(EFEFlag_Selected); }