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


C++ CVar::asString方法代码示例

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


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

示例1: init

void CConfiguration::init()
{	
	// verify data
	nlassert(!m_ConfigCallbacks.size());
	
	// load config
	m_ConfigFile.load(NLQT_CONFIG_FILE);
	
	// log config
	CConfiguration::setAndCallback("NegFiltersDebug", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersInfo", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersWarning", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersAssert", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersError", CConfigCallback(this, &CConfiguration::cfcbLogFilter));

	// set the search paths (kinda important)
	CConfigFile::CVar *var;
	var = m_ConfigFile.getVarPtr("SearchPaths");
	uint varsize = var->size();
	for (uint i = 0; i < varsize; ++i)
		CPath::addSearchPath(var->asString(i), true, false);
	var = m_ConfigFile.getVarPtr("RemapExtensions");
	varsize = var->size();
	for (uint i = 0; i < varsize; i += 2)
		CPath::remapExtension(var->asString(i), var->asString(i + 1), true);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:26,代码来源:configuration.cpp

示例2: compile

// compile the source files to generate new object files
void CAIManager::compile()
{
	// get the file names of input and output files
	std::string srcFile=CAIFiles::fullSrcFileName(id());
	std::string objFile=CAIFiles::fullObjFileName(id());

	// make sure this file isn't in the ignore list
	CConfigFile::CVar *varPtr;
	varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("IgnorePrimitives"));
	if (varPtr==NULL)
	{
		nlwarning("Cannot compile file '%s' as IgnorePrimitives variable not found in .cfg file: Please add 'IgnorePrimitives={\"\"};' and try again",CAIFiles::fullSrcFileName(id()).c_str());
		return;
	}
	for (uint i=0;i<varPtr->size();++i)
		if (CAIFiles::srcName(id())==CFile::getFilenameWithoutExtension(varPtr->asString(i)))
		{
			nlinfo("Skipping file in .cfg ignoreList: %s",CAIFiles::fullSrcFileName(id()).c_str());
			return;
		}

	// compile the input file
	nlinfo("Compile %s => %s",srcFile.c_str(),objFile.c_str());
	CAIDSActions::CurrentManager=id();
	AI_SHARE::parsePrimFile(srcFile.c_str());

	// make sure this file isn't in the ignore list (if the compiler found nothing interesting it will have been added)
	varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("IgnorePrimitives"));
	for (uint i=0;i<varPtr->size();++i)
		if (CAIFiles::srcName(id())==CFile::getFilenameWithoutExtension(varPtr->asString(i)))
		{
			nlinfo("- Skipping file as it has just been added to .cfg ignoreList: %s",CAIFiles::fullSrcFileName(id()).c_str());
			return;
		}

	// write the output file
	CAIFiles::writeObjFile(id());

	// write the binary output file (for debugging only)
	NLMISC::COFile file;
	if (file.open(objFile+"_out"))
	{
		std::string s;
		MgrDfnRootNode.serialToString(s);
		file.serial(s);
		file.close();
	}
	else
		nlwarning("CAIManager::compile(): Failed to open the output file: %s",(objFile+"_out").c_str());
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:51,代码来源:ai_manager.cpp

示例3: string

// String version
bool	getVarFromConfigFile(CConfigFile &cf, const string &name, string &variable, const string &defaultValue = string(""))
{
	CConfigFile::CVar	*ptr = cf.getVarPtr(name);
	bool	success;
	variable = ((success = (ptr != NULL)) ? ptr->asString() : defaultValue);
	return success;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:8,代码来源:gpm_service.cpp

示例4: packedFileName

// @{
// \name Overload for IPluginCallback
void		CPrimitivePlugin::init(IPluginAccess *pluginAccess)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	AfxEnableControlContainer();
	_PluginAccess = pluginAccess;

	string packedFileName("primitive_plugin.packed_sheets");

	vector<string>	paths;
	string sheetIdPath;

	// add the search path
	CConfigFile &cf = pluginAccess->getConfigFile();
	CConfigFile::CVar *pv = cf.getVarPtr("PrimitivePluginPath");
	if (pv)
	{
		for (uint i=0; i<pv->size(); ++i)
			paths.push_back(pv->asString(i));
	}
	// add the sheetId file
	pv = cf.getVarPtr("PrimitivePluginSheetId");
	sheetIdPath = pv->asString();

	// Init the sheet id
	CPath::addSearchFile(sheetIdPath);
	CSheetId::init(false);

	// Read the sheets
	if (NLMISC::CFile::fileExists(packedFileName))
		loadForm("creature", packedFileName, _CreatureInfos, false, false);
	else
	{
		for (uint i=0; i<paths.size(); ++i)
		{
			CPath::addSearchPath(paths[i], true, false);
		}

		// build the packed sheet
		loadForm("creature", packedFileName, _CreatureInfos, true, false);
	}

	vector<string>	classNames;
	classNames.push_back("npc_bot");
	_PluginAccess->registerPrimitiveDisplayer(this, classNames);
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:47,代码来源:primitive_plugin.cpp

示例5: init

bool CConfiguration::init()
{
	nlassert(!ConfigFile); ConfigFile = new CConfigFile(); nlassert(ConfigFile);
	ConfigFile->load(SBCLIENT_CONFIG_FILE);

	// set the search paths (kinda important)
	CConfigFile::CVar *var;
	var = ConfigFile->getVarPtr("SearchPaths");
	uint varsize = var->size();
	for (uint i = 0; i < varsize; ++i)
		CPath::addSearchPath(var->asString(i), true, false);
	var = ConfigFile->getVarPtr("RemapExtensions");
	varsize = var->size();
	for (uint i = 0; i < varsize; i += 2)
		CPath::remapExtension(var->asString(i), var->asString(i + 1), true);

	return true;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:18,代码来源:configuration.cpp

示例6:

	/// Set expected instances. Ex: { "TICKS", "FS", "FS", "FS" }
	void		setExpectedInstances( CConfigFile::CVar& var )
	{
		// Reset "expected" counters (but don't clear the map, keep the running instances)
		CInstances::iterator ici;
		for ( ici=_Instances.begin(); ici!=_Instances.end(); ++ici )
		{
			(*ici).second.Expected = 0;
		}
		// Rebuild "expected" counters
		for ( uint i=0; i!=var.size(); ++i )
		{
			++_Instances[var.asString(i)].Expected;
		}
	}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:15,代码来源:ryzom_welcome_service.cpp

示例7: generateSpellList

/** Generate list of spell
  */
static void generateSpellList(CConfigFile &cf, const std::string &sheetName)
{
	CConfigFile::CVar *spellList = cf.getVarPtr("spell_list");
	if (!spellList)
	{
		nlwarning("Can't read spell list");
		return;
	}	
	COFile f;
	if (!f.open(sheetName, false, true))
	{
		nlwarning("Can't write %s", sheetName.c_str());
		return;
	}
	try
	{	
		COXml xmlStreamOut;
		xmlStreamOut.init(&f);
		xmlStreamOut.xmlPush("FORM");
		IStream &xmlStream = xmlStreamOut;
		xmlStream.xmlPush("STRUCT");
		xmlStream.xmlPushBegin("ARRAY");
			xmlStream.xmlSetAttrib("Name");
			std::string name = "List";
			xmlStream.serial(name);					
		xmlStream.xmlPushEnd();				
		for(uint k = 0; k < (uint) spellList->size(); ++k)
		{
			std::vector<std::string> result;
			NLMISC::splitString(spellList->asString(k), "|", result);
			if (result.size()  < 2)
			{
				nlwarning("Should provide at list spell name and id");
			}
			xmlStream.xmlPush("STRUCT");				
				writeAtom(xmlStream, "ID", result[1]);
				writeAtom(xmlStream, "SheetBaseName", result[0]);
			xmlStream.xmlPop();
		}
		xmlStream.xmlPop(); // STRUCT
		xmlStream.xmlPop(); // FORM
	}
	catch(const EStream &)
	{
		nlwarning("Cant write %s", sheetName.c_str());
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:49,代码来源:build_spell_sheet.cpp

示例8: loadPlugins

void CWorldEditorApp::loadPlugins()
{
	// 1st load the plugin configuration file
//	char curDir[MAX_PATH];
//	GetCurrentDirectory (MAX_PATH, curDir);

	PluginConfig.load((ExePath+"/world_editor_plugin.cfg").c_str());

	// enumerate the plugin variable.
	CConfigFile::CVar *plugins = PluginConfig.getVarPtr("PluginsLibrary");

	if (plugins != 0)
	{
		for (uint i=0; i<plugins->size(); ++i)
		{
			string libname = plugins->asString(i)+nlLibSuffix+".dll";

			//vl HMODULE h = AfxLoadLibrary(libname.c_str());
			NL_LIB_HANDLE h = nlLoadLibrary(libname.c_str());
			if (h == NULL)
				continue;

			//FCreateSoundPlugin *pf = (FCreateSoundPlugin*) GetProcAddress(h, "createSoundPlugin");
			//JC: switch to the generic call as soon as possible
			//vl FCreatePlugin *pf = (FCreatePlugin*) GetProcAddress(h, "createPlugin");
			FCreatePlugin *pf = (FCreatePlugin*) nlGetSymbolAddress(h, "createPlugin");

			if (pf == NULL)
				continue;

			// ok, the plugin is loaded.
			IPluginCallback *pcb = (IPluginCallback*) pf();

			if (pcb == 0)
				continue;

			nlinfo("Plugins '%s' loaded", libname.c_str());
			Plugins.push_back(pcb);

			// init the plugin.
			pcb->init(getMainFrame());
		}
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:44,代码来源:world_editor.cpp

示例9: cfcbLogFilter

void CConfiguration::cfcbLogFilter(CConfigFile::CVar &var)
{
	// from nel/net/service.cpp	
	CLog *log = NULL;
	if (var.Name == "NegFiltersDebug") log = DebugLog;
	else if (var.Name == "NegFiltersInfo") log = InfoLog;
	else if (var.Name == "NegFiltersWarning") log = WarningLog;
	else if (var.Name == "NegFiltersAssert") log = AssertLog;
	else if (var.Name == "NegFiltersError") log = ErrorLog;
	else nlstop;

	// remove all old filters from config file
	CConfigFile::CVar &oldvar = m_ConfigFile.getVar(var.Name);
	for (uint j = 0; j < oldvar.size(); j++)
		log->removeFilter(oldvar.asString(j).c_str());
	
	// add all new filters from config file
	for (uint i = 0; i < var.size(); i++)
		log->addNegativeFilter(var.asString(i).c_str());
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:20,代码来源:configuration.cpp

示例10: main

//****************************************************************************************************************************
int main(int argc, char* argv[])
{
	if (argc < 2)
	{
		nlwarning("Usage : %s config_file_name.cfg", argv[0]);
		return -1;
	}
	CConfigFile cf;
	try
	{	
		cf.load(argv[1]);
	}
	catch(const NLMISC::EConfigFile &)
	{
		nlwarning("Error in config file %s", argv[1]);
		return -1;
	}	
	catch(...)
	{
		nlwarning("Can't read config file %s", argv[1]);
		return -1;
	}
	// output for sheets
	std::string outputPath;
	CConfigFile::CVar *outputPathVar = cf.getVarPtr("output_path");
	if (outputPathVar)
	{
		outputPath = outputPathVar->asString() + "/";
	}
	// output for 'levels' parents
	std::string levelParentsPath;
	CConfigFile::CVar *levelParentsPathVar = cf.getVarPtr("level_parents");
	if (levelParentsPathVar)
	{
		levelParentsPath = levelParentsPathVar->asString() + "/";
	}
	// output for projectile parents
	std::string projectileParentsPath;
	CConfigFile::CVar *projectileParentsPathVar = cf.getVarPtr("projectile_base");
	if (projectileParentsPathVar)
	{
		projectileParentsPath= projectileParentsPathVar->asString() + "/";
	}	
	// output for 'projectile by level and mode' parents
	std::string projectileByLevelAndModeParentsPath;
	CConfigFile::CVar *projectileByLevelAndModeParentsPathVar = cf.getVarPtr("projectile_by_level_and_mode_parents");
	if (projectileByLevelAndModeParentsPathVar)
	{
		projectileByLevelAndModeParentsPath = projectileByLevelAndModeParentsPathVar->asString() + "/";
	}
	// output for 'base spells' parents
	std::string baseSpellPath;
	CConfigFile::CVar *baseSpellPathVar = cf.getVarPtr("spell_base");
	if (baseSpellPathVar)
	{
		baseSpellPath = baseSpellPathVar->asString() + "/";
	}
	// output for 'spell by levels' parents
	std::string spellByLevelParentsPath;
	CConfigFile::CVar *spellByLevelParentsPathVar = cf.getVarPtr("spell_by_level_parents");
	if (spellByLevelParentsPathVar)
	{
		spellByLevelParentsPath = spellByLevelParentsPathVar->asString() + "/";
	}
	// output for 'final spell'
	std::string finalSpellPath;
	CConfigFile::CVar *finalSpellPathVar = cf.getVarPtr("final_spells");
	if (finalSpellPathVar)
	{
		finalSpellPath = finalSpellPathVar->asString() + "/";
	}
	


	// read number of levels
	CConfigFile::CVar *numLevelVar = cf.getVarPtr("num_levels");
	if (!numLevelVar)
	{
		nlwarning("Can't read number of spell levels");
		return -1;
	}
	uint numSpellLevels = numLevelVar->asInt();

	std::vector<CUserParams> userParams(numSpellLevels);

	// read user params set for each level
	for(uint level = 0; level < numSpellLevels; ++level)
	{
		std::string varName = toString("user_params_level%d", (int) (level + 1));
		CConfigFile::CVar *up = cf.getVarPtr(varName);
		if (!up)
		{
			nlwarning("Can't read var %s", varName.c_str());
		}
		else
		{
			for(uint k = 0; k < CUserParams::NumUserParams; ++k)
			{
				userParams[level].UserParam[k] = up->asString(k);
//.........这里部分代码省略.........
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:101,代码来源:build_spell_sheet.cpp

示例11: if

/*
 * CSV -> Georges
 */
void	convertCsvFile( const string &file, bool generate, const string& sheetType )
{
	const uint			BUFFER_SIZE = 16*1024;
	char			lineBuffer[BUFFER_SIZE];
	FILE			*s;

	vector<string>	fields;
	vector<string>	args;

	if ((s = fopen(file.c_str(), "r")) == NULL)
	{
		fprintf(stderr, "Can't find file %s to convert\n", file.c_str());
		return;
	}

	loadSheetPath();

	UFormLoader *formLoader = UFormLoader::createLoader ();
	NLMISC::CSmartPtr<CForm> form;
	NLMISC::CSmartPtr<UFormDfn> formDfn;


	fgets(lineBuffer, BUFFER_SIZE, s);
	explode(std::string(lineBuffer), std::string(SEPARATOR), fields);

	vector<bool> activeFields( fields.size(), true );

	// Load DFN (generation only)
	set<CDfnField>	dfnFields;
	if ( generate )
	{
		formDfn = formLoader->loadFormDfn( (sheetType + ".dfn").c_str() );
		if ( ! formDfn )
			nlerror( "Can't find DFN for %s", sheetType.c_str() );
		fillFromDFN( formLoader, dfnFields, formDfn, "", sheetType );

		// Display missing fields and check fields against DFN
		uint i;
		for ( i=1; i!=fields.size(); ++i )
		{
			eraseCarriageReturnsAndMakeBlankNonAsciiChars( fields[i] );
			if ( fields[i].empty() )
			{
				nlinfo( "Skipping field #%u (empty)", i );
				activeFields[i] = false;
			}
			else if ( nlstricmp( fields[i], "parent" ) == 0 )
			{
				strlwr( fields[i] ); // non-const version
			}
			else
			{
				set<CDfnField>::iterator ist = dfnFields.find( CDfnField(fields[i]) );
				if ( ist == dfnFields.end() )
				{
					nlinfo( "Skipping field #%u (%s, not found in %s DFN)", i, fields[i].c_str(), sheetType.c_str() );
					activeFields[i] = false;
				}
			}
		}
		for ( i=1; i!=fields.size(); ++i )
		{
			if ( activeFields[i] )
				nlinfo( "Selected field: %s", fields[i].c_str() );
		}
	}

	string addExtension = "." + sheetType;
	uint dirmapLetterIndex = ~0;
	bool dirmapLetterBackward = false;
	vector<string> dirmapDirs;
	string dirmapSheetCode;
	bool WriteEmptyProperties = false, WriteSheetsToDisk = true;
	bool ForceInsertParents = false;

	if ( generate )
	{
		// Get the directory mapping
		try
		{
			CConfigFile dirmapcfg;
			dirmapcfg.load( sheetType + "_dirmap.cfg" );

			if ( OutputPath.empty() )
			{
				CConfigFile::CVar *path = dirmapcfg.getVarPtr( "OutputPath" );
				if ( path )
					OutputPath = path->asString();
				if ( ! OutputPath.empty() )
				{
					if ( OutputPath[OutputPath.size()-1] != '/' )
						OutputPath += '/';
					else if ( ! CFile::isDirectory( OutputPath ) )
						nlwarning( "Output path does not exist" );
				}
			}

//.........这里部分代码省略.........
开发者ID:mixxit,项目名称:solinia,代码行数:101,代码来源:georges2csv.cpp

示例12: init

/* Load the config file and the related words files. Return false in case of failure.
 * Config file variables:
 * - WordsPath: where to find <filter>_words_<languageCode>.txt
 * - LanguageCode: language code (ex: en for English)
 * - Utf8: results are in UTF8, otherwise in ANSI string
 * - Filter: "*" for all files (default) or a name (ex: "item").
 * - AdditionalFiles/AdditionalFileColumnTitles
 */
bool CWordsDictionary::init( const string& configFileName )
{
	// Read config file
	bool cfFound = false;
	CConfigFile cf;
	try
	{
		cf.load( configFileName );
		cfFound = true;
	}
	catch ( EConfigFile& e )
	{
		nlwarning( "WD: %s", e.what() );
	}
	string wordsPath, languageCode, filter = "*";
	vector<string> additionalFiles, additionalFileColumnTitles;
	bool filterAll = true, utf8 = false;
	if ( cfFound )
	{
		CConfigFile::CVar *v = cf.getVarPtr( "WordsPath" );
		if ( v )
		{
			wordsPath = v->asString();
			/*if ( (!wordsPath.empty()) && (wordsPath[wordsPath.size()-1]!='/') )
				wordsPath += '/';*/
		}
		v = cf.getVarPtr( "LanguageCode" );
		if ( v )
			languageCode = v->asString();
		v = cf.getVarPtr( "Utf8" );
		if ( v )
			utf8 = (v->asInt() == 1);
		v = cf.getVarPtr( "Filter" );
		if ( v )
		{
			filter = v->asString();
			filterAll = (filter == "*");
		}
		v = cf.getVarPtr( "AdditionalFiles" );
		if ( v )
		{
			for ( uint i=0; i!=v->size(); ++i )
				additionalFiles.push_back( v->asString( i ) );
			v = cf.getVarPtr( "AdditionalFileColumnTitles" );
			if ( v->size() != additionalFiles.size() )
			{
				nlwarning( "AdditionalFiles and AdditionalFileColumnTitles have different size, ignoring second one" );
				additionalFileColumnTitles.resize( v->size(), DefaultColTitle );
			}
			else
			{
				for ( uint i=0; i!=v->size(); ++i )
					additionalFileColumnTitles.push_back( v->asString( i ) );
			}
		}

	}
	if ( languageCode.empty() )
		languageCode = "en";

	// Load all found words files
	const string ext = ".txt";
	vector<string> fileList;
	CPath::getPathContent( wordsPath, false, false, true, fileList );
	for ( vector<string>::const_iterator ifl=fileList.begin(); ifl!=fileList.end(); ++ifl )
	{
		const string& filename = (*ifl);
		string::size_type p = string::npos;
		bool isAdditionalFile = false;

		// Test if filename is in additional file list
		uint iAdditionalFile;
		for ( iAdditionalFile=0; iAdditionalFile!=additionalFiles.size(); ++iAdditionalFile )
		{
			if ( (p = filename.find( additionalFiles[iAdditionalFile] )) != string::npos )
			{
				isAdditionalFile = true;
				break;
			}
		}

		// Or test if filename is a words_*.txt file
		string pattern = string("_words_") + languageCode + ext;
		if ( isAdditionalFile ||
			 ((p = filename.find( pattern )) != string::npos) )
		{
			// Skip if a filter is specified and does not match the current file
			if ( (!filterAll) && (filename.find( filter+pattern ) == string::npos) )
				continue;

			// Load file
			nldebug( "WD: Loading %s", filename.c_str() );
//.........这里部分代码省略.........
开发者ID:mixxit,项目名称:solinia,代码行数:101,代码来源:words_dictionary.cpp

示例13: cbUpdateRadar

void cbUpdateRadar (CConfigFile::CVar &var)
{
	if (var.Name == "RadarPosX") RadarPosX = var.asFloat ();
	else if (var.Name == "RadarPosY") RadarPosY = var.asFloat ();
	else if (var.Name == "RadarWidth") RadarWidth = var.asFloat ();
	else if (var.Name == "RadarHeight") RadarHeight = var.asFloat ();
	else if (var.Name == "RadarBackColor") RadarBackColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarFrontColor") RadarFrontColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarSelfColor") RadarSelfColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarOtherColor") RadarOtherColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarDynamicColor") RadarDynamicColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarPlaceColor") RadarPlaceColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarEntitySize") RadarEntitySize = var.asFloat ();
	else if (var.Name == "RadarState") RadarState = var.asInt ();
	else if (var.Name == "RadarDistance") RadarDistance = var.asInt ();
	else if (var.Name == "RadarMinDistance") RadarMinDistance = var.asInt ();
	else if (var.Name == "RadarMaxDistance") RadarMaxDistance = var.asInt ();
	else if (var.Name == "URLSelectionTimeout") SelectionTimeOut = var.asInt ();
	else if (var.Name == "RadarParticularPlaces")
	{
		RadarParticularPlaces.clear ();
		for (sint i = 0; i < var.size(); i += 4)
		{
			RadarParticularPlaces.push_back (RadarParticularPlace(var.asFloat(i), var.asFloat(i+1), var.asString(i+2), var.asString(i+3)));
		}
	}
	else if (var.Name == "RadarFontSize") RadarFontSize = var.asInt ();
	else if (var.Name == "RadarLittlePosX") RadarLittlePosX = var.asFloat ();
	else if (var.Name == "RadarLittlePosY") RadarLittlePosY = var.asFloat ();
	else if (var.Name == "RadarLittleRadius") RadarLittleRadius = var.asFloat ();
	else nlwarning ("Unknown variable update %s", var.Name.c_str());
}
开发者ID:rbjarnason,项目名称:Mayans,代码行数:32,代码来源:radar.cpp

示例14: init

///init
void CAIService::init (void)
{
	// start any available system command.
	CConfigFile::CVar *sysCmds = IService::getInstance()->ConfigFile.getVarPtr("SystemCmd");
	if (sysCmds != NULL)
	{
		for (uint i=0; i<sysCmds->size(); ++i)
		{
			string cmd = sysCmds->asString(i);

			nlinfo("Invoking system command '%s'...", cmd.c_str());
			int ret = system(cmd.c_str());
			nlinfo(" command returned %d", ret);
		}
	}

	// read sheet_id.bin and don't prune out unknown files
	CSheetId::init(false);

    // Init singleton manager
	CSingletonRegistry::getInstance()->init();

	// init static fame manager
	CStaticFames::getInstance();

	setVersion (RYZOM_VERSION);

	// Init ligo
	if (!LigoConfig.readPrimitiveClass ("world_editor_classes.xml", false))
	{
		// Should be in l:\leveldesign\world_editor_files
		nlerror ("Can't load ligo primitive config file world_editor_classes.xml");
	}


	// have ligo library register its own class types for its class factory
	NLLIGO::Register();

	// setup the update systems
	setUpdateTimeout(100);



	// init sub systems
	CAIKeywords::init();
	CMirrors::init(cbTick, NULL, cbTickRelease);
	CMessages::init();
	AISHEETS::CSheets::getInstance()->init();

	// initialise the AI_SHARE library
	AI_SHARE::init(&LigoConfig);

	// set the primitive context
	NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig;

	CAISActions::init();

	CEGSInterface::init();
	CTimeInterface::init();
	CCombatInterface::init();
	CVisualPropertiesInterface::init();
	CAIDSInterface::init();

	// register the service up and service down callbacks
	CMirrors::Mirror.setServiceMirrorUpCallback("*", cbServiceMirrorUp, 0);
	CMirrors::Mirror.setServiceDownCallback( "*", cbServiceDown, 0);
//	CUnifiedNetwork::getInstance()->setServiceDownCallback( "*", cbServiceDown, 0);

	CConfigFile::CVar	*clientCreature=IService::getInstance()->ConfigFile.getVarPtr ("CreatureDebug");
	if (clientCreature)
	{
		CAIS::instance().setClientCreatureDebug(clientCreature->asInt()!=0);
	}
}
开发者ID:mixxit,项目名称:solinia,代码行数:75,代码来源:service_main.cpp


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