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


C++ CVariable::get方法代码示例

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


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

示例1: setNewImpactScheme

/*
 * Set a new mapping scheme of property impact
 */
void CHarvestSource::setNewImpactScheme()
{
	H_AUTO(CHarvestSource_setNewImpactScheme);
	
	// Set mapping scheme of property impact
	if ( _IsInNewbieMode )
	{
		// Force "low dangers" for 1 newbie extractor
		_IImpactMappingScheme = (uint16)LowDangerMappings[RandomGenerator.rand( 1 )];
	}
	else
	{
		// Normal dangers
		if ( ForageForceImpactScheme.get() == -1 )
			_IImpactMappingScheme = (uint16)RandomGenerator.rand( 5 );
		else
			_IImpactMappingScheme = (uint16)ForageForceImpactScheme.get();
	}

	sendMessageToExtractors( "FORAGE_SOURCE_IMPACT_MODE", (sint32)_IImpactMappingScheme );

#ifdef NL_DEBUG
	nldebug( "FG: map scheme: %u", _IImpactMappingScheme );
#endif
}
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:28,代码来源:harvest_source.cpp

示例2: saveToFile

// ----------------------------------------------------------------------------
void CMissionQueueManager::saveToFile()
{
	H_AUTO(CMissionQueueManagerSaveToFile);

	if( _InitOk )
	{
		string sFilename = MissionQueueFile.get();
		
		// save file via Backup Service (BS)
		try
		{
			static CPersistentDataRecordRyzomStore	pdr;
			pdr.clear();
			store(pdr);

			CBackupMsgSaveFile msg( sFilename, CBackupMsgSaveFile::SaveFile, Bsi );
			{
				std::string s;
				pdr.toString(s);
				msg.DataMsg.serialBuffer((uint8*)&s[0], (uint)s.size());
			}
			Bsi.sendFile( msg );
		}
		catch(const Exception &)
		{
			nlwarning("(EGS)<CMissionQueueManager::saveToFile>  :  Can't serial file %s (connection with BS service down ?)",sFilename.c_str());
			return;
		}
	}
}
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:31,代码来源:mission_queue_manager.cpp

示例3: getline

/**
 * updateShardOpenFromFile()
 * Update ShardOpen from a file.
 * Read a line of text in the file, converts it to int (atoi), then casts into bool for ShardOpen.
 */
