Example #1
0
int Sound::load(GFFFile &gff, GFFFile::Struct &top)
{
	std::string tlabels[] =
		{"Active", "Continuous", "Random", "RandomPosition", "Looping",
		 "Positional", "GeneratedType", "Priority", "Times", "Volume",
		 "VolumeVrtn", "PaletteID", "Hours", "Interval", "IntervalVrtn",
		 "ObjectId", "Elevation", "MaxDistance", "MinDistance", "XPosition",
		 "YPosition", "ZPosition", "PitchVariation", "RandomRangeX",
		 "RandomRangeY", "Tag", "Comment", "TemplateResRef", "LocName",
		 "Sounds", "ActionList", "VarTable"};
	std::vector<uint32> n;

	if(gff.getIdxByLabel(tlabels, sizeof(tlabels)/sizeof(std::string),
				top, n, aderrstr))
		return ERR(gff);
	if(n[0] != NOTFOUND) active = (bool) top.values[n[0]];
	if(n[1] != NOTFOUND) continuous = (bool) top.values[n[1]];
	if(n[2] != NOTFOUND) random = (bool) top.values[n[2]];
	if(n[3] != NOTFOUND) randomposition = (bool) top.values[n[3]];
	if(n[4] != NOTFOUND) looping = (bool) top.values[n[4]];
	if(n[5] != NOTFOUND) positional = (bool) top.values[n[5]];
	if(n[6] != NOTFOUND) generatedtype = (bool) top.values[n[6]];
	if(n[7] != NOTFOUND) priority = top.values[n[7]];
	if(n[8] != NOTFOUND) times = top.values[n[8]];
	if(n[9] != NOTFOUND) volume = top.values[n[9]];
	if(n[10] != NOTFOUND) volumevrtn = top.values[n[10]];
	if(n[11] != NOTFOUND) paletteid = top.values[n[11]];
	if(n[12] != NOTFOUND) hours = top.values[n[12]];
	if(n[13] != NOTFOUND) interval = top.values[n[13]];
	if(n[14] != NOTFOUND) intervalvrtn = top.values[n[14]];
	if(n[15] != NOTFOUND) objectid = top.values[n[15]];
	if(n[16] != NOTFOUND) elevation = *((float32 *) &top.values[n[16]]);
	if(n[17] != NOTFOUND) maxdistance = *((float32 *) &top.values[n[17]]);
	if(n[18] != NOTFOUND) mindistance = *((float32 *) &top.values[n[18]]);
	if(n[19] != NOTFOUND) x = *((float32 *) &top.values[n[19]]);
	if(n[20] != NOTFOUND) y = *((float32 *) &top.values[n[20]]);
	if(n[21] != NOTFOUND) z = *((float32 *) &top.values[n[21]]);
	if(n[22] != NOTFOUND) pitchvariation = *((float32 *) &top.values[n[22]]);
	if(n[23] != NOTFOUND) randomrangex = *((float32 *) &top.values[n[23]]);
	if(n[24] != NOTFOUND) randomrangey = *((float32 *) &top.values[n[24]]);
	if(n[25] != NOTFOUND)
		if(gff.getExoString(n[25], top, tag)) return ERR(gff);
	if(n[26] != NOTFOUND)
		if(gff.getExoString(n[26], top, comment)) return ERR(gff);
	if(n[27] != NOTFOUND)
		if(gff.getResRef(n[27], top, templateresref)) return ERR(gff);
	if(n[28] != NOTFOUND)
		if(gff.getExoLocString(n[28], top, name)) return ERR(gff);
	if(n[29] != NOTFOUND) if(getSounds(gff, n[29], top)) return errcode;
	if(n[30] != NOTFOUND) if(getActions(gff, n[29], top)) return errcode;
	if(n[31] != NOTFOUND)
		if(variables.load(gff, n[32], top)) return ERR(variables);
	checkRanges();

	return errcode = 0;
}
Example #2
0
bool CSMWorld::Data::hasId (const std::string& id) const
{
    return
        getGlobals().searchId (id)!=-1 ||
        getGmsts().searchId (id)!=-1 ||
        getSkills().searchId (id)!=-1 ||
        getClasses().searchId (id)!=-1 ||
        getFactions().searchId (id)!=-1 ||
        getRaces().searchId (id)!=-1 ||
        getSounds().searchId (id)!=-1 ||
        getScripts().searchId (id)!=-1 ||
        getRegions().searchId (id)!=-1 ||
        getBirthsigns().searchId (id)!=-1 ||
        getSpells().searchId (id)!=-1 ||
        getTopics().searchId (id)!=-1 ||
        getJournals().searchId (id)!=-1 ||
        getCells().searchId (id)!=-1 ||
        getReferenceables().searchId (id)!=-1;
}