⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netobject_controller_generic.h

📁 这是一款2d游戏引擎
💻 H
字号:
/*  $Id: netobject_controller_generic.h,v 1.10 2003/11/11 10:13:25 grumbel Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*/

#ifndef header_netobject_controller_generic
#define header_netobject_controller_generic

#if _MSC_VER > 1000
#pragma once
#endif

#ifdef _MSC_VER
#pragma warning(disable : 4786)
#endif

#include "API/Network/NetSession/netcomputer.h"
#include "API/signals.h"
#include <string>
#include <map>
class CL_NetSession;
class CL_NetPacket;
class CL_NetObject_Client;
class CL_NetObject_Client_Generic;
class CL_NetObject_Server_Generic;

class CL_NetObject_Controller_Generic
{
//! Construction:
public:
	CL_NetObject_Controller_Generic(CL_NetSession *netsession, const std::string &channel);

	~CL_NetObject_Controller_Generic();

//! Attributes:
public:
	CL_Signal_v3<CL_NetObject_Client &, int, CL_NetPacket &> sig_create_object;

	std::map<int, CL_NetObject_Server_Generic *> server_objects;

	typedef std::pair<CL_NetComputer, int> ClientID;

	std::map<ClientID, CL_NetObject_Client_Generic *> client_objects;

	CL_NetSession *netsession;

	std::string channel;

	int obj_id_counter;

//! Operations:
public:
	int add_ref() { return ++ref_count; }

	int release_ref()
	{
		ref_count--;
		if (ref_count == 0) { delete this; return 0; }
		return ref_count;
	}

//! Implementation:
public:
	void on_received_netpacket(CL_NetPacket &packet, CL_NetComputer &from);

	CL_Slot slot_received_netpacket;

	int ref_count;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -