本文整理汇总了C++中nlgeorges::UFormElm类的典型用法代码示例。如果您正苦于以下问题:C++ UFormElm类的具体用法?C++ UFormElm怎么用?C++ UFormElm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UFormElm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build
//-----------------------------------------------
// build :
// Build the sheet from an external script.
//-----------------------------------------------
void CMissionSheet::build(const NLGEORGES::UFormElm &item)
{
// Load the descriptors.
if(!item.getValueByName(Name, "Name"))
debug("key 'Name' not found.");
if(!item.getValueByName(Description, "Description"))
debug("key 'Description' not found.");
if(!item.getValueByName(RewardDescription, "RewardDescription"))
debug("key 'RewardDescription' not found.");
// load mission steps description
for (uint i =1; i< NB_STEPS_PER_MISSION + 1;i++)
{
const UFormElm * stepStruct;
string varName = string("step") + NLMISC::toString(i);
item.getNodeByName (&stepStruct, varName.c_str());
if (stepStruct)
{
string stepDesc;
stepStruct->getValueByName(stepDesc,"Description");
if ( !stepDesc.empty() )
StepsDescription.push_back(stepDesc);
}
}
}// build //
示例2: buildFogMapBuild
void CContinentParameters::buildFogMapBuild(const NLGEORGES::UFormElm &item)
{
item.getValueByName (FogMapBuild.Map[CFogMapBuild::Day], "FogDayMap");
item.getValueByName (FogMapBuild.Map[CFogMapBuild::Night], "FogNightMap");
item.getValueByName (FogMapBuild.Map[CFogMapBuild::Distance], "FogDistMap");
item.getValueByName (FogMapBuild.Map[CFogMapBuild::Depth], "FogDepthMap");
item.getValueByName (FogMapBuild.Map[CFogMapBuild::NoPrecipitation], "NoRainMap");
item.getValueByName (FogStart, "FogStart");
item.getValueByName (FogEnd, "FogEnd");
item.getValueByName (FogMapBuild.ZoneMin, "ZoneMin");
item.getValueByName (FogMapBuild.ZoneMax, "ZoneMax");
if (FogStart > FogEnd)
{
std::swap(FogStart, FogEnd);
}
if (!item.getValueByName (RootFogStart, "RootFogStart"))
{
RootFogStart = FogStart;
}
if (!item.getValueByName (RootFogEnd, "RootFogEnd"))
{
RootFogEnd = FogEnd;
}
if (RootFogStart > RootFogEnd)
{
std::swap(RootFogStart, RootFogEnd);
}
}
示例3: importForm
void CStreamSound::importForm(const std::string &filename, NLGEORGES::UFormElm &root)
{
// cannot do this debug check because used also by CStreamFileSound
/*NLGEORGES::UFormElm *psoundType;
std::string dfnName;
// some basic checking.
root.getNodeByName(&psoundType, ".SoundType");
nlassert(psoundType != NULL);
psoundType->getDfnName(dfnName);
nlassert(dfnName == "stream_sound.dfn");*/
// Call the base class
CSound::importForm(filename, root);
// MaxDistance
root.getValueByName(_MaxDist, ".SoundType.MaxDistance");
// MinDistance
root.getValueByName(_MinDist, ".SoundType.MinDistance");
// Alpha
root.getValueByName(m_Alpha, ".SoundType.Alpha");
#if NLSOUND_SHEET_VERSION_BUILT < 2
_GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER);
#endif
}
示例4: build
// ****************************************************************************
void COutpostSheet::build(const NLGEORGES::UFormElm &root)
{
root.getValueByName(NbMaxSpawnedSquad, "Max Number of Spawned Squads");
root.getValueByName(NbMaxSpawnedMercenarySquad, "Max Number of Spawned Mercenary Squads");
root.getValueByName(ChallengeCost, "Challenge Cost");
root.getValueByName(MaxTotalSquad, "Max Total Squads");
}
示例5: build
// ***************************************************************************************************
void CPlantInfo::build(const NLGEORGES::UFormElm &item)
{
item.getValueByName(SheetName, "File name");
item.getValueByName(Weight, "MicroLifeWeight");
if (Weight == 0)
{
nlwarning("Plant with weight equal to 0");
}
}
示例6: build
//-----------------------------------------------
// build
//-----------------------------------------------
bool CFXStickMode::build(const NLGEORGES::UFormElm &item, const std::string &prefix /* = ""*/)
{
bool ok = true;
uint32 stickMode;
ok &= item.getValueByName(stickMode, (prefix + "StickMode").c_str());
if (ok) Mode = (CFXStickMode::TStickMode) stickMode;
std::string userBoneName;
ok &= item.getValueByName(userBoneName, (prefix + "UserBone").c_str());
UserBoneName = NLMISC::CStringMapper::map(userBoneName);
return ok;
}// build //
示例7: build
//-----------------------------------------------
// build :
// Build the sheet from an external script.
//-----------------------------------------------
void CBuildingSheet::build(const NLGEORGES::UFormElm &item)
{
// Load the name.
if(!item.getValueByName(BuildedIg, "builded_ig"))
debug("builded_ig not found.");
if(!item.getValueByName(BuildedIcon, "builded_icon"))
debug("builded_icon not found.");
if(!item.getValueByName(BuildingIcon, "building_icon"))
debug("building_icon not found.");
if(!item.getValueByName(Name, "name"))
debug("name not found.");
}// build //
示例8: build
//===============================================================================
void CWorldSheet::build(const NLGEORGES::UFormElm &item)
{
const UFormElm *pElt;
uint size;
nlverify (item.getNodeByName (&pElt, "continents list"));
if(!pElt)
{
nlwarning("node 'continents list' not found in a .world");
}
else
{
nlverify (pElt->getArraySize (size));
ContLocs.reserve(size);
for (uint32 i = 0; i <size; ++i)
{
const UFormElm *pEltOfList;
// Get the continent
if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList)
{
SContLoc clTmp;
clTmp.build (pEltOfList);
ContLocs.push_back (clTmp);
}
}
item.getValueByName (Name, "name");
}
// Maps loading
nlverify (item.getNodeByName (&pElt, "maps list"));
if(!pElt)
{
nlwarning("node 'maps list' is not found in a .world");
}
else
{
nlverify (pElt->getArraySize (size));
Maps.reserve(size);
for (uint32 i = 0; i < size; ++i)
{
const UFormElm *pEltOfList;
// Get the continent
if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList)
{
SMap mapTmp;
mapTmp.build (pEltOfList);
Maps.push_back (mapTmp);
}
}
}
}
示例9: build
//=============================================================================
void CWeatherFunctionSheet::build(const NLGEORGES::UFormElm &item)
{
const NLGEORGES::UFormElm *elm;
uint numSetups = 0;
// get list of weather setups from the form
if(item.getNodeByName (&elm, "WeatherSetups") && elm)
{
// Get number of setups
nlverify (elm->getArraySize (numSetups));
SetupNames.resize(numSetups);
// For each setup
for(uint k = 0; k < numSetups; ++k)
{
if (!elm->getArrayValue(SetupNames[k], k))
{
nlwarning("Can't read weather setup from form");
}
}
}
uint numWeights = 0;
SetupWeights.resize(numSetups);
// get weight of each weather setup. Setup that are not given are assumed to be 1
if(item.getNodeByName (&elm, "SetupsWeights") && elm)
{
// Get number of setups
nlverify (elm->getArraySize (numWeights));
numWeights = std::min(numSetups, numWeights);
// For each setup
for(uint k = 0; k < numWeights; ++k)
{
if (!elm->getArrayValue(SetupWeights[k], k))
{
nlwarning("Can't read weather setup from form");
}
SetupWeights[k] = std::max((uint32) 1, SetupWeights[k]);
}
}
// complete other weights if not same size
std::fill(SetupWeights.begin() + numWeights, SetupWeights.begin() + numSetups, 1);
//
getWeatherFuncFormValue(item, VegetableMinBendIntensity, "Visual.VegetableMinBendIntensity");
getWeatherFuncFormValue(item, VegetableMaxBendIntensity, "Visual.VegetableMaxBendIntensity");
getWeatherFuncFormValue(item, VegetableMinWindFrequency, "Visual.VegetableMinWindFrequency");
getWeatherFuncFormValue(item, VegetableMaxWindFrequency, "Visual.VegetableMaxWindFrequency");
getWeatherFuncFormValue(item, VegetableMaxBendOffset, "Visual.VegetableMaxBendOffset");
getWeatherFuncFormValue(item, VegetableWindIntensityThatStartBendOffset, "Visual.VegetableWindIntensityThatStartBendOffset");
//
getWeatherFuncFormValue(item, TreeMinWindIntensity, "Visual.TreeMinWindIntensity");
getWeatherFuncFormValue(item, TreeMaxWindIntensity, "Visual.TreeMaxWindIntensity");
}
示例10: build
//=======================================================
void CPlantSheet::build(const NLGEORGES::UFormElm &item)
{
if(!(item.getValueByName(_ShapeName, "3D.Shape") &&
item.getValueByName(_MaxDist, "3D.MaxDist") &&
item.getValueByName(_CoarseMeshDist, "3D.CoarseMeshDist")))
{
nldebug("Key not found.");
}
// serial fxs by season
SeasonFX[EGSPD::CSeason::Spring].build(item, Id, "3D.SpringFX.");
SeasonFX[EGSPD::CSeason::Summer].build(item, Id, "3D.SummerFX.");
SeasonFX[EGSPD::CSeason::Autumn].build(item, Id, "3D.AutomnFX.");
SeasonFX[EGSPD::CSeason::Winter].build(item, Id, "3D.WinterFX.");
}
示例11: build
//=========================================================================
void CContinentSheet::build(const NLGEORGES::UFormElm &item)
{
Continent.build(item);
const UFormElm *elm;
// Load the village list
if(item.getNodeByName (&elm, "Villages") && elm)
{
// Get number of village
uint numVillage;
nlverify (elm->getArraySize (numVillage));
Villages.resize(numVillage);
// For each village
for(uint k = 0; k < numVillage; ++k)
{
// Village pointer
const UFormElm *villageForm;
if (elm->getArrayNode (&villageForm, k) && villageForm)
{
Villages[k].build(*villageForm);
elm->getArrayNodeName(Villages[k].Name, k);
}
}
}
// load the weather functions
// Build season descriptor
static const char *seasonFuncName[] =
{
"SpringWeatherFunction",
"SummerWeatherFunction",
"AutumnWeatherFunction",
"WinterWeatherFunction"
};
// added - 1 because there is an invalid season
nlctassert(sizeof(seasonFuncName) / sizeof(seasonFuncName[0]) == EGSPD::CSeason::Invalid );
// Load weather functions & sky sheets
for(uint k = 0; k < EGSPD::CSeason::Invalid; ++k)
{
const NLGEORGES::UFormElm *elm;
if (item.getNodeByName(&elm, seasonFuncName[k]) && elm)
{
WeatherFunction[k].build(*elm);
}
}
}
示例12: nlassert
/// Load the sound parameters from georges' form
void CContextSound::importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot)
{
NLGEORGES::UFormElm *psoundType;
std::string dfnName;
// some basic checking.
formRoot.getNodeByName(&psoundType, ".SoundType");
nlassert(psoundType != NULL);
psoundType->getDfnName(dfnName);
nlassert(dfnName == "context_sound.dfn");
// Call the base class
CSound::importForm(filename, formRoot);
// Read the pattern name
formRoot.getValueByName(_PatternName, ".SoundType.PatternName");
}
示例13: loadCharacteristicsFromSheet
void loadCharacteristicsFromSheet(const NLGEORGES::UFormElm &rootNode, std::string prefix, sint8 dest[CHARACTERISTICS::NUM_CHARACTERISTICS])
{
for(uint k = 0; k < CHARACTERISTICS::NUM_CHARACTERISTICS; ++k)
{
const std::string &characName = CHARACTERISTICS::toString((CHARACTERISTICS::TCharacteristics) k);
std::string characPath = prefix + characName;
if(!rootNode.getValueByName(dest[k], characPath.c_str()))
{
nlwarning(("Key " + characName + "not found.").c_str());
}
}
}
示例14: readEquipment
//-----------------------------------------------
// readEquipment :
// Read an equipment slot.
//-----------------------------------------------
void CCharacterSheet::readEquipment(const NLGEORGES::UFormElm &form, const string &key, CEquipment &slot)
{
// Get the item (or shape) name.
string itemName;
if(!form.getValueByName(itemName, string(key + ".Item").c_str() ))
debug(NLMISC::toString("Key '%s.Item' not found.", key.c_str()));
slot.IdItem = ClientSheetsStrings.add(NLMISC::strlwr(itemName));
// Get the texture.
if(!form.getValueByName(slot.Texture, string(key + ".Texture").c_str() ))
debug(NLMISC::toString("Key '%s.Texture' not found.", key.c_str()));
// Get the color.
if(!form.getValueByName(slot.Color, string(key + ".Color").c_str() ))
debug(NLMISC::toString("Key '%s.Color' not found.", key.c_str()));
// Get the Bind point.
string bindPointName;
if(!form.getValueByName(bindPointName, string(key + ".Bind Point").c_str() ))
debug(NLMISC::toString("Key '%s.Bind Point' not found.", key.c_str()));
slot.IdBindPoint = ClientSheetsStrings.add(bindPointName);
}// readEquipment //
示例15: build
//-----------------------------------------------
bool CDirLightSetup::build(const NLGEORGES::UFormElm &item)
{
NLMISC::CRGBA amb, dif, spe;
NLMISC::CVector dir;
const NLGEORGES::UFormElm *pElt;
// Light Direction
if (item.getNodeByName (&pElt, ".Direction") && pElt)
{
if (!CGeorgesHelper::convert(dir, *pElt)) return false;
}
// Light Ambiant
if (item.getNodeByName (&pElt, ".Ambiant") && pElt)
{
if (!CGeorgesHelper::convert(amb, *pElt)) return false;
}
// Light Diffuse
if (item.getNodeByName (&pElt, ".Diffuse") && pElt)
{
if (!CGeorgesHelper::convert(dif, *pElt)) return false;
}
// Light Specular
if (item.getNodeByName (&pElt, ".Specular") && pElt)
{
if (!CGeorgesHelper::convert(spe, *pElt)) return false;
}
Ambiant = amb;
Diffuse = dif;
Specular = spe;
Direction = dir;
return true;
}