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


C++ net::CBuffer类代码示例

本文整理汇总了C++中net::CBuffer的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer类的具体用法?C++ CBuffer怎么用?C++ CBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: deserialize

	void CMessageHoundCharge::deserialize(Net::CBuffer& buffer) {
		buffer.read( &_isActive, sizeof(_isActive) );

		// Solo si la habilidad esta activa se mandan el resto 
		// de los atributos
		if(_isActive) {
			buffer.read( &_filterMask, sizeof(_filterMask) );
			buffer.read( &_force, sizeof(_force) );
		}	
	}
开发者ID:franaisa,项目名称:Gloom,代码行数:10,代码来源:MessageHoundCharge.cpp

示例2: serialize

	Net::CBuffer CMessageHoundCharge::serialize() {
		Net::CBuffer buffer;
		buffer.serialize( std::string("CMessageHoundCharge"), true );

		buffer.write( &_isActive, sizeof(_isActive) );
		// El resto de los atributos nos interesan solo si se
		// activa la habilidad
		if(_isActive) {
			buffer.write( &_filterMask, sizeof(_filterMask) );
			buffer.write( &_force, sizeof(_force) );
		}

		return buffer;
	}//
开发者ID:franaisa,项目名称:Gloom,代码行数:14,代码来源:MessageHoundCharge.cpp

示例3: deserialize

	void CMessageInt::deserialize(Net::CBuffer &data)
	{

		CMessage::deserialize(data);
		data.read(&_int,  sizeof(_int));
			
	} // deserialize
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:7,代码来源:MessageInt.cpp

示例4: serialize

	void CMessageBool::serialize(Net::CBuffer &data)
	{
		CMessage::serialize(data);
		data.write((void*) (&_bool),	sizeof(_bool));
		
					
	} // serialize
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:7,代码来源:MessageBool.cpp

示例5: deserialize

	void CMessageSetOwner::deserialize(Net::CBuffer& buffer) {
		TEntityID id;
		// Por problemas con enumerados utilizamos directamente
		// el read en vez del deserialize
		buffer.read( &id, sizeof(id) );

		_entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(id);
	}
开发者ID:franaisa,项目名称:Gloom,代码行数:8,代码来源:MessageSetOwner.cpp

示例6: deserialize

	void CMessageBool::deserialize(Net::CBuffer &data)
	{

		CMessage::deserialize(data);
		data.read(&_bool,	sizeof(_bool));
		
			
	} // deserialize
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:8,代码来源:MessageBool.cpp

示例7: serialize

	// TODO FRS no es necesario enviar todo el transform siempre -> solo posicion / rotacion en eje vertical
	void CMessageTF::serialize(Net::CBuffer &data)
	{
		CMessage::serialize(data);

		for(int i = 0; i < 4; ++i)
			for(int j = 0; j < 4; ++j)
				data.write((void*)&_transform[i][j], sizeof(_transform[i][j]));
			
	} // serialize
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:10,代码来源:MessageTF.cpp

示例8: deserialize

	void CMessageTF::deserialize(Net::CBuffer &data)
	{
		CMessage::deserialize(data);

		for(int i = 0; i < 4; ++i)
			for(int j = 0; j < 4; ++j)
				data.read(&_transform[i][j], sizeof(_transform[i][j]));
			
	} // deserialize
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:9,代码来源:MessageTF.cpp

示例9: disconnectionPacketReceived

	void CGameServerState::disconnectionPacketReceived(Net::CPaquete* packet) {
		// Obtenemos el puntero al gestor de jugadores y el id de red del cliente que se quiere desconectar
		Net::NetID playerNetId = packet->getConexion()->getId();

		// Eliminamos la entidad manejada por el cliente que se quiere desconectar.
		// Para ello comprobamos si tiene asignado un id de entidad. Si no lo tiene, es que
		// no ha sido creada ninguna entidad (podria estar conectandose).
		if( _playersMgr->existsByNetId(playerNetId) ) {
			std::pair<Logic::TEntityID, bool> logicIdPair = _playersMgr->getPlayerId(playerNetId);
			if(logicIdPair.second) {
				Logic::CEntity* entityToBeDeleted = _map->getEntityByID(logicIdPair.first);
				Logic::CEntityFactory::getSingletonPtr()->deferredDeleteEntity(entityToBeDeleted, true);

				// A nivel logico, conviene que los clientes sepan quien se desconecta,
				// especialmente para eliminar cosas del hud
				Net::NetMessageType ackMsg = Net::PLAYER_OFF_MATCH;
				Net::CBuffer disconnectMsg;
				disconnectMsg.write(&ackMsg, sizeof(ackMsg));
				disconnectMsg.write(&playerNetId, sizeof(playerNetId));
				disconnectMsg.serialize(entityToBeDeleted->getName(), false);

				_netMgr->broadcast(disconnectMsg.getbuffer(), disconnectMsg.getSize());
			}

			// Eliminamos el jugador que se desconecta del manager de jugadores
			_playersMgr->removePlayer(playerNetId);
		}
	} // disconnexionPacketReceived
开发者ID:franaisa,项目名称:Gloom,代码行数:28,代码来源:GameServerState.cpp

示例10: serialize

	void CMessageAudio::serialize(Net::CBuffer &data)
	{
		CMessage::serialize(data);
		
		unsigned int size = _path.size();  
		data.write(&size,sizeof(size));		
		data.write((void*)_path.c_str(),size);

		size = _id.size();  
		data.write(&size,sizeof(size));		
		data.write((void*)_id.c_str(),size);

		data.write((void*)(&_position.x), sizeof(_position.x));
		data.write((void*)(&_position.y), sizeof(_position.y));
		data.write((void*)(&_position.z), sizeof(_position.z));

		data.write((void*) (&_notIfPlay),	sizeof(_notIfPlay));
		data.write((void*) (&_isPlayer),	sizeof(_isPlayer));
	
	}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:20,代码来源:MessageAudio.cpp

示例11: deserialize

	void CMessageAudio::deserialize(Net::CBuffer &data) {

		unsigned int size;
			data.read(&size, sizeof(size)); 		
		char* aux = new char[size];		
			data.read(aux, size);
			_path.assign(aux,size); 
			delete[] aux;

		unsigned int size1;
			data.read(&size1, sizeof(size1)); 		
		char* aux1 = new char[size1];		
			data.read(aux1, size1);
			_id.assign(aux1,size1); 
			delete[] aux1;

		data.read(&_position.x, sizeof(_position.x));
		data.read(&_position.y, sizeof(_position.y));
		data.read(&_position.z, sizeof(_position.z));

		data.read(&_notIfPlay,	sizeof(_notIfPlay));
		data.read(&_isPlayer,	sizeof(_isPlayer));

	}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:24,代码来源:MessageAudio.cpp

示例12: deserialize

	void CMessageControl::deserialize(Net::CBuffer& buffer) {
		buffer.deserialize(_seq);
		buffer.read(&_controlType, sizeof(_controlType));
		
	}
开发者ID:franaisa,项目名称:Gloom,代码行数:5,代码来源:MessageControl.cpp

示例13: deserialize

	void CMessagePrimarySpell::deserialize(Net::CBuffer& buffer) {
		buffer.deserialize(_spell);
	}
开发者ID:franaisa,项目名称:Gloom,代码行数:3,代码来源:MessagePrimarySpell.cpp

示例14: deserialize

	void CMessagePrimaryShoot::deserialize(Net::CBuffer& buffer) {
		buffer.deserialize(_shoot);
	}
开发者ID:franaisa,项目名称:Gloom,代码行数:3,代码来源:MessagePrimaryShoot.cpp

示例15: deserialize

	void CMessageMouse::deserialize(Net::CBuffer& buffer) {
		_controlType = Control::MOUSE;
		buffer.deserialize(_seq);
		buffer.deserialize(_mouse[0]);
		buffer.deserialize(_mouse[1]);
	}
开发者ID:franaisa,项目名称:Gloom,代码行数:6,代码来源:MessageMouse.cpp


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