Petfilder Code richtig einfügen

04/25/2011 17:46 Schnuffel16#1
Hallo,
ich bin mit c++ nicht so sicher und wäre nett wenn mir jemand bestätigen könnte ob ich den code so richtig eingefügt habe . Ich hab mir jetzt schon ein paar petfilter codes angesehen und langsam komm ich zur überzeugung das das ein Teil vom Code fehlt.
Cross veröffentlicht Code Auszüge mit Zeilenangaben bezogen auf seinen VScoure code oder ? weil wenn ich den Clean Source nehme die auch Sedrika nimmt dann finde ich die Zeilenangabe nicht schlüssig. und wenn ich mir die von xXConXx die ansehe unterscheiden die sich auch wieder
Wäre also für jede Hilfe dankbar :confused:

Code:
BOOL CAIPet::SubItemLoot( void )
{
	CMover* pMover = GetMover();
	CMover* pOwner = prj.GetMover( m_idOwner );
	CWorld* pWorld = GetWorld();
	MoverProp *pProp = pMover->GetProp();
	D3DXVECTOR3 vPos = pMover->GetPos();
	CObj *pObj = NULL;
	int nRange = 0;
	D3DXVECTOR3 vDist;
	FLOAT fDistSq, fMinDist = 9999999.0f;
	CObj *pMinObj = NULL;

	vDist = pOwner->GetPos() - pMover->GetPos();
	fDistSq = D3DXVec3LengthSq( &vDist );
	if( fDistSq > 32.0f * 32.0f )	// ÁÖÀδ԰úÀÇ °Å¸®°¡ 32¹ÌÅͰ¡ ³ÑÀ¸¸é ¾ÆÀÌÅÛ ¾ÈÁý´Â´Ù.
		return FALSE;

	if( pOwner && pOwner->IsFly() )
		return FALSE;
		
	// ±ÙóÀÇ ¾ÆÀÌÅÛÀ» °Ë»öÇÔ. - ÁÖÀδԲ¨¸¸ °Ë»öÇØ¾ßÇÒµí...
	FOR_LINKMAP( pWorld, vPos, pObj, nRange, CObj::linkDynamic, pMover->GetLayer() )
	{
		if( pObj->GetType() == OT_ITEM )	//OT_ITEM
		{
			CItem *pItem = (CItem *)pObj;  //pItem vllt IK3 usw
			ItemProp* pItemProp	= pItem->GetProp();
			// ÀÌ°É µû·Î ³ÖÀºÀÌÀ¯´Â StateIdle ARRIVAL¿¡¼* DoLoot()ÇÏ°í ³*Á÷ÈÄ¿¡ ´Ù½Ã SubItemLoot()À» È£ÃâÇßÀ»¶§
			// LootÇÑ ¾ÆÀÌÅÛÀÌ ¾ÆÁ÷ ¾ÈÁö¿öÁ®¼* ¿©±â¼* ¶Ç °Ë»öÀÌ µÇ´õ¶ó°í.. ±×·¡¼* Áߺ¹µÇ´Â ¾ÆÀÌÅÛÀº °Ë»ö ¾ÈµÇ°Ô °íÃĺôÙ.
//			if( pItem->GetId() != m_idLootItem )

			if( pItem->IsDelete() == FALSE )
			{
				if( pItemProp )
				{
[COLOR="Red"]					BOOL b1 = TRUE;

#ifdef __WORLDSERVER
#ifdef _PETFILTER_HOL_B
						//Error("Kind1: %i,Kind2: %i,Kind3: %i; pMover->m_pActMover->bQuestItem: %i", (int) pItemProp->dwItemKind1, (int) pItemProp->dwItemKind2, (int) pItemProp->dwItemKind3, (int)pMover->m_pActMover->bQuestItem);
						// BYTE cQuestItem , cWeapons , cArmor , cCards , cDrinks, cEggs, cStones , cAccessory
						if(!pOwner->bQuestItem && pItemProp->dwItemKind1 == IK1_GENERAL && pItemProp->dwItemKind2 == IK2_GEM && pItemProp->dwItemKind3 == IK3_GEM)
							b1 = FALSE;
						else if(!pOwner->bWeapons && pItemProp->dwItemKind1 == IK1_WEAPON)
							b1 = FALSE;
						else if(!pOwner->bArmor && pItemProp->dwItemKind1 == IK1_ARMOR)
							b1 = FALSE;
						else if(!pOwner->bCards && pItemProp->dwItemKind1 == IK1_GENERAL && pItemProp->dwItemKind2 == IK2_MATERIAL && pItemProp->dwItemKind3 != IK3_ULTIMATE && pItemProp->dwItemKind3 != IK3_ENCHANT && pItemProp->dwItemKind3 != IK3_PIERDICE)
							b1 = FALSE;
						else if(!pOwner->bFood && pItemProp->dwItemKind1 == IK1_GENERAL && (pItemProp->dwItemKind2 == IK2_FOOD || pItemProp->dwItemKind2 == IK2_REFRESHER || pItemProp->dwItemKind2 == IK2_POTION))
							b1 = FALSE;
						else if(!pOwner->bEggs && pItemProp->dwItemKind1 == IK1_GENERAL && pItemProp->dwItemKind2 == IK2_GENERAL && pItemProp->dwItemKind3 == IK3_EGG)
							b1 = FALSE;
						else if(!pOwner->bStones && pItemProp->dwItemKind1 == IK1_GENERAL && pItemProp->dwItemKind2 == IK2_MATERIAL && (pItemProp->dwItemKind3 == IK3_PIERDICE || pItemProp->dwItemKind3 == IK3_ENCHANT || pItemProp->dwItemKind3 == IK3_ULTIMATE || pItemProp->dwItemKind3 == IK3_SUPSTONE))
							b1 = FALSE;
						else if(!pOwner->bAccessory && pItemProp->dwItemKind1 == IK1_GENERAL && pItemProp->dwItemKind2 == IK2_JEWELRY)
							b1 = FALSE;
#endif
#endif[/COLOR]

					if( pOwner->IsLoot( pItem, TRUE ) && b1 )	// ·çÆÃµÇ´Â¾ÆÀÌÅÛÀÎÁö °Ë»çÇÔ.
					{
						vDist = pObj->GetPos() - pMover->GetPos();
						fDistSq = D3DXVec3LengthSq( &vDist );		// °Å¸® ±¸ÇÔ.
						if( fDistSq < 15 * 15 && fDistSq < fMinDist )	// 10¹ÌÅÍ À̳»°í... °¡Àå °Å¸®°¡ °¡±î¿î ¾ÆÅÛÀ» ãÀ½.						
							[COLOR="Red"]pMinObj = pObj;						[/COLOR]
					}
				}
			}
		}
	}
	END_LINKMAP

	if( pMinObj )
	{
		// Get object ID of the loot item
		DWORD dwIdLootItem = ((CItem *)pMinObj)->GetId();

		// Get the item obj
		CCtrl *pCtrl = prj.GetCtrl( dwIdLootItem );	

		// if exists...
		if( IsValidObj(pCtrl) )
		{
				MoveToDst( pMinObj->GetPos() );		// ¸ñÇ¥ÂÊÀ¸·Î À̵¿.
				m_idLootItem = dwIdLootItem;
				m_bLootMove = TRUE;
		}
	}
		
	return m_bLootMove;
}

BOOL CAIPet::StateInit( const AIMSG & msg )
{
	return TRUE;
}
04/25/2011 17:58 Neonbilli#2
xD wenns funktioniert wirds wohl richtig sein. es gibt nicht so viele die das haben( ist nicht standart). Probiers aus...
04/25/2011 18:12 Pumbaaa#3
Ist richtig, sieht man doch sogar als Anfänger ;D
04/25/2011 18:41 ~Product~#4
richtig ja aber ob der klappt ist ne andere sache
compilier mal alles und geh ingame und teste ob es klappt^^
04/26/2011 18:13 xXConsXx#5
also ich hab nen kleinen unterschied bei mir
Code:
					if( pOwner->IsLoot( pItem, TRUE ) && b1 )	// ·çÆÃµÇ´Â¾ÆÀÌÅÛÀÎÁö °Ë»çÇÔ.
					{
						vDist = pObj->GetPos() - pMover->GetPos();
						fDistSq = D3DXVec3LengthSq( &vDist );		// °Å¸® ±¸ÇÔ.
						if( fDistSq < 15 * 15 && fDistSq < fMinDist )	// 10¹ÌÅÍ À̳»°í... °¡Àå °Å¸®°¡ °¡±î¿î ¾ÆÅÛÀ» ãÀ½.
						[COLOR="Red"]{[/COLOR]
							pMinObj = pObj;
						[COLOR="Red"]}[/COLOR]
					}
04/26/2011 18:14 Pumbaaa#6
das is aber egal :D
04/26/2011 18:25 Fullscreen#7
Die Klammen ja, die darüber und darunter aber nicht ;)
04/26/2011 18:25 Ancientsword#8
Quote:
Originally Posted by Pumbaaa View Post
das is aber egal :D
Sag nochmal das ist egal und ich hau dich Oo . Sowas bewirkt unterschiede.
04/26/2011 18:44 Pumbaaa#9
Quote:
Originally Posted by Ancientsword View Post
Sag nochmal das ist egal und ich hau dich Oo . Sowas bewirkt unterschiede.
Bewirkt es nicht, solange der Zweig nur eine Anweisung enthält.
Rein Maschinel ist der Code dann identisch.
Wenn es 2 gibt, hast du recht.
Beispiel:
Code:
if( var==0 )
     cout << "Var = 0! \n";
else
     cout <<"Var != 0! \n";
     cout <<"Wo gehöre ich hin?";

[I]Quelle: C++ von A bis Z von Jürgen Wolf[/I]
Vom Compiler schwer zu interpretieren.
04/26/2011 20:41 Schnuffel16#10
Die variabel (pMinObj) soll den wert der Variabel (pObj) übernehmen .Daas steht doch allein, was sollen dann die Klammern , die bewirken doch nichts. Wenn ich flach liege sll mich bitte mal jemand aufklären.
Liebe Grüße Schnuffel