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


C++ ZoneServer::GetInstanceID方法代码示例

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


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

示例1: handle_rc_get_zone_info

void handle_rc_get_zone_info(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> &params) {
	std::string error;
	std::map<std::string, std::string> res;
	if(params.size() != 1) {
		error = "Expected only one zone_id.";
		RemoteCallResponse(connection_id, request_id, res, error);
		return;
	}

	ZoneServer *zs = zoneserver_list.FindByID(atoi(params[0].c_str()));
	if(zs == nullptr) {
		error = "Invalid zone";
		RemoteCallResponse(connection_id, request_id, res, error);
		return;
	}

	res["type"] = zs->IsStaticZone() ? "static" : "dynamic";
	res["zone_id"] = itoa(zs->GetZoneID());
	res["instance_id"] = itoa(zs->GetInstanceID());
	res["launch_name"] = zs->GetLaunchName();
	res["launched_name"] = zs->GetLaunchedName();
	res["short_name"] = zs->GetZoneName();
	res["long_name"] = zs->GetZoneLongName();
	res["port"] = itoa(zs->GetCPort());
	res["player_count"] = itoa(zs->NumPlayers());
	RemoteCallResponse(connection_id, request_id, res, error);
}
开发者ID:jcon321,项目名称:Server,代码行数:27,代码来源:remote_call.cpp

示例2: FindByZoneID

ZoneServer* ZSList::FindByZoneID(uint32 ZoneID) {
	LinkedListIterator<ZoneServer*> iterator(list);
	iterator.Reset();
	while(iterator.MoreElements())
	{
		ZoneServer* tmp = iterator.GetData();
		if (tmp->GetZoneID() == ZoneID && tmp->GetInstanceID() == 0) {
			return tmp;
		}
		iterator.Advance();
	}
	return 0;
}
开发者ID:Corysia,项目名称:Server,代码行数:13,代码来源:zonelist.cpp

示例3: Process


//.........这里部分代码省略.........
			if(pack->size != sizeof(WorldToZone_Struct))
				break;

			WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer;
			Client* client = 0;
			client = client_list.FindByAccountID(wtz->account_id);
			if(client != 0)
				client->Clearance(wtz->response);
		}
		case ServerOP_ZoneToZoneRequest: {
		//
		// solar: ZoneChange is received by the zone the player is in, then the
		// zone sends a ZTZ which ends up here.  This code then find the target
		// (ingress point) and boots it if needed, then sends the ZTZ to it.
		// The ingress server will decide wether the player can enter, then will
		// send back the ZTZ to here.  This packet is passed back to the egress
		// server, which will send a ZoneChange response back to the client
		// which can be an error, or a success, in which case the client will
		// disconnect, and their zone location will be saved when ~Client is
		// called, so it will be available when they ask to zone.
		//

			
			if(pack->size != sizeof(ZoneToZone_Struct))
				break;
			ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
			ClientListEntry* client = NULL;
			if(WorldConfig::get()->UpdateStats)
				client = client_list.FindCharacter(ztz->name);

			zlog(WORLD__ZONE,"ZoneToZone request for %s current zone %d req zone %d\n",
				ztz->name, ztz->current_zone_id, ztz->requested_zone_id);

			if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id)	// this is a request from the egress zone
			{
				zlog(WORLD__ZONE,"Processing ZTZ for egress from zone for client %s\n", ztz->name);

				if
				(
					ztz->admin < 80 &&
					ztz->ignorerestrictions < 2 &&
					zoneserver_list.IsZoneLocked(ztz->requested_zone_id)
				)
				{
					ztz->response = 0;
					SendPacket(pack);
					break;
				}

				ZoneServer *ingress_server = NULL;
				if(ztz->requested_instance_id > 0)
				{
					ingress_server = zoneserver_list.FindByInstanceID(ztz->requested_instance_id);
				}
				else
				{
					ingress_server = zoneserver_list.FindByZoneID(ztz->requested_zone_id);

				}

				if(ingress_server)	// found a zone already running
				{
					_log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name);
					ztz->response = 1;
				}
				else	// need to boot one
开发者ID:Vaion,项目名称:Server,代码行数:67,代码来源:zoneserver.cpp


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