void	updateShardOpenFromFile(const std::string& filename)
{
	CIFile	f;

	if (!f.open(filename))
	{
		nlwarning("Failed to update ShardOpen from file '%s', couldn't open file", filename.c_str());
		return;
	}

	try
	{
		char	readBuffer[256];
		f.getline(readBuffer, 256);
		sint state;
		NLMISC::fromString(std::string(readBuffer), state);

		setShardOpenState((TShardOpenState)state);

		nlinfo("Updated ShardOpen state to '%u' from file '%s'", ShardOpen.get(), filename.c_str());
	}
	catch (const Exception& e)
	{
		nlwarning("Failed to update ShardOpen from file '%s', exception raised while getline() '%s'", filename.c_str(), e.what());
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:31,代码来源:ryzom_welcome_service.cpp

示例4: cbGetFileClass

static void cbGetFileClass( CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
	if (!BSReadState.get())
		return;

	CMessage msgOut = getFileClassImp(msgin);

	// send the output message
	CUnifiedNetwork::getInstance()->send(serviceId, msgOut);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:10,代码来源:backup_service.cpp

示例5: cbSyncGetFileClass

static void cbSyncGetFileClass( CMessage& msgin, TSockId from, CCallbackNetBase &netbase)
{
	if (!BSReadState.get())
		return;

	CMessage msgOut = getFileClassImp(msgin);

	// send the output message
	netbase.send(msgOut, from);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:10,代码来源:backup_service.cpp

示例6: cbReadMode

static void cbReadMode( CMessage& msgin, TSockId from, CCallbackNetBase &netbase)
{
	// encode the read mode and return
	CMessage msgout("BS_READ_MODE");
	bool readMode = BSReadState.get();
	nlWrite(msgout, serial, readMode);

	// send it back to sender
	netbase.send(msgout, from);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:10,代码来源:backup_service.cpp

示例7: cbDisconnection

//-----------------------------------------------------------------------------
static void cbDisconnection( const string &serviceName, NLNET::TServiceId serviceId, void *arg )
{
	if (serviceName == "BS" && !MasterBSHost.get().empty())
	{
		nlwarning("SLAVE BS: MASTER BS IS DOWN!! File reading allowed!");
		MasterBSUp = false;
		BSReadState = true;

		IService::getInstance()->addStatusTag("MasterDown");
		IService::getInstance()->removeStatusTag("MasterRunning");
	}
} // cbDisconnection //
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:13,代码来源:backup_service.cpp

示例8: if

void	CDirectoryRateStat::writeFile(const std::string& filename, uint32 filesize)
{
	NLMISC::TTime	now = NLMISC::CTime::getLocalTime();
	if (filename.find("www") != std::string::npos)
	{
		_DirectoryMap["www"].write(now, filesize);
	}
	else if (filename.find(StatDirFilter.get()) != std::string::npos)
	{
		_DirectoryMap[NLMISC::CFile::getPath(filename)].write(now, filesize);
	}
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:12,代码来源:backup_service.cpp

示例9: cbFESConnection

// a new front end connecting to me, add it
void cbFESConnection (const std::string &serviceName, TServiceId  sid, void *arg)
{
	FESList.push_back (CFES ((TServiceId)sid));
	nldebug("new FES connection: sid %u", sid.get());
	displayFES ();

	bool	dummy;
	FESList.back().reportStateToLS(dummy);

	if (!UsePatchMode.get())
	{
		FESList.back().setToAcceptClients();
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:15,代码来源:ryzom_welcome_service.cpp

示例10: init

// ----------------------------------------------------------------------------
void CMissionQueueManager::init()
{
	string sFilename = MissionQueueFile.get();
	sFilename = Bsi.getLocalPath() + sFilename;
	
	if (CFile::fileExists(sFilename))
	{
		static CPersistentDataRecord	pdr;
		pdr.clear();
		pdr.readFromTxtFile(sFilename.c_str());
		apply(pdr);
	}
	_InitOk = true;
}
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:15,代码来源:mission_queue_manager.cpp

示例11: tickUpdate

// ----------------------------------------------------------------------------
void CMissionQueueManager::tickUpdate()
{
	if( IsRingShard ) // Temporary Fix potential problem with multi shard instance Ring unification: 
		return;	// Mission saved tick must be adapted for have relative value saved

	H_AUTO(CMissionQueueManagerUpdate);

	for ( map<uint32,CMissionQueue>::iterator it = _Queues.begin() ; it != _Queues.end() ; ++it )
	{
		(*it).second.tickUpdate();
	}

	// save file when time has come
	if (CTickEventHandler::getGameCycle() % MissionQueueSavePeriod.get() == 0)
		saveToFile();
}
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:17,代码来源:mission_queue_manager.cpp

示例12: init

//-----------------------------------------------------------------------------
void CBackupService::init()
{
	FileManager.init();

	setUpdateTimeout(100);
	_SaveStall = false;

	// set the connection and disconnection callbacks
	CUnifiedNetwork::getInstance()->setServiceUpCallback( string("*"), cbConnection, 0);
	CUnifiedNetwork::getInstance()->setServiceDownCallback( string("*"), cbDisconnection, 0);

	CUnifiedNetwork::getInstance()->setServiceUpCallback( string("BS"), cbConnection, 0);
	CUnifiedNetwork::getInstance()->setServiceDownCallback( string("BS"), cbDisconnection, 0);

	// Init the sheet Id 
	CSheetId::init(false);

	if (!MasterBSHost.get().empty())
	{
		IService::getInstance()->addStatusTag("SlaveMode");
		IService::getInstance()->setCurrentStatus("WaitingMaster");

		BSIsSlave = true;
		FileManager.forbidStall();
		// I'm a slave, try to contact master
		string	host = MasterBSHost;
		if (host.find (":") == string::npos)
			host += ":49990";

		CUnifiedNetwork::getInstance()->addService ("BS", CInetAddress(host));
	}

	// set the initial read state from the config file
	CConfigFile::CVar *readState = ConfigFile.getVarPtr("BSReadState");
	if (readState != NULL)
		BSReadState = readState->asBool();


	initWebConnection();

	_CallbackServer = new NLNET::CCallbackServer;
	_CallbackServer->addCallbackArray(cbSyncArray, sizeofarray(cbSyncArray));
	// open the layer 3 callback server if required
	if (L3ListeningPort != 0)
		_CallbackServer->init(L3ListeningPort);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:47,代码来源:backup_service.cpp

示例13: cbLSConnection

// connection to the LS, send the identification message
void cbLSConnection (const std::string &serviceName, TServiceId  sid, void *arg)
{
	sint32 shardId;

	if (IService::getInstance()->haveArg('S'))
	{
		// use the command line param if set
		NLMISC::fromString(IService::getInstance()->getArg('S'), shardId);
	}
	else if (IService::getInstance()->ConfigFile.exists ("ShardId"))
	{
		// use the config file param if set
		shardId = IService::getInstance()->ConfigFile.getVar ("ShardId").asInt();
	}
	else
	{
		shardId = -1;
	}

	if (shardId == -1)
	{
		nlerror ("ShardId variable must be valid (>0)");
	}

	CMessage	msgout ("WS_IDENT");
	msgout.serial (shardId);
	CUnifiedNetwork::getInstance()->send (sid, msgout);

	nlinfo ("Connected to %s-%hu and sent identification with shardId '%d'", serviceName.c_str(), sid.get(), shardId);

	// send state to LS
	setShardOpenState((TShardOpenState)(ShardOpen.get()), false);

	//
	if (!DontUseLS)
	{
		CMessage	msgrpn("REPORT_NO_PATCH");
		CUnifiedNetwork::getInstance()->send("LS", msgrpn);
	}

	bool	reportPatching = false;
	list<CFES>::iterator	itfs;
	for (itfs=FESList.begin(); itfs!=FESList.end(); ++itfs)
		(*itfs).reportStateToLS(reportPatching);
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:46,代码来源:ryzom_welcome_service.cpp

示例14:

/**
 * cbUsePatchMode()
 * Callback for UsePatchMode
 */
void	cbUsePatchMode(IVariable &var)
{
	// if patch mode not set, set all fs in patching mode to accept clients now
	if (!UsePatchMode.get())
	{
		nlinfo("UsePatchMode disabled, switch all patching servers to actual frontends");

		list<CFES>::iterator	it;

		for (it=FESList.begin(); it!=FESList.end(); ++it)
		{
			if ((*it).State == PatchOnly)
			{
				(*it).setToAcceptClients();
			}
		}
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:22,代码来源:ryzom_welcome_service.cpp

示例15: setSlot

void CGearLatency::setSlot( INVENTORIES::TInventory inventory, uint32 slot, const CStaticItem * form, CCharacter * user )
{
	static NLMISC::CSheetId equipSheet("big_equip_item.sbrick");
	
	// checks must be done by the caller
	nlassert(form);
	nlassert(user);
	// ignore instant equip items
	if ( form->TimeToEquip == 0)
		return;
	
	// build a new entry
	CGearSlot gear;
	if (inventory == INVENTORIES::equipment)
		gear.InHand = false;
	else if (inventory == INVENTORIES::handling)
		gear.InHand = true;
	else
		nlerror("setSlot : Invalid inventory %u ('%s') : must be handling or equipment ",inventory,INVENTORIES::toString(inventory).c_str() );
	gear.Slot = slot;
	gear.LatencyEndDate = (form->TimeToEquip * EquipTimeFactor.get()) + CTickEventHandler::getGameCycle();
	
	// add it in our sorted list
	std::list<CGearSlot>::iterator it = _GearLatencies.begin();
	for (; it != _GearLatencies.end(); ++it)
	{
		if ( (*it).LatencyEndDate >= gear.LatencyEndDate )
			break;
	}
	if ( it == _GearLatencies.end() )
	{
//		user->_PropertyDatabase.setProp( "USER:ACT_TSTART", CTickEventHandler::getGameCycle() );
		CBankAccessor_PLR::getUSER().setACT_TSTART(user->_PropertyDatabase, CTickEventHandler::getGameCycle() );
//		user->_PropertyDatabase.setProp( "USER:ACT_TEND", gear.LatencyEndDate );
		CBankAccessor_PLR::getUSER().setACT_TEND(user->_PropertyDatabase, gear.LatencyEndDate );
//		sint64 tmp = (sint64)user->actionCounter();
//		user->_PropertyDatabase.setProp( "USER:ACT_NUMBER", tmp );
//		user->_PropertyDatabase.setProp( "EXECUTE_PHRASE:SHEET", sint64(equipSheet.asInt()) );
		CBankAccessor_PLR::getEXECUTE_PHRASE().setSHEET(user->_PropertyDatabase, equipSheet);
//		user->_PropertyDatabase.setProp( "EXECUTE_PHRASE:PHRASE", 0 );
		CBankAccessor_PLR::getEXECUTE_PHRASE().setPHRASE(user->_PropertyDatabase, 0 );
	}
	_GearLatencies.insert( it, gear );
}// CGearLatency::setSlot
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:44,代码来源:gear_latency.cpp


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