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


C++ Zone::getZoneID方法代码示例

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


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

示例1: outputLoadValue

void ZoneGroupManager::outputLoadValue()
	throw(Error)
{
	//------------------------------------------------------------------
	// ZoneGroup load
	//------------------------------------------------------------------
	ofstream file("loadBalance.txt", ios::app);

	VSDateTime current = VSDateTime::currentDateTime();
	file << current.toString() << endl;

	map< ZoneGroupID_t , ZoneGroup* >::const_iterator itr;

	for (itr = m_ZoneGroups.begin() ; itr != m_ZoneGroups.end() ; itr ++) 
	{
		ZoneGroup* pZoneGroup = itr->second;
		file << "[" << (int)pZoneGroup->getZoneGroupID() << "] ";

		const map< ZoneID_t, Zone* >& zones = pZoneGroup->getZones();
		map< ZoneID_t, Zone* >::const_iterator iZone;

		// 각 Zone의 loadValue를 구한다.
		int totalLoad = 0;
		for (iZone=zones.begin(); iZone!=zones.end(); iZone++)
		{
			Zone* pZone = iZone->second;

			int load = pZone->getLoadValue();
			int playerLoad = pZone->getPCCount();

			file << (int)pZone->getZoneID() << "(" << load << ", " << playerLoad << ") ";

			totalLoad += load;
		}

		file << " = " << totalLoad << endl;

	}

	file << endl;
	file.close();
}
开发者ID:jun199004,项目名称:server,代码行数:42,代码来源:ZoneGroupManager.cpp

示例2: execute

//////////////////////////////////////////////////////////////////////////////
// 뱀파이어 인벤토리 핸들러
//////////////////////////////////////////////////////////////////////////////
void BloodyTunnel::execute(Vampire* pVampire, ObjectID_t InvenObjectID, ObjectID_t InventoryItemObjectID, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, VampireSkillSlot* pSkillSlot)
	throw(Error)
{
	__BEGIN_TRY

	//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl;

	Assert(pVampire != NULL);
	Assert(pSkillSlot != NULL);

	try 
	{
		Player* pPlayer = pVampire->getPlayer();
		Zone* pZone = pVampire->getZone();
		Inventory* pInventory = pVampire->getInventory();

		Assert(pPlayer != NULL);
		Assert(pZone != NULL);
		Assert(pInventory!= NULL);

		// 전쟁 존이라면 BloodyTunnel를 사용할 수 없다.
		// 일단은 ZoneID로 가는데.. ZoneInfo에 넣도록 해야한다.
		///*
		//if (pZone->getZoneID()==1122 || pZone->getZoneID()==1123)
		// 이벤트 경기장/OX 막기. by sigi. 2002.8.31
		//int zoneID = pZone->getZoneID();
		//if (zoneID==1005 || zoneID==1006)
		if (pZone->isNoPortalZone()
			|| pZone->isMasterLair()
			|| pZone->isCastle()
			|| pZone->isHolyLand())
		{
			executeSkillFailException(pVampire, getSkillType());
			//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
			return;
		}
		//*/

		SubInventory* pInventoryItem = NULL;
		int invenID = 0;

		if (InventoryItemObjectID != 0 )
		{
			//cout << "서브 인벤토리에서 사용 : " << InventoryItemObjectID << endl;
			CoordInven_t X, Y;
			pInventoryItem = dynamic_cast<SubInventory*>(pInventory->findItemOID(InventoryItemObjectID, X, Y ));

			TradeManager* pTradeManager = pZone->getTradeManager();
			Assert(pTradeManager != NULL);

			if (pInventoryItem == NULL || pTradeManager->hasTradeInfo(pVampire->getName()) )
			{
				//cout << "근데 서브 인벤토리가 없다." <<endl;
				executeSkillFailException(pVampire, getSkillType());
				return;
			}

			pInventory = pInventoryItem->getInventory();
			invenID = pInventoryItem->getItemID();
		}

		Item* pItem = pInventory->getItem(X, Y);
		// 아이템이 없거나, 뱀파이어 포탈 아이템이 아니거나, OID가 틀리다면 기술 사용 불가
		if (pItem == NULL || pItem->getItemClass() != Item::ITEM_CLASS_VAMPIRE_PORTAL_ITEM || pItem->getObjectID() != InvenObjectID)
		{
			executeSkillFailException(pVampire, getSkillType());
			//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
			return;
		}

		VampirePortalItem* pVampirePortalItem = dynamic_cast<VampirePortalItem*>(pItem);
		Assert(pVampirePortalItem != NULL);

		// 뱀파이어 포탈 아이템에 기록된 위치가 없을 경우에는 실패다.
		ZoneID_t    zoneid = pVampirePortalItem->getZoneID();
		ZoneCoord_t tx     = pVampirePortalItem->getX();
		ZoneCoord_t ty     = pVampirePortalItem->getY();
		if (zoneid == 0)
		{
			executeSkillFailException(pVampire, getSkillType());
			//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
			return;
		}

		// 얻어온 목표 존과 좌표를 검증한다.
		Zone* pTargetZone = getZoneByZoneID(zoneid);

		// 아담의 성지와 다른 존과는 연결되지 않는다.
		if (pZone->isHolyLand() != pTargetZone->isHolyLand())
		{
			executeSkillFailException(pVampire, getSkillType());
			return;
		}

		//cout << "타겟 존 포인터 획득 성공" << endl;

		VSRect* pRect = pTargetZone->getOuterRect();
//.........这里部分代码省略.........
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:BloodyTunnel.cpp

示例3: execute

//////////////////////////////////////////////////////////////////////////////
// 몬스터 셀프 핸들러
//////////////////////////////////////////////////////////////////////////////
void SummonMonsters::execute(Monster* pMonster)
	throw(Error)
{
	__BEGIN_TRY

	//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl;

	//cout << "SummonMonsters" << endl;

	Assert(pMonster != NULL);
	Zone* pZone = pMonster->getZone();
	Assert(pZone != NULL);


	try 
	{
		if (pMonster->isFlag(Effect::EFFECT_CLASS_HIDE))
		{
			//cout << "SummonMonsters: hide" << endl;
			return;
		}
		if (pMonster->isFlag(Effect::EFFECT_CLASS_INVISIBILITY))
		{
			addVisibleCreature(pZone, pMonster, true);
		}

		//GCSkillToSelfOK2 _GCSkillToSelfOK2;

		ZoneCoord_t x = pMonster->getX();
		ZoneCoord_t y = pMonster->getY();

		bool bRangeCheck    = checkZoneLevelToUseSkill(pMonster);
		//bool bMoveModeCheck = pMonster->isWalking();

		if (bRangeCheck)// && bMoveModeCheck)
		{
			//--------------------------------------------------------
			// 주위에 knockback되는맞는 애들을 체크해준다.
			//--------------------------------------------------------
			//SkillInput input(pMonster);
			//SkillOutput output;
			//computeOutput(input, output);

			SUMMON_INFO2 summonInfo;

			bool hasInfo = pMonster->getMonsterSummonInfo(summonInfo);

			if (!hasInfo || summonInfo.pMonsters==NULL)
			{
				//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
				// 소환할 몹이 없는 경우다. -_-;
				executeSkillFailNormal(pMonster, getSkillType(), NULL);

				// 마스터 레어에서 마스터가 몹을 소환할려고 한 경우
				if (pZone->isMasterLair() && pMonster->isMaster())
				{
					MasterLairManager* pMasterLairManager = pZone->getMasterLairManager();
					Assert(pMasterLairManager!=NULL);

					// 더 이상 소환할게 없다면..
					// 마스터가 직접 나서서 싸워야겠지..
					pMasterLairManager->setMasterReady();
					//cout << "no more SummonMonsters: set MasterReady" << endl;
				}
			}

			if (pMonster->isMaster() && pZone->isMasterLair())
			{
				MasterLairManager* pMasterLairManager = pZone->getMasterLairManager();
				Assert(pMasterLairManager!=NULL);
				// minion combat에서는 지정된 좌표에 소환한다.

				MasterLairInfo* pInfo = g_pMasterLairInfoManager->getMasterLairInfo(pZone->getZoneID());
				Assert(pInfo!=NULL);

				if (!pMasterLairManager->isMasterReady())
				{
					x = pInfo->getSummonX();
					y = pInfo->getSummonY();

					GCSay gcSay;
					gcSay.setObjectID(pMonster->getObjectID());
					gcSay.setColor(MASTER_SAY_COLOR);
					gcSay.setMessage(pInfo->getRandomMasterSummonSay());
					if (!gcSay.getMessage().empty())
						pZone->broadcastPacket(pMonster->getX(), pMonster->getY(), &gcSay);
				}

				// 마스터 레어에서는 소환된 몬스터들이 아템 안 준다.
				// by sigi. 2002.11.21
				summonInfo.hasItem = false;
			}

			summonInfo.scanEnemy = true;
			summonInfo.clanType = SUMMON_INFO::CLAN_TYPE_GROUP;
			summonInfo.clanID = pMonster->getClanType(); // 주인의 clan을 따른다.
			summonInfo.X = x;
//.........这里部分代码省略.........
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:SummonMonsters.cpp

示例4: execute

//////////////////////////////////////////////////////////////////////////////
// 뱀파이어 인벤토리 핸들러
//////////////////////////////////////////////////////////////////////////////
void TransformToWolf::execute(Vampire* pVampire, ObjectID_t InvenObjectID, ObjectID_t InventoryItemObjectID, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, VampireSkillSlot* pSkillSlot)
	throw(Error)
{
	__BEGIN_TRY

	//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl;

	Assert(pVampire != NULL);
	Assert(pSkillSlot != NULL);

	try 
	{
		Player* pPlayer = pVampire->getPlayer();
		Zone* pZone = pVampire->getZone();
		Inventory* pInventory = pVampire->getInventory();

		Assert(pPlayer != NULL);
		Assert(pZone != NULL);
		Assert(pInventory!= NULL);

		SubInventory* pInventoryItem = NULL;
		int invenID = 0;

		if (InventoryItemObjectID != 0 )
		{
			//cout << "서브 인벤토리에서 사용 : " << InventoryItemObjectID << endl;
			CoordInven_t X, Y;
			pInventoryItem = dynamic_cast<SubInventory*>(pInventory->findItemOID(InventoryItemObjectID, X, Y ));

			TradeManager* pTradeManager = pZone->getTradeManager();
			Assert(pTradeManager != NULL);

			if (pInventoryItem == NULL || pTradeManager->hasTradeInfo(pVampire->getName()) )
			{
				//cout << "근데 서브 인벤토리가 없다." <<endl;
				executeSkillFailException(pVampire, getSkillType());
				return;
			}

			pInventory = pInventoryItem->getInventory();
			invenID = pInventoryItem->getItemID();
		}

		Item* pItem = pInventory->getItem(X, Y);
		Assert(pItem != NULL);

		// 적당한 아이템이 아니라면 당연히 변신할 수 없다.
		// PK존에서는 변신할 수 없다.
		if (pItem->getItemClass() != Item::ITEM_CLASS_VAMPIRE_ETC 
			|| pItem->getItemType() != 0
			|| pVampire->hasRelicItem()
			|| g_pPKZoneInfoManager->isPKZone(pZone->getZoneID() )
			|| pVampire->isFlag(Effect::EFFECT_CLASS_REFINIUM_TICKET )
			|| GDRLairManager::Instance().isGDRLairZone(pZone->getZoneID())
		)
		{
			executeSkillFailException(pVampire, getSkillType());
			//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
			return;
		}
		
		GCSkillToInventoryOK1 _GCSkillToInventoryOK1;

		SkillType_t SkillType  = pSkillSlot->getSkillType();
		SkillInfo*  pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType);

		ZoneCoord_t x = pVampire->getX();
		ZoneCoord_t y = pVampire->getY();

		// Knowledge of Innate 가 있다면 hit bonus 10
		int HitBonus = 0;
		if (pVampire->hasRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE ) )
		{
			RankBonus* pRankBonus = pVampire->getRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE);
			Assert(pRankBonus != NULL);

			HitBonus = pRankBonus->getPoint();
		}

		int  RequiredMP     = decreaseConsumeMP(pVampire, pSkillInfo);
		bool bManaCheck     = hasEnoughMana(pVampire, RequiredMP);
		bool bTimeCheck     = verifyRunTime(pSkillSlot);
		bool bRangeCheck    = checkZoneLevelToUseSkill(pVampire);
		bool bHitRoll       = HitRoll::isSuccessMagic(pVampire, pSkillInfo, pSkillSlot, HitBonus);
		bool bMoveModeCheck = pVampire->isWalking();
		bool bEffected      = pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF)
								|| pVampire->isFlag(Effect::EFFECT_CLASS_HAS_FLAG)
								|| pVampire->isFlag(Effect::EFFECT_CLASS_HAS_SWEEPER);

		if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bMoveModeCheck && !bEffected)
		{
			decreaseMana(pVampire, RequiredMP, _GCSkillToInventoryOK1);

			SkillInput input(pVampire);
			SkillOutput output;
			computeOutput(input, output);

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

示例5: addShrineToZone

Item* CastleShrineInfoManager::addShrineToZone(ShrineInfo& shrineInfo, ItemType_t itemType )
	throw(Error)
{
	__BEGIN_TRY

	// 성단을 넣을 존을 가져온다.
	Zone* pZone = getZoneByZoneID(shrineInfo.getZoneID());
	Assert(pZone != NULL);

	MonsterCorpse* pShrine = new MonsterCorpse(shrineInfo.getMonsterType(), shrineInfo.getName(), 2);
	Assert(pShrine != NULL);

	pShrine->setShrine(true);
	pShrine->setZone(pZone);

	pZone->getObjectRegistry().registerObject(pShrine);
	shrineInfo.setObjectID(pShrine->getObjectID());

	Item* pItem =  NULL;

/*	if (shrineInfo.getShrineType() == ShrineInfo::SHRINE_GUARD )
	{
		pShrine->setFlag(Effect::EFFECT_CLASS_SHRINE_GUARD);

		EffectShrineGuard* pEffect = new EffectShrineGuard(pShrine);
		pEffect->setShrineID(itemType);
		pEffect->setTick(60 * 10);

		pShrine->getEffectManager().addEffect(pEffect);
	}
	else if (shrineInfo.getShrineType() == ShrineInfo::SHRINE_HOLY )
	{
		pShrine->setFlag(Effect::EFFECT_CLASS_SHRINE_HOLY);

		EffectShrineHoly* pEffect = new EffectShrineHoly(pShrine);
		pEffect->setShrineID(itemType);
		pEffect->setTick(60 * 10);

		pShrine->getEffectManager().addEffect(pEffect);
	}*/

	TPOINT tp = pZone->addItem(pShrine, shrineInfo.getX(), shrineInfo.getY(), true);
	Assert(tp.x != -1);

	// 성의 상징을 추가할 필요가 있다면 추가한다.
	if (shrineInfo.getShrineType() == ShrineInfo::SHRINE_GUARD )
	{
		//if (AddBible[ itemType ] )
		{
			list<OptionType_t> optionNULL;
			pItem = g_pItemFactoryManager->createItem(Item::ITEM_CLASS_CASTLE_SYMBOL, itemType, optionNULL);
			Assert(pItem != NULL);

			char strZoneID[10];
			sprintf(strZoneID, "%d", (int)pZone->getZoneID());

			pZone->registerObject(pItem);
			pItem->create(strZoneID, STORAGE_CORPSE, pShrine->getObjectID(), 0, 0);

			pShrine->addTreasure(pItem);
		}

		// 수호성단이라는걸 표시해둔다.
		pShrine->setFlag(Effect::EFFECT_CLASS_CASTLE_SHRINE_GUARD);

		// 모든 수호성단에 Shield Effect 붙인다
		pShrine->setFlag(Effect::EFFECT_CLASS_SHRINE_SHIELD);

		EffectShrineShield* pEffect = new EffectShrineShield(pShrine);
		pEffect->setShrineID(itemType);
		pEffect->setTick(60 * 10);

		pShrine->getEffectManager().addEffect(pEffect);
	}
	else
	{
		// 성지성단이라는걸 표시해둔다.
		pShrine->setFlag(Effect::EFFECT_CLASS_CASTLE_SHRINE_HOLY);
	}

	// 성단 좌표를 새로 세팅한다.
	shrineInfo.setX(tp.x);
	shrineInfo.setY(tp.y);

	return pItem;

	__END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:88,代码来源:CastleShrineInfoManager.cpp

示例6: execute


//.........这里部分代码省略.........
			pNewSlayer->setFlagSet(pVampire->getFlagSet());
			pVampire->setFlagSet(NULL);

			Item* pItem = NULL;
			_TPOINT point;

			// 입고 있는 아이템들을 인벤토리 또는 바닥으로 옮긴다.
			for(int part = 0; part < (int)Vampire::VAMPIRE_WEAR_MAX; part++)
			{
				pItem = pVampire->getWearItem((Vampire::WearPart)part);
				if (pItem != NULL)
				{
					// 먼저 기어에서 삭제하고...
					pVampire->deleteWearItem((Vampire::WearPart)part);
			
					// 인벤토리에 자리가 있으면 인벤토리에 더하고...
					if (pInventory->getEmptySlot(pItem, point))
					{
						pInventory->addItem(point.x, point.y, pItem);
						pItem->save(pNewSlayer->getName(), STORAGE_INVENTORY, 0, point.x, point.y);
					}
					// 자리가 없으면 바닥에 떨어뜨린다.
					else
					{
						ZoneCoord_t ZoneX = pVampire->getX();
						ZoneCoord_t ZoneY = pVampire->getY();

						TPOINT pt;

						pt = pZone->addItem(pItem, ZoneX , ZoneY);

						if (pt.x != -1) 
						{
							pItem->save("", STORAGE_ZONE, pZone->getZoneID(), pt.x, pt.y);
						} 
						else 
						{
							pItem->destroy();
							SAFE_DELETE(pItem);
						}
					}
				}
			}

			pItem = pVampire->getExtraInventorySlotItem();
			if (pItem != NULL)
			{
				pVampire->deleteItemFromExtraInventorySlot();

				// 인벤토리에 자리가 있으면 인벤토리에 더하고...
				if (pInventory->getEmptySlot(pItem, point))
				{
					pInventory->addItem(point.x, point.y, pItem);
					pItem->save(pNewSlayer->getName(), STORAGE_INVENTORY, 0, point.x, point.y);
				}
				// 자리가 없으면 바닥에 떨어뜨린다.
				else
				{
					TPOINT pt;
					ZoneCoord_t ZoneX = pVampire->getX();
					ZoneCoord_t ZoneY = pVampire->getY();

					pt = pZone->addItem(pItem, ZoneX , ZoneY);

					if (pt.x != -1) 
					{
开发者ID:jun199004,项目名称:server,代码行数:67,代码来源:Restore2.cpp

示例7: executeEventTree

void CGUseMessageItemFromInventoryHandler::executeEventTree(CGUseMessageItemFromInventory* pPacket, Player* pPlayer)
	throw(ProtocolException, Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	// 상위 함수에서 에러 체크를 많이 했기 때문에,
	// 에러 체크를 대폭 축소한다.
	GamePlayer*     pGamePlayer  = dynamic_cast<GamePlayer*>(pPlayer);
	Creature*       pCreature    = pGamePlayer->getCreature();
	PlayerCreature* pPC          = dynamic_cast<PlayerCreature*>(pCreature);
	Inventory*      pInventory   = pPC->getInventory();
	Zone*           pZone        = pPC->getZone();
	CoordInven_t    InvenX       = pPacket->getX();
	CoordInven_t    InvenY       = pPacket->getY();
	Item*           pItem        = pInventory->getItem(InvenX, InvenY);
	ObjectID_t      ItemObjectID = pItem->getObjectID();
	MonsterType_t	MType		 = 0;

	int				time		 = 0;

	switch (pItem->getItemType() )
	{
		case 12:
			MType = 482;
			time = g_pVariableManager->getVariable(CHRISTMAS_TREE_DECAY_TIME ) / 10;
			break;
		case 26:
			MType = 650;
			time = 21600;
			break;
		case 27:
			MType = 650;
			time = 43200;
			break;
		case 28:
			MType = 650;
			time = 86400;
			break;
		default:
			{
				filelog("EventTree.log", "이상한 아템을 썼다. : %s 가 %d", pPC->getName().c_str(), pItem->getItemType());
				GCCannotUse _GCCannotUse;
				_GCCannotUse.setObjectID(pPacket->getObjectID());
				pGamePlayer->sendPacket(&_GCCannotUse);
			}
			return;
	}

	// 타일에 스킬을 쓰는 것이라고 보고 쓸 수 있는지를 체크한다.
	// 안전지대에서는 사용할 수 없다.
	// 쓸 수 있는 아이템 타입인지 왁인한다. ItemType 이 12인 것만 사용할 수 있다.
	// 근처에(플레이어 주위의 5x5타일 이내) 다른 트리가 있다면 사용할 수 없다.
	if (!isAbleToUseTileSkill(pCreature )
		|| pZone->isMasterLair()
		|| ItemObjectID != pPacket->getObjectID()
		|| checkCorpse(pZone, MType, pPC->getX() - 2, pPC->getY() - 2, pPC->getX() + 2, pPC->getY() + 2 )
		)
	{
		GCCannotUse _GCCannotUse;
		_GCCannotUse.setObjectID(pPacket->getObjectID());
		pGamePlayer->sendPacket(&_GCCannotUse);
		return;
	}

	// 성이면 성주 길드원만 쓸 수 있다.
	if (!pPC->isGOD() )
	{
		if (pZone->isCastle() )
		{
			if (!g_pCastleInfoManager->isCastleMember(pZone->getZoneID(), pPC ) )
			{
				GCCannotUse _GCCannotUse;
				_GCCannotUse.setObjectID(pPacket->getObjectID());
				pGamePlayer->sendPacket(&_GCCannotUse);
				return;
			}
		}
		// 성이 아닌 곳의 안전지대에선 절대 못 쓴다.
		else if (pZone->getZoneLevel(pCreature->getX(), pCreature->getY()) & SAFE_ZONE)
		{
			GCCannotUse _GCCannotUse;
			_GCCannotUse.setObjectID(pPacket->getObjectID());
			pGamePlayer->sendPacket(&_GCCannotUse);
			return;
		}
	}

/*	// 트리를 존에 추가한다. (트리는 몬스터 시체를 이용한다)
    MonsterCorpse* pMonsterCorpse = new MonsterCorpse(482, pPacket->getMessage(), 2); 
    Assert(pMonsterCorpse!=NULL); 
 
    pZone->getObjectRegistry().registerObject(pMonsterCorpse); 
 
    // 생성된 시체를 존에 추가한다. 
	int delayTime = g_pVariableManager->getVariable(CHRISTMAS_TREE_DECAY_TIME); // by sigi. 2002.12.17
//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:CGUseMessageItemFromInventoryHandler.cpp

示例8: min

//---------------------------------------------------------------------------
// make Balanced LoadInfo
//---------------------------------------------------------------------------
//
// bForce : balacing할 필요가 없다고 판단되는 경우에도 
//          강제로 ZoneGroup을 balancing할 경우에 사용된다.
//
// Zone마다의 10초간의 loop 처리 회수를 load값으로 한다.
// 계산에 편의를 위해서 실제 load는 다음과 같의 정의한다.
//
//     load = (loadLimit - load)*loadMultiplier;
//
//---------------------------------------------------------------------------
bool 	ZoneGroupManager::makeBalancedLoadInfo(LOAD_INFOS& loadInfos, bool bForce)
	throw(Error)
{
	const int maxGroup  		= m_ZoneGroups.size();	// zoneGroup 수
	//const int loadMultiplier 	= 5;					// load 가중치 - 느린 애들을 더 느리다...라고 하기 위한 것.
	const int loadLimit 		= 500;					// load 값 제한 - sleep에 의해서 제한돼서 루프 처리회수 500이 최고다.
	const int stableLoad 		= 120;					// 안정적인 load - 이 정도면 balancing이 필요없다고 생각되는 수준
	//const int minLoadGap 		= 20 * loadMultiplier;	// load balancing을 하기 위한 load 차이 - 최고~최저의 차이가 일정 값 이상이어야지 balancing이 의미있다.
	const int minLoadGap 		= 20;	// load balancing을 하기 위한 load 차이 - 최고~최저의 차이가 일정 값 이상이어야지 balancing이 의미있다.
	const int averageLoadPercent = 90;					// 한 group의 load % 제한. 100으로 해도 되겠지만 90정도가 괜찮은거 같다.

	int i;

	//LOAD_INFOS 	loadInfos;
	GROUPS		groups;

	map< ZoneGroupID_t , ZoneGroup* >::const_iterator itr;

	// 전체 load
	int totalLoad = 0;


	//------------------------------------------------------------------
	// ZoneGroup마다 loadValue 조사 
	//------------------------------------------------------------------
	int maxLoadValue = 0;
	int minLoadValue = loadLimit;
	for (itr = m_ZoneGroups.begin() ; itr != m_ZoneGroups.end() ; itr ++) 
	{
		ZoneGroup* pZoneGroup = itr->second;

		const map< ZoneID_t, Zone* >& zones = pZoneGroup->getZones();
		map< ZoneID_t, Zone* >::const_iterator iZone;

		// 각 Zone의 loadValue를 구한다.
		for (iZone=zones.begin(); iZone!=zones.end(); iZone++)
		{
			Zone* pZone = iZone->second;

			int load = pZone->getLoadValue();
			load = min(load, loadLimit);

			// 10~500
			maxLoadValue = max(maxLoadValue, load);
			minLoadValue = min(minLoadValue, load);

			// 숫자 적은게 느린 거다.
			// 계산의 편의를 위해서 숫자를 뒤집?는다. --> 큰 숫자 부하가 큰 걸로 바꾼다.
			// player숫자를 부하가중치로 사용한다.
			// playerLoad = 1 ~ 20정도?
			int playerLoad = pZone->getPCCount()/10;
			playerLoad = max(1, playerLoad);
			//load = (loadLimit - load)*loadMultiplier;	// 부하 가중치
			load = (loadLimit - load)*playerLoad;	// 부하 가중치

			LoadInfo* pInfo = new LoadInfo;
			pInfo->id 			= pZone->getZoneID();
			pInfo->oldGroupID 	= itr->first;
			pInfo->groupID 		= -1;
			pInfo->load 		= load;

			// 부하와 zoneID로 이루어진 key
			DWORD key = (load << 8) | pInfo->id;

			loadInfos[key] = pInfo;

			totalLoad += load;
		}
	}

	//------------------------------------------------------------------
	//
	// balancing이 필요한지 확인
	//
	//------------------------------------------------------------------
	if (!bForce)
	{
		int loadBoundary = stableLoad;
		//int loadBoundary = (loadLimit - stableLoad ) * loadMultiplier;

		// 부하 한계 수치보다 작거나
		// min~max 부하 수치 차이가 일정수치 이하이면
		// load balancing할 필요가 없다.
		//if (maxLoad <= loadBoundary
		if (minLoadValue >= loadBoundary
			|| maxLoadValue-minLoadValue <= minLoadGap)
		{
//.........这里部分代码省略.........
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:ZoneGroupManager.cpp


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