// // <mapPathName>/<orbDirName>/<themeDirName> // void MapThemeManager::Private::addMapThemePaths( const QString& mapPathName, QStringList& result ) { QDir mapPath( mapPathName ); QStringList orbDirNames = mapPath.entryList( QStringList( "*" ), QDir::AllDirs | QDir::NoSymLinks | QDir::NoDotAndDotDot ); QStringListIterator itOrb( orbDirNames ); while ( itOrb.hasNext() ) { QString orbPathName = mapPathName + '/' + itOrb.next(); result << orbPathName; QDir orbPath( orbPathName ); QStringList themeDirNames = orbPath.entryList( QStringList( "*" ), QDir::AllDirs | QDir::NoSymLinks | QDir::NoDotAndDotDot ); QStringListIterator itThemeDir( themeDirNames ); while ( itThemeDir.hasNext() ) { QString themePathName = orbPathName + '/' + itThemeDir.next(); result << themePathName; QDir themePath( themePathName ); QStringList themeFileNames = themePath.entryList( QStringList( "*.dgml" ), QDir::Files | QDir::NoSymLinks ); QStringListIterator itThemeFile( themeFileNames ); while ( itThemeFile.hasNext() ) { QString themeFilePathName = themePathName + '/' + itThemeFile.next(); result << themeFilePathName; } } } }
AsyncValue<void*> DefaultServer::loadModule(CP::Poll& p, String path) { auto tmp = mgr->loadPage(p, rootDir(), mapPath(path.toSTDString())); if (tmp) return tmp()->dlHandle; auto* st = new moduleLoaderState(); tmp.wait(st); return Future<void*>(&st->cb); }
AsyncValue<Page*> DefaultServer::loadPage(CP::Poll& p, String path, RGC::Allocator& a) { auto tmp = mgr->loadPage(p, rootDir(), mapPath(path.toSTDString())); if (tmp) return tmp()->doCreate(&a); auto* st = a.New<pageLoaderState>(pageLoaderState { &a }); tmp.wait(st); return Future<Page*>(&st->cb); }
OovString ZoneNode::getMappedComponentName(ZonePathMap const &map) const { OovString compName = ZoneGraph::getComponentText(ModelClassifier::getClass( mType)->getModule()); OovString newName; if(mapPath(map, compName, newName)) { compName = newName; } return compName; }
void ZoneGraph::sortNodes() { for(auto &node : mNodes) { OovString mappedName; if(mapPath(mPathMap, ModelClassifier::getClass(node.mType)->getModule()-> getModulePath(), mappedName)) { node.setMappedName(mappedName); } else { node.clearMappedName(); } } std::sort(mNodes.begin(), mNodes.end(), [](ZoneNode const &n1, ZoneNode const &n2) { return(n1.getMappedNameForSorting() < n2.getMappedNameForSorting()); } ); }
bool GameBoard::initialize() { if ( this->blocks ) { return false; } QString mapPath( "levels/" ); mapPath += name; mapPath += ".txt"; QFile map( mapPath ); if ( ! map.exists() ) { return false; } if ( ! map.open( QIODevice::ReadOnly | QIODevice::Text ) ) { return false; } if ( ! this->readBoardSize( map ) ) { return false; } if ( ! this->readBoardBlocks( map ) ) { return false; } this->wallMaterial.setSpecular( 1.0f, 1.0f, 1.0f ); this->wallMaterial.setShininess( 20.0f ); this->dotsMaterial.setSpecular( 1.0f, 1.0f, 1.0f ); this->dotsMaterial.setShininess( 30.0f ); this->grassMaterial.setSpecular( 0.8f, 1.0f, 0.9f ); this->grassMaterial.setShininess( 10.0f ); return true; }
//!*************************************************************** //! @details: //! attaches the correct map loader to the engine and loads the //! map file //! //! @return: //! void //! //!*************************************************************** void Game::CreateMap() { if (m_engine->getModel() && m_engine->getVFS() && m_engine->getImageManager() && m_engine->getRenderBackend()) { // create the default loader for the FIFE map format //FIFE::DefaultMapLoader* mapLoader = FIFE::createDefaultMapLoader(m_engine->getModel(), m_engine->getVFS(), // m_engine->getImagePool(), m_engine->getAnimationPool(), m_engine->getRenderBackend()); FIFE::MapLoader* mapLoader = new FIFE::MapLoader(m_engine->getModel(), m_engine->getVFS(), m_engine->getImageManager(), m_engine->getRenderBackend()); fs::path mapPath("assets/maps/shrine.xml"); if (mapLoader) { // load the map m_map = mapLoader->load(mapPath.string()); } // done with map loader safe to delete delete mapLoader; mapLoader = 0; } }
bool QLCFixtureDefCache::loadMap(const QDir &dir) { qDebug() << Q_FUNC_INFO << dir.path(); if (dir.exists() == false || dir.isReadable() == false) return false; QString mapPath(dir.absoluteFilePath(FIXTURES_MAP_NAME)); if (mapPath.isEmpty() == true) return false; // cache the map path to be used when composing the fixture // definition absolute path m_mapAbsolutePath = dir.absolutePath(); QXmlStreamReader *doc = QLCFile::getXMLReader(mapPath); if (doc == NULL || doc->device() == NULL || doc->hasError()) { qWarning() << Q_FUNC_INFO << "Unable to read from" << mapPath; return false; } while (!doc->atEnd()) { if (doc->readNext() == QXmlStreamReader::DTD) break; } if (doc->hasError()) { QLCFile::releaseXMLReader(doc); return false; } // make sure the doc type is FixtureMap if (doc->dtdName() != KXMLQLCFixtureMap) { qWarning() << Q_FUNC_INFO << mapPath << "is not a fixture map file"; QLCFile::releaseXMLReader(doc); return false; } if (doc->readNextStartElement() == false) { QLCFile::releaseXMLReader(doc); return false; } // make sure the root tag is FixtureMap if (doc->name() != KXMLQLCFixtureMap) { qWarning() << Q_FUNC_INFO << mapPath << "is not a fixture map file"; QLCFile::releaseXMLReader(doc); return false; } int fxCount = 0; QString manufacturer = ""; while (doc->readNextStartElement()) { if (doc->name() == "M") { if (doc->attributes().hasAttribute("n")) { manufacturer = doc->attributes().value("n").toString(); fxCount += loadMapManufacturer(doc, manufacturer); } } else { qWarning() << Q_FUNC_INFO << "Unknown Fixture Map tag: " << doc->name(); doc->skipCurrentElement(); } } qDebug() << fxCount << "fixtures found in map"; #if 0 /* Attempt to read all files not in FixtureMap */ QStringList definitionPaths; // Gather a list of manufacturers QListIterator <QLCFixtureDef*> mfit(m_defs); while (mfit.hasNext() == true) definitionPaths << mfit.next()->definitionSourceFile(); QStringListIterator it(dir.entryList()); while (it.hasNext() == true) { QString path(dir.absoluteFilePath(it.next())); if (definitionPaths.contains(path)) continue; qWarning() << path << "not in" << FIXTURES_MAP_NAME; if (path.toLower().endsWith(KExtFixture) == true) loadQXF(path); else if (path.toLower().endsWith(KExtAvolitesFixture) == true) loadD4(path); else qWarning() << Q_FUNC_INFO << "Unrecognized fixture extension:" << path; } #endif return true; }
string findOnPath(string path, string filename) { return (string) mapPath(checkExists, path, filename, NULL); }
FILE *openOnPath(string path, string filename, string mode) { return (FILE *) mapPath(openFile, path, filename, mode); }
static bool HandleServerDebugCommand(ChatHandler* handler, char const* /*args*/) { uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD)); std::string dbPortOutput; { uint16 dbPort = 0; if (QueryResult res = LoginDatabase.PQuery("SELECT port FROM realmlist WHERE id = %u", realm.Id.Realm)) dbPort = (*res)[0].GetUInt16(); if (dbPort) dbPortOutput = Trinity::StringFormat("Realmlist (Realm Id: %u) configured in port %" PRIu16, realm.Id.Realm, dbPort); else dbPortOutput = Trinity::StringFormat("Realm Id: %u not found in `realmlist` table. Please check your setup", realm.Id.Realm); } handler->PSendSysMessage("%s", GitRevision::GetFullVersion()); handler->PSendSysMessage("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); handler->PSendSysMessage("Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); handler->PSendSysMessage("Using MySQL version: %s", MYSQL_SERVER_VERSION); handler->PSendSysMessage("Using CMake version: %s", GitRevision::GetCMakeVersion()); handler->PSendSysMessage("Compiled on: %s", GitRevision::GetHostOSVersion()); uint32 updateFlags = sConfigMgr->GetIntDefault("Updates.EnableDatabases", DatabaseLoader::DATABASE_NONE); if (!updateFlags) handler->SendSysMessage("Automatic database updates are disabled for all databases!"); else { static char const* const databaseNames[3 /*TOTAL_DATABASES*/] = { "Auth", "Characters", "World" }; std::string availableUpdateDatabases; for (uint32 i = 0; i < 3 /* TOTAL_DATABASES*/; ++i) { if (!(updateFlags & (1 << i))) continue; availableUpdateDatabases += databaseNames[i]; if (i != 3 /*TOTAL_DATABASES*/ - 1) availableUpdateDatabases += ", "; } handler->PSendSysMessage("Automatic database updates are enabled for the following databases: %s", availableUpdateDatabases.c_str()); } handler->PSendSysMessage("Worldserver listening connections on port %" PRIu16, worldPort); handler->PSendSysMessage("%s", dbPortOutput.c_str()); bool vmapIndoorCheck = sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK); bool vmapLOSCheck = VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled(); bool vmapHeightCheck = VMAP::VMapFactory::createOrGetVMapManager()->isHeightCalcEnabled(); bool mmapEnabled = sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS); std::string dataDir = sWorld->GetDataPath(); std::vector<std::string> subDirs; subDirs.emplace_back("maps"); if (vmapIndoorCheck || vmapLOSCheck || vmapHeightCheck) { handler->PSendSysMessage("VMAPs status: Enabled. LineOfSight: %i, getHeight: %i, indoorCheck: %i", vmapLOSCheck, vmapHeightCheck, vmapIndoorCheck); subDirs.emplace_back("vmaps"); } else handler->SendSysMessage("VMAPs status: Disabled"); if (mmapEnabled) { handler->SendSysMessage("MMAPs status: Enabled"); subDirs.emplace_back("mmaps"); } else handler->SendSysMessage("MMAPs status: Disabled"); for (std::string const& subDir : subDirs) { boost::filesystem::path mapPath(dataDir); mapPath.append(subDir); if (!boost::filesystem::exists(mapPath)) { handler->PSendSysMessage("%s directory doesn't exist!. Using path: %s", subDir.c_str(), mapPath.generic_string().c_str()); continue; } auto end = boost::filesystem::directory_iterator(); std::size_t folderSize = std::accumulate(boost::filesystem::directory_iterator(mapPath), end, std::size_t(0), [](std::size_t val, boost::filesystem::path const& mapFile) { if (boost::filesystem::is_regular_file(mapFile)) val += boost::filesystem::file_size(mapFile); return val; }); handler->PSendSysMessage("%s directory located in %s. Total size: " SZFMTD " bytes", subDir.c_str(), mapPath.generic_string().c_str(), folderSize); } LocaleConstant defaultLocale = sWorld->GetDefaultDbcLocale(); uint32 availableLocalesMask = (1 << defaultLocale); for (uint8 i = 0; i < TOTAL_LOCALES; ++i) { LocaleConstant locale = static_cast<LocaleConstant>(i); if (locale == defaultLocale) continue; if (sWorld->GetAvailableDbcLocale(locale) != defaultLocale) availableLocalesMask |= (1 << locale); } std::string availableLocales; for (uint8 i = 0; i < TOTAL_LOCALES; ++i) { if (!(availableLocalesMask & (1 << i))) continue; availableLocales += localeNames[i]; if (i != TOTAL_LOCALES - 1) availableLocales += " "; } handler->PSendSysMessage("Using %s DBC Locale as default. All available DBC locales: %s", localeNames[defaultLocale], availableLocales.c_str()); handler->PSendSysMessage("Using World DB: %s", sWorld->GetDBVersion()); return true; }
String DefaultServer::loadStaticPage(String path) { return mgr->loadStaticPage(mapPath(path.toSTDString()))->data; }