本文整理汇总了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;
}
示例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 ()));
}
}
}
示例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;
}
示例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;
}
}
}