当前位置: 首页>>代码示例>>C++>>正文


C++ NPC::getPositionCurrent方法代码示例

本文整理汇总了C++中NPC::getPositionCurrent方法的典型用法代码示例。如果您正苦于以下问题:C++ NPC::getPositionCurrent方法的具体用法?C++ NPC::getPositionCurrent怎么用?C++ NPC::getPositionCurrent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NPC的用法示例。


在下文中一共展示了NPC::getPositionCurrent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadIFOs

bool WorldServer::loadIFOs(Map* curMap, STBFile& warpFile) {
	std::string folderPath = std::string(curMap->getMapPath());
	if (folderPath.length() == 0)
		return true;
#ifdef __ROSE_USE_VFS__
	//dword_t fileAmount = this->vfs->getFileCountFromFolder(folderPath.c_str());
	std::vector<std::string> files = this->vfs->getFileNamesFromFolder(folderPath.c_str() , ".ifo");
#else
	folderPath = workingPath + std::string("\\") + folderPath.substr(0, folderPath.find_last_of("\\") + 1);

	//Get all IFOs from the current map directory
	QuickInfo::getFilesFromDirectoryA(folderPath, std::string(".ifo"), files);
	if (files.size() == 0) {
		//In case there are none (for whatever reason), don't do anything
		return true;
	}
#endif
 	this->teleGates.reserve(warpFile.getRowCount());
	for (unsigned int i = 0; i < this->teleGates.capacity(); i++)
		this->teleGates.addValue(Telegate());

	/** ASSIGN SECTORS **/
	curMap->setSectorWidthAndHeight(this->zoneFile->getZoneSize(curMap->getId()));

	//As precaution, as some Maps seem to have 0 as ZoneSize
	if (curMap->getSectorWidthAndHeight() == 0) {
		curMap->setSectorWidthAndHeight(IFO::CUSTOMIZED_SECTOR_SIZE);
	}
	curMap->createSectors(files);

	//Iterate through all *.ifo files
	GlobalLogger::debug("Loading IFOs from path %s...\n", folderPath.c_str());
	for (unsigned int j = 0; j < files.size(); j++) {
		VFSData fileData; this->vfs->readFile(files.at(j).c_str(), fileData);
		IFO ifo(&fileData);

		//Add all spawns of the current *.ifo to the map
		for (unsigned int k = 0; k < ifo.getSpawnAmount(); k++) {
			curMap->addSpawn(new IFOSpawn(ifo.getSpawn(k)));
		}
		//Add all (IFO-)NPCs to the map
		for (unsigned int k = 0; k < ifo.getNPCAmount(); k++) {
			IFONPC& npcINFO = ifo.getNPC(k);
			NPCData& npcData = this->npcData.at(npcINFO.getObjectId());
			NPC *newNpc = new NPC(&npcData, &this->aiData.getValue(npcData.getAIId()), curMap->getId(), npcINFO.getPosition());
			newNpc->setDirection(npcINFO.getDirection());
			newNpc->setSector(curMap->getSector(newNpc->getPositionCurrent()));
			this->globalNPCs.push_back(newNpc);
		}
		//Create telegates from the previously read IFO-info
		this->loadTelegates(curMap->getId(), warpFile, ifo);
	}
	return true;
}
开发者ID:DerBasti,项目名称:DreamROSE,代码行数:54,代码来源:WorldServer.cpp


注:本文中的NPC::getPositionCurrent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。