Status indexDoc(DbMap *docStore, RedBlack *entry, void *params) { Params *p = params; value_t val, name; Handle *handle; DbMap *index; name.bits = vt_string; name.aux = entry->keyLen; name.str = (uint8_t *)entry->key; val = openMap(name, docStore, 0, 0, false); if ((handle = val.handle)) index = handle->object; else return OK; if (index->arena->drop) return OK; switch(index->arena->type) { case Hndl_artIndex: return artIndexKey (index, p->doc, p->docId, p->txn->set); case Hndl_btreeIndex: return btreeIndexKey (index, p->doc, p->docId); case Hndl_colIndex: return OK; } fprintf(stderr, "unknown index type %d\n", index->arena->type); exit(1); }
void renderCutscene() { if (CutsceneTimer < Ctime + charWait) //Total time of cutscene { for (int y = 0;y < 30;++y) { for (int x = 0;x < 80;++x) { console.writeToBuffer( x, y, CutsceneWalls[x][y] , 0x08); } } if (CutsceneDialogTimer > (Ctime + charWait)/24) { CutsceneDialogTimer = 0; CutscenePoint++; renderCutscenedialog(CutDialog[CutscenePoint]); } else { renderCutscenedialog(CutDialog[CutscenePoint]); } renderCutsceneCharacter(); } else { MusicWillPlay(1); CutsceneTimer = 0; CutsceneCharTimer = 0; state = InMaze; openMap(level); DialogueIsRunning = true; x = 0; } }
GPIORelaisController::GPIORelaisController() { info_printf("constructur GPIORelaisController\n"); allRelaisBits = allRelaisValue(); if (openMap()) { setOffAllRelais(); } }
kgeography::kgeography() : KMainWindow(), p_firstShow(true), p_mustShowResultsDialog(false) { p_map = 0; p_askWidget = 0; p_bigWidget = new QHBox(this); QVBox *p_leftWidget = new QVBox(p_bigWidget); p_currentMap = new QLabel(p_leftWidget); p_currentMap -> setAlignment(AlignCenter); p_consult = new KPushButton(i18n("&Browse Map"), p_leftWidget); QWhatsThis::add(p_consult, i18n("In this section left click on any part of the map to learn about the divisions" )); p_askMap = new KPushButton(i18n("&Click Division in Map..."), p_leftWidget); QWhatsThis::add(p_askMap, i18n("In this challenge you are given a division name on the left under the menu and you must find it on the map and click on it")); p_askCapitalDivisions = new KPushButton(i18n("Guess Division From Its &Capital..."), p_leftWidget); QWhatsThis::add(p_askCapitalDivisions, i18n("In this quiz you have to guess the division name given its capital")); p_askDivisionCapitals = new KPushButton(i18n("Guess Capital of &Division..."), p_leftWidget); QWhatsThis::add(p_askDivisionCapitals, i18n("In this quiz you have to guess the capital of a given division name")); p_askFlagDivisions = new KPushButton(i18n("&Guess Division From Its Flag..."), p_leftWidget); QWhatsThis::add(p_askFlagDivisions, i18n("In this quiz you have to guess the division name given its flag")); p_askDivisionFlags = new KPushButton(i18n("G&uess Flag of Division..."), p_leftWidget); QWhatsThis::add(p_askDivisionFlags, i18n("In this quiz you have to guess the flag of a division given its name")); p_underLeftWidget = new QVBox(p_leftWidget); p_underLeftWidget -> layout() -> setSpacing(KDialog::spacingHint()); p_underLeftWidget -> layout() -> setMargin(KDialog::marginHint()); p_leftWidget -> setStretchFactor(p_underLeftWidget, 1); setCentralWidget(p_bigWidget); connect(p_consult, SIGNAL(clicked()), this, SLOT(consult())); connect(p_askMap, SIGNAL(clicked()), this, SLOT(askMap())); connect(p_askCapitalDivisions, SIGNAL(clicked()), this, SLOT(askCapitalDivisions())); connect(p_askDivisionCapitals, SIGNAL(clicked()), this, SLOT(askDivisionCapitals())); connect(p_askFlagDivisions, SIGNAL(clicked()), this, SLOT(askFlagDivisions())); connect(p_askDivisionFlags, SIGNAL(clicked()), this, SLOT(askDivisionFlags())); KAction *a = KStdAction::open(this, SLOT(openMap()), actionCollection(), "openMap"); a -> setText(i18n("&Open Map...")); KStdAction::quit(this, SLOT(close()), actionCollection(), "quit"); p_zoom = new KToggleAction(i18n("&Zoom"), "viewmagfit", 0, 0, 0, actionCollection(), "zoom_select"); p_zoom -> setEnabled(false); p_zoomOriginal = new KAction(i18n("&Original Size"), "viewmag1", 0, 0, 0, actionCollection(), "zoom_original"); p_zoomOriginal -> setEnabled(false); p_move = new KToggleAction(i18n("&Move"), "move", 0, 0, 0, actionCollection(), "move"); p_move -> setEnabled(false); new KAction(i18n("Disclaimer"), 0, this, SLOT(disclaimer()), actionCollection(), "disclaimer"); setupGUI(Keys | ToolBar | Save | Create); show(); }
void kgeography::showEvent(QShowEvent *) { if (p_firstShow) { QString file = kgeographySettings::self() -> lastMap(); if (QFile::exists(file)) { mapReader reader; if (reader.parseMap(file)) { setMap(reader.getMap()); } else { KMessageBox::error(this, i18n("Could not open last used map. Error parsing %1: %2").arg(file).arg(reader.getError())); delete reader.getMap(); openMap(); } } else openMap(); if (!p_map) { p_currentMap -> setText(i18n("There is no current map")); p_consult -> setEnabled(false); p_askMap -> setEnabled(false); p_askFlagDivisions -> setEnabled(false); p_askDivisionFlags -> setEnabled(false); p_askCapitalDivisions -> setEnabled(false); p_askDivisionCapitals -> setEnabled(false); } // if anyone can explain why with the slot works and now without // i'll be glad to learn QTimer::singleShot(0, this, SLOT(resizeMainWindow())); // resizeMainWindow(); p_firstShow = false; } }
void MainWindow::createMap(QString path, int bgWidth, int bgHeight, QString mapName, int mapStep, bool isImage) { QListWidget *tokenList = ui->tokenPage->getUi()->m_tokenList; TokenItem *currentTokenItem = dynamic_cast<TokenItem*>(tokenList->currentItem()); bool isMj = (m_User->getRole() == Role::ROLE_MJ); Map *map = new Map(isImage, mapName, path, bgWidth, bgHeight, currentTokenItem, mapStep, isMj); // Add Map to the database RepositoryManager::s_MapRepository.insertMap(map); // Initialize and open map openMap(map, true); }
QgsGrassVectorMap::QgsGrassVectorMap( const QgsGrassObject &grassObject ) : mGrassObject( grassObject ) , mValid( false ) , mOpen( false ) , mFrozen( false ) , mIsEdited( false ) , mVersion( 0 ) , mIs3d( false ) , mOldNumLines( 0 ) { QgsDebugMsg( "grassObject = " + grassObject.toString() ); openMap(); mOpen = true; }
bool QgsGrassVectorMap::open() { QgsDebugMsg( toString() ); if ( mOpen ) { QgsDebugMsg( "already open" ); return true; } lockOpenClose(); bool result = openMap(); mOpen = true; unlockOpenClose(); return result; }
/** * @brief MapClient::openMapAction Opens a map with the given id. * @param msg QString containing the id of the map to open. */ void MapClient::openMapAction(const QString& msg) { int mapId = msg.toInt(); // If the map has already been opened, don't open it again if (containsMap(mapId)) { return; } Map *map = RepositoryManager::s_MapRepository.findMapById(mapId, m_TokenList, this->m_User->getRole()); map->getMapLayer()->setTokenItem(m_TokenList->currentItem()); emit openMap(map); }
/* MapEditorWindow::createMap * Opens the map editor launcher dialog to create a new map *******************************************************************/ bool MapEditorWindow::createMap() { MapEditorConfigDialog dialog(theMainWindow, NULL, false, true); if (dialog.ShowModal() == wxID_OK) { Archive::mapdesc_t map = dialog.selectedMap(); theGameConfiguration->openConfig(dialog.selectedGame(), dialog.selectedPort(), map.format); if (map.name.IsEmpty()) return false; else return openMap(map); } return false; }
value_t createDocStore(DbMap *map, value_t name, uint64_t size, bool onDisk, bool *created) { DbMap *docStore; Handle *hndl; value_t val; writeLock(map->arena->childLock); val = openMap(name, map, sizeof(DbStore), size, onDisk); rwUnlock(map->arena->childLock); val.subType = Hndl_docStore; hndl = val.handle; docStore = hndl->object; docStore->arena->idSize = sizeof(DbAddr); docStore->arena->type = Hndl_docStore; *created = docStore->created; return val; }
void MainWindow::on_actionOpenMap_triggered() { int mapId = 0; OpenMapWidget openMapWidget(&mapId); openMapWidget.exec(); // If the map has already been opened, don't open it again Receiver *mapClientReceiver = m_Client->getReceiver(TargetCode::MAP_CLIENT); MapClient *mapClient = dynamic_cast<MapClient*>(mapClientReceiver); if (mapClient->containsMap(mapId)) { return; } if (mapId != 0) { TokenList *tokenList = ui->tokenPage->getUi()->m_tokenList; Map *map = RepositoryManager::s_MapRepository.findMapById(mapId, tokenList, m_User->getRole()); map->getMapLayer()->setTokenItem(tokenList->currentItem()); openMap(map, true); } }
int World::openMap_bind(LuaState& lua) { auto worldSystemName = lua.pullStack<std::string>(1); auto worldSystem = single<Core>().getSystemByName<World>(worldSystemName); if (worldSystem == nullptr) { error("World system '", worldSystemName, "' does not exist!"); return 0; } auto mapName = lua.pullStack<std::string>(2); auto callbackRef = lua.createReference(); worldSystem->openMap(mapName, callbackRef); return 0; }
bool EditorMainWindow::openScenario(const char *file) { wml::node_ptr old_scenario = scenario_; if(file) { fname_ = file; scenario_ = wml::parse_wml(sys::read_file(file)); } else { fname_ = ""; scenario_ = wml::parse_wml( "[scenario]" "map_data=\"" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\n" "0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h, 0 h\"\n" "[/scenario]"); } if(!scenario_) { return false; } if(!openMap(scenario_)) { scenario_ = old_scenario; return false; } parties_.clear(); std::vector<wml::node_ptr> parties = wml::child_nodes(scenario_, "party"); foreach(wml::node_ptr party, parties) { hex::location loc(wml::get_int(party,"x"),wml::get_int(party,"y")); parties_[loc] = party; }
PathNode* Astar::findPath( INT a_iSx, INT a_iSy, INT a_iEx, INT a_iEy ) { PathNode* path = NULL; // 타겟 위치와 같은 위치면 탐색 중지 if( a_iSx == a_iEx && a_iSy == a_iEy ) { return NULL; } // 타겟 위치가 가지 못하는 곳이거나 // 타겟 위치 기준 8방향이 가지 못하는 곳이면 탐색 중지 if( m_Map[a_iEx][a_iEy].map == 1 || ( m_Map[a_iEx+0][a_iEy-1].map == 1 && m_Map[a_iEx+1][a_iEy-1].map == 1 && m_Map[a_iEx+1][a_iEy+0].map == 1 && m_Map[a_iEx+1][a_iEy+1].map == 1 && m_Map[a_iEx+0][a_iEy+1].map == 1 && m_Map[a_iEx-1][a_iEy-1].map == 1 && m_Map[a_iEx-1][a_iEy+0].map == 1 && m_Map[a_iEx-1][a_iEy-1].map == 1 ) ) { return NULL; } m_Start[0] = a_iSx; m_Start[1] = a_iSy; m_End[0] = a_iEx; m_End[1] = a_iEy; INT x = a_iSx; INT y = a_iSy; m_Map[x][y].visit = TRUE; m_Map[x][y].cameX = -1; m_Map[x][y].cameY = -1; m_Map[x][y].g = 0; m_Map[x][y].h = getDistH( x,y ); m_Map[x][y].f = getDistF( x,y ); insert( m_pOpen, createNode( x,y ) ); INT v[2]; while( getminimum( v ) ) { x = v[0]; y = v[1]; m_Map[x][y].map = 4; if( x == m_End[0] && y == m_End[1] ) { break; } for( INT i=0; i<8; ++i ) { openMap( x, y, x + m_Dir[i][0], y + m_Dir[i][1] ); } } m_Map[a_iSx][a_iSy].map = 10; m_Map[a_iEx][a_iEy].map = 20; removeTree( m_pOpen ); m_pOpen->root = NULL; return getPath( m_Start[0], m_Start[1], m_End[0], m_End[1] ); }
DebugInfo::DebugInfo() { ASSERT(!perfMap); openMap(); }
void PlayerPanel::onKeyDown(Event::Keyboard* event) { switch (event->keyCode()) { case SDLK_a: // @TODO: initiateCombat(); break; case SDLK_c: openCharacterScreen(); break; case SDLK_i: openInventory(); break; case SDLK_p: if (event->controlPressed()) { // @TODO: pause game } else { openPipBoy(); } break; case SDLK_z: openPipBoy(); // @TODO: go to clock break; case SDLK_ESCAPE: case SDLK_o: openGameMenu(); break; case SDLK_b: changeHand(); break; // M button is handled in State::Location case SDLK_n: // @TODO: toggleItemMode(); break; case SDLK_s: if (event->controlPressed()) { openSaveGame(); } else { openSkilldex(); } break; case SDLK_l: if (event->controlPressed()) { openLoadGame(); } break; case SDLK_x: if (event->controlPressed()) { Game::getInstance()->pushState(new State::ExitConfirm()); playWindowOpenSfx(); } case SDLK_SLASH: // @TODO: printCurrentTime(); break; case SDLK_TAB: openMap(); break; case SDLK_F1: // @TODO: help screen break; case SDLK_F2: // @TODO: volume down break; case SDLK_F3: // @TODO: volume up break; case SDLK_F4: if (!event->altPressed()) { openSaveGame(); } break; case SDLK_F5: openLoadGame(); break; case SDLK_F6: // @TODO: quick save logic break; case SDLK_F7: // @TODO: quick load logic break; case SDLK_F10: Game::getInstance()->pushState(new State::ExitConfirm()); playWindowOpenSfx(); break; case SDLK_F12: // @TODO: save screenshot break; } }