ofxAVUIDropDown::ofxAVUIDropDown(string _title, string _paramSelection){ title = _title; paramSelection = _paramSelection; itemHeight = ofGetHeight()/22; resetItems(); topPositionSpecial = false; resetItems(); }
int onCheatConsole() { char init_title[80]; sprintf(init_title, "Current Data"); init_dlg[0].dp=init_title; zinitdata *zinit2 = copyIntoZinit(game); //modify some entries init_dlg[1655].dp = (void *)""; init_dlg[1658].dp = (void *)"Current HP (hearts):"; init_dlg[1658].flags |= D_DISABLED; init_dlg[1659].flags |= D_DISABLED; init_dlg[1663].flags |= D_DISABLED; init_dlg[1664].flags |= D_DISABLED; init_dlg[1664].dp = (void *)""; init_dlg[1670].flags |= D_DISABLED; init_dlg[1671].flags |= D_DISABLED; init_dlg[1667].flags |= D_DISABLED; init_dlg[1698].flags |= D_DISABLED; init_dlg[1699].flags |= D_DISABLED; init_dlg[1703].flags |= D_DISABLED; init_dlg[1704].flags |= D_DISABLED; init_dlg[1705].flags |= D_DISABLED; // the following statement has no effect, as the D_DISABLED flag is ignored by the jwin_tab_proc // init_tabs[4].flags |= D_DISABLED; int rval = doInit(zinit2); resetItems(game, zinit2, false); delete zinit2; ringcolor(false); return rval; }
SubmodelModel::SubmodelModel(Document *document, QObject *parent) : QAbstractItemModel(parent) { document_ = document; active_ = 0; resetItems(); }
void MainView2D::enableContext(bool enable) { if (enable == isEnabled()) return; PreviewContext::enableContext(enable); if (enable == true) slotRefreshView(); else resetItems(); }
void UInventoryComponent::closeTradeWindow() { state = InventoryState::INVENTORY; if (mainInventory) { mainInventory->tradeBorder->SetVisibility(ESlateVisibility::Collapsed); mainInventory->otherBorder->SetVisibility(ESlateVisibility::Hidden); } resetItems(); otherInventoryForTransfering = NULL; }
void main() { initMac(); createOffscreen( 1 ); createWindow(); resetItems(); defineItems(); eventLoop(); }
void SerialReceiver::processNewMsg(int serialByte) { if (serialByte == startChar) { resetItems(); state = SR_STATE_RECEIVING; error = SR_ERR_NONE; } else if ((serialByte == '\n') || (serialByte == ' ')) { return; } else { error = SR_ERR_ILLEGAL_CHAR; resetState(); } }
void QtGnuplotScene::processEvent(QtGnuplotEventType type, QDataStream& in) { if ((type != GEMove) && (type != GEVector) && !m_currentPolygon.empty()) { QPointF point = m_currentPolygon.last(); flushCurrentPolygon(); m_currentPolygon << point; } if (type == GEClear) { resetItems(); m_preserve_visibility = false; } else if (type == GELineWidth) { double width; in >> width; m_currentPen.setWidthF(width); }
QtGnuplotScene::QtGnuplotScene(QtGnuplotEventHandler* eventHandler, QObject* parent) : QGraphicsScene(parent) { m_widget = dynamic_cast<QtGnuplotWidget*>(parent); m_eventHandler = eventHandler; m_lastModifierMask = 0; m_textAngle = 0.; m_textAlignment = Qt::AlignLeft; m_currentZ = 1.; m_currentPointSize = 1.; m_enhanced = 0; m_currentPlotNumber = 0; m_inKeySample = false; m_preserve_visibility = false; m_currentGroup.clear(); resetItems(); }
void MainView2D::slotRefreshView() { if (isEnabled() == false) return; resetItems(); if (initialize2DProperties() == false) return; qDebug() << "Refresh 2D view..."; if (m_monProps->pointOfView() == MonitorProperties::Undefined) { QMetaObject::invokeMethod(m_gridItem, "showPovPopup"); return; } for (Fixture *fixture : m_doc->fixtures()) { if (m_monProps->containsFixture(fixture->id())) { for (quint32 subID : m_monProps->fixtureIDList(fixture->id())) { quint16 headIndex = m_monProps->fixtureHeadIndex(subID); quint16 linkedIndex = m_monProps->fixtureLinkedIndex(subID); createFixtureItem(fixture->id(), headIndex, linkedIndex, m_monProps->fixturePosition(fixture->id(), headIndex, linkedIndex), true); } } else { createFixtureItems(fixture->id(), QVector3D(0, 0, 0), false); } } }
void resetItems(gamedata *gamed) { zinitdata *z = copyIntoZinit(gamed); resetItems(gamed, z, false); delete z; }
MainView2D::~MainView2D() { resetItems(); }
void SerialReceiver::resetState() { resetItems(); state = SR_STATE_IDLE; }
int main(int argc, char** argv) { if (argc < 2) return usage(argc, argv); parent = pthread_self(); sigset_t original, masking; sigemptyset(&original); sigemptyset(&masking); sigaddset(&masking, SIGUSR1); pthread_sigmask(SIG_SETMASK, &masking, &original); int wakeupThreads = 0; try { wakeupThreads = lexicalCast<int>(argv[argc-1]); if (wakeupThreads < 1) return usage(argc, argv); std::cout << "wakeup threads of " << wakeupThreads << std::endl; } catch (std::exception& e) { std::cerr << e.what() << std::endl; return usage(argc, argv); } void* handle = WWWInit(); std::vector<Item> items = loadItems(); resetItems(items); void* filterManagerContext = FilterManagerCreate(NULL); std::map<void*, void*> contextMap; // create threads. for (int count = 0; count != wakeupThreads; ++count) { std::vector<Item>::iterator itor = find_uncheck_item(items); if (itor == items.end()) break; itor->check_flg = true; void* thread = ThreadCreate(); void* httpContext = HTTPCreateContext(itor->url_check.c_str(), NULL, NULL, 20); contextMap[thread] = httpContext; std::cout << "thread: " << thread << " context: " << httpContext << std::endl; ThreadStart(thread, httpContext, handler); } try { std::vector<Item>::iterator itor; while ((itor = find_uncheck_item(items)) != items.end()) { itor->check_flg = true; int signalNum = 0; sigwait(&masking, &signalNum); if (signalNum == SIGUSR1) { // signal一回で複数の待ちハンドラを処理した方が良さそう ScopedLock<Mutex> lock(syncObject); assert (idleThreads.size() > 0); void* thread = idleThreads.back(); idleThreads.pop_back(); ThreadJoin(thread); void* httpContext = contextMap[thread]; assert(httpContext != NULL); contextMap[thread] = NULL; { char url[2048]; url[HTTPGetURL(httpContext, url, sizeof(url))] = 0; std::vector<Item>::iterator item_itor = find_item_from_url(items, url); if (item_itor == items.end()) throw std::runtime_error((std::string("unfind URL: ") + url).c_str()); char date[256]; date[HTTPGetLastModified(httpContext, date, sizeof(date))] = 0; item_itor->last_updated = date; item_itor->crc32 = HTTPGetFilteredCRC32(httpContext, filterManagerContext); item_itor->content_length = HTTPGetContentsLength(httpContext); HTTPClose(httpContext); } HTTPCreateContext(itor->url_check.c_str(), NULL, NULL, 20); contextMap[thread] = httpContext; std::cout << "thread: " << thread << " context: " << httpContext << std::endl; ThreadStart(thread, httpContext, handler); } } // 稼働中のスレッドがwakeupThreads個存在する for (int count = 0; count != wakeupThreads; ++count) { int signalNum = 0; // signal一回で複数の待ちハンドラを処理した方が良さそう sigwait(&masking, &signalNum); ScopedLock<Mutex> lock(syncObject); ThreadClose(idleThreads.back()); idleThreads.pop_back(); } } catch (std::exception& e) { std::cerr << "raise exception: " << e.what() << std::endl; } catch (...) { std::cerr << "unknown exception raised." << std::endl; } saveItems(items); FilterManagerTerminate(filterManagerContext); WWWTerminate(handle); pthread_sigmask(SIG_SETMASK, &original, NULL); return 0; }
TreeWidget::TreeWidget(QWidget* parent) : QTreeWidget(parent) { d.block = false; d.blink = false; d.pressedItem = 0; d.sortingBlocked = false; qRegisterMetaType<TreeItem*>(); setAnimated(true); setColumnCount(2); setIndentation(0); setHeaderHidden(true); setRootIsDecorated(false); setFocusPolicy(Qt::NoFocus); setFrameStyle(QFrame::NoFrame); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); #ifdef Q_OS_MAC setVerticalScrollMode(ScrollPerPixel); #endif setItemDelegate(new TreeDelegate(this)); setSortingEnabled(true); sortByColumn(0, Qt::AscendingOrder); header()->setStretchLastSection(false); header()->setResizeMode(0, QHeaderView::Stretch); header()->setResizeMode(1, QHeaderView::Fixed); #ifdef Q_OS_WIN header()->resizeSection(1, fontMetrics().width("9999")); #else header()->resizeSection(1, fontMetrics().width("999")); #endif connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(onItemExpanded(QTreeWidgetItem*))); connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(onItemCollapsed(QTreeWidgetItem*))); connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(onCurrentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*))); #ifdef Q_OS_MAC QString navigate(tr("Ctrl+Alt+%1")); QString nextActive(tr("Shift+Ctrl+Alt+%1")); #else QString navigate(tr("Alt+%1")); QString nextActive(tr("Shift+Alt+%1")); #endif QShortcut* shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(navigate.arg("Up"))); connect(shortcut, SIGNAL(activated()), this, SLOT(moveToPrevItem())); shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(navigate.arg("Down"))); connect(shortcut, SIGNAL(activated()), this, SLOT(moveToNextItem())); shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(nextActive.arg("Up"))); connect(shortcut, SIGNAL(activated()), this, SLOT(moveToPrevActiveItem())); shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(nextActive.arg("Down"))); connect(shortcut, SIGNAL(activated()), this, SLOT(moveToNextActiveItem())); shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(navigate.arg("Right"))); connect(shortcut, SIGNAL(activated()), this, SLOT(expandCurrentConnection())); shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(navigate.arg("Left"))); connect(shortcut, SIGNAL(activated()), this, SLOT(collapseCurrentConnection())); shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(tr("Ctrl+L"))); connect(shortcut, SIGNAL(activated()), this, SLOT(moveToMostActiveItem())); shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(tr("Ctrl+R"))); connect(shortcut, SIGNAL(activated()), this, SLOT(resetItems())); }
Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) { const char *fileName = getSavegameFilename(slot); Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumbnail); if (!out) return _saveFileMan->getError(); completeDoorOperations(); generateTempData(); for (int i = 0; i < 4; i++) { LoLCharacter *c = &_characters[i]; out->writeUint16BE(c->flags); out->write(c->name, 11); out->writeByte(c->raceClassSex); out->writeSint16BE(c->id); out->writeByte(c->curFaceFrame); out->writeByte(c->tempFaceFrame); out->writeByte(c->screamSfx); for (int ii = 0; ii < 8; ii++) out->writeUint16BE(c->itemsMight[ii]); for (int ii = 0; ii < 8; ii++) out->writeUint16BE(c->protectionAgainstItems[ii]); out->writeUint16BE(c->itemProtection); out->writeSint16BE(c->hitPointsCur); out->writeUint16BE(c->hitPointsMax); out->writeSint16BE(c->magicPointsCur); out->writeUint16BE(c->magicPointsMax); out->writeByte(c->field_41); out->writeUint16BE(c->damageSuffered); out->writeUint16BE(c->weaponHit); out->writeUint16BE(c->totalMightModifier); out->writeUint16BE(c->totalProtectionModifier); out->writeUint16BE(c->might); out->writeUint16BE(c->protection); out->writeSint16BE(c->nextAnimUpdateCountdown); for (int ii = 0; ii < 11; ii++) out->writeUint16BE(c->items[ii]); for (int ii = 0; ii < 3; ii++) out->writeByte(c->skillLevels[ii]); for (int ii = 0; ii < 3; ii++) out->writeSByte(c->skillModifiers[ii]); for (int ii = 0; ii < 3; ii++) out->writeUint32BE(c->experiencePts[ii]); for (int ii = 0; ii < 5; ii++) out->writeByte(c->characterUpdateEvents[ii]); for (int ii = 0; ii < 5; ii++) out->writeByte(c->characterUpdateDelay[ii]); } out->write(_wllBuffer4, 80); out->writeUint16BE(_currentBlock); out->writeUint16BE(_partyPosX); out->writeUint16BE(_partyPosY); out->writeUint16BE(_updateFlags); out->writeByte(_scriptDirection); out->writeByte(_selectedSpell); out->writeByte(_sceneDefaultUpdate); out->writeByte(_compassBroken); out->writeByte(_drainMagic); out->writeUint16BE(_currentDirection); out->writeUint16BE(_compassDirection); out->writeSByte(_selectedCharacter); out->writeByte(_currentLevel); for (int i = 0; i < 48; i++) out->writeSint16BE(_inventory[i]); out->writeSint16BE(_inventoryCurItem); out->writeSint16BE(_itemInHand); out->writeSint16BE(_lastMouseRegion); out->writeUint32BE(ARRAYSIZE(_flagsTable)); out->write(_flagsTable, ARRAYSIZE(_flagsTable)); for (int i = 0; i < 24; i++) out->writeUint16BE(_globalScriptVars[i]); out->writeByte(_brightness); out->writeByte(_lampOilStatus); out->writeSByte(_lampEffect); out->writeUint16BE(_credits); for (int i = 0; i < 8; i++) out->writeUint16BE(_globalScriptVars2[i]); out->write(_availableSpells, 7); out->writeUint32BE(_hasTempDataFlags); resetItems(0); for (int i = 0; i < 400; i++) { ItemInPlay *t = &_itemsInPlay[i]; out->writeUint16BE(t->nextAssignedObject); out->writeUint16BE(t->nextDrawObject); out->writeByte(t->flyingHeight); out->writeUint16BE(t->block); out->writeUint16BE(t->x); out->writeUint16BE(t->y); out->writeSByte(t->level); out->writeUint16BE(t->itemPropertyIndex); out->writeUint16BE(t->shpCurFrame_flg); out->writeByte(t->destDirection); out->writeSByte(t->hitOffsX); out->writeSByte(t->hitOffsY); out->writeByte(t->currentSubFrame); } addLevelItems(); for (int i = 0; i < 29; i++) { LevelTempData *l = _lvlTempData[i]; if (!l || !(_hasTempDataFlags & (1 << i))) continue; out->write(l->wallsXorData, 4096); out->write(l->flags, 1024); for (int ii = 0; ii < 30; ii++) { MonsterInPlay *m = &l->monsters[ii]; out->writeUint16BE(m->nextAssignedObject); out->writeUint16BE(m->nextDrawObject); out->writeByte(m->flyingHeight); out->writeUint16BE(m->block); out->writeUint16BE(m->x); out->writeUint16BE(m->y); out->writeSByte(m->shiftStep); out->writeUint16BE(m->destX); out->writeUint16BE(m->destY); out->writeByte(m->destDirection); out->writeSByte(m->hitOffsX); out->writeSByte(m->hitOffsY); out->writeByte(m->currentSubFrame); out->writeByte(m->mode); out->writeSByte(m->fightCurTick); out->writeByte(m->id); out->writeByte(m->direction); out->writeByte(m->facing); out->writeUint16BE(m->flags); out->writeUint16BE(m->damageReceived); out->writeSint16BE(m->hitPoints); out->writeByte(m->speedTick); out->writeByte(m->type); out->writeByte(m->numDistAttacks); out->writeByte(m->curDistWeapon); out->writeSByte(m->distAttackTick); out->writeUint16BE(m->assignedItems); out->write(m->equipmentShapes, 4); } for (int ii = 0; ii < 8; ii++) { FlyingObject *m = &l->flyingObjects[ii]; out->writeByte(m->enable); out->writeByte(m->objectType); out->writeUint16BE(m->attackerId); out->writeSint16BE(m->item); out->writeUint16BE(m->x); out->writeUint16BE(m->y); out->writeByte(m->flyingHeight); out->writeByte(m->direction); out->writeByte(m->distance); out->writeSByte(m->field_D); out->writeByte(m->c); out->writeByte(m->flags); out->writeByte(m->wallFlags); } out->writeByte(l->monsterDifficulty); } out->finalize(); // check for errors if (out->err()) { warning("Can't write file '%s'. (Disk full?)", fileName); return Common::kUnknownError; } else { debugC(1, kDebugLevelMain, "Saved game '%s.'", saveName); } delete out; return Common::kNoError; }