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


C++ DataTable::load方法代码示例

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


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

示例1: install

// ----------------------------------------------------------------------
void Squad::install()
{
	DEBUG_FATAL(s_installed, ("Already installed"));

	// Create the data table

	Iff iff;

	if (iff.open("datatables/space_mobile/space_mobile.iff", true))
	{
		DataTable dataTable;
		dataTable.load(iff);

		int const rowCount = dataTable.getNumRows();

		for (int row = 0; row < rowCount; ++row)
		{
			PersistentCrcString const shipName(dataTable.getStringValue("strIndex", row), false);
			int const formationPriority = dataTable.getIntValue("formationPriority", row);
			
			IGNORE_RETURN(s_formationPriorityList.insert(std::make_pair(shipName, formationPriority)));

			LOGC((ConfigServerGame::isSpaceAiLoggingEnabled() && formationPriority  <= 0), "space_debug_ai", ("Squad::install() ERROR: Invalid formationPriority(%d) specified for shipName(%s)", formationPriority, shipName.getString()));
		}
	}
	else
	{
		DEBUG_WARNING(true, ("Unable to load space_mobile.iff to retrieve formation priorities!"));
	}

	ExitChain::add(&remove, "Squad::remove");

	s_installed = true;
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:35,代码来源:Squad.cpp

示例2: load

void SocialsManager::load (const std::string & filename)
{	
	Iff iff;
	
	if (!iff.open (filename.c_str (), true))
		WARNING (true, ("Data file %s not available.", filename.c_str ()));
	else
	{
		DataTable dt;
		dt.load (iff);
		iff.close ();

		const int numRows = dt.getNumRows ();

		uint32 count = 0;
		for (int i = 0; i < numRows; ++i)
		{
			const std::string & name = Unicode::toLower (dt.getStringValue (DC_name, i));
			++count;

			s_idToNameMap.insert (std::make_pair (count, name));
			s_crcToNameMap.insert (std::make_pair (Crc::calculate(name.c_str()), name));

			const std::pair<StringIntMap::const_iterator, bool> retval = s_nameToIdMap.insert (std::make_pair (name, count));

			if (!retval.second)
				WARNING_STRICT_FATAL (true, ("SocialsManager file '%s' duplicate social type '%s'", filename.c_str (), name.c_str ()));
		}
	}
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:30,代码来源:SocialsManager.cpp

示例3: open

DataTable* DataTableManager::open(const std::string& table)
{
	FATAL(!m_installed, ("DataTableManager::open: not installed."));
	DataTable *retVal = getTable(table, false);
	if (retVal)
		return retVal;

	if (!TreeFile::exists(table.c_str()))
	{
		DEBUG_WARNING(true, ("Could not find treefile table for open [%s]", table.c_str()));
		return 0;
	}

	Iff iff(table.c_str(), false);
	retVal = new DataTable;
	retVal->load(iff);

	m_cachedTable = retVal;
	m_cachedTableName = table;
	m_tables[table] = retVal;

	return retVal;
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:23,代码来源:DataTableManager.cpp

示例4: install

void ShipTurretManager::install() // static
{
    InstallTimer const installTimer("ShipTurretManager::install");

    Iff iff;
    if (iff.open("datatables/space/ship_turret.iff", true))
    {
        DataTable dataTable;
        dataTable.load(iff);
        int numberOfRows = dataTable.getNumRows();
        for (int row = 0; row < numberOfRows; ++row)
        {
            std::string const chassisName(dataTable.getStringValue("chassis", row));
            ShipChassis const * const chassis = ShipChassis::findShipChassisByName(TemporaryCrcString(chassisName.c_str(), false));
            FATAL(!chassis, ("ShipTurretManager::install: no such chassis '%s'", chassisName.c_str()));
            int const weaponIndex = dataTable.getIntValue("weaponIndex", row);
            ShipTurretData &shipTurretData = s_shipTurretData[chassis->getCrc()][weaponIndex];
            shipTurretData.minYaw = dataTable.getFloatValue("minYaw", row) * PI_OVER_180;
            shipTurretData.maxYaw = dataTable.getFloatValue("maxYaw", row) * PI_OVER_180;
            shipTurretData.minPitch = dataTable.getFloatValue("minPitch", row) * PI_OVER_180;
            shipTurretData.maxPitch = dataTable.getFloatValue("maxPitch", row) * PI_OVER_180;
        }
    }
}
开发者ID:grserver,项目名称:infinity,代码行数:24,代码来源:ShipTurretManager.cpp


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