• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindCharBySerial函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FindCharBySerial

P_CHAR cRegion::RegionIterator4Chars::GetData(void)
{
	if (currentCharacter == NULL)
		currentCharacter =  FindCharBySerial(vecEntries[currentIndex]);
	else if (currentCharacter->serial != vecEntries[currentIndex])
		currentCharacter =  FindCharBySerial(vecEntries[currentIndex]);
	if (currentCharacter == NULL && currentIndex < vecEntries.size())
	{	// Dam, invalid entrie!
		// go next and recurse.
		(*this)++;
		return GetData();
	}
	return currentCharacter;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:14,代码来源:regions.cpp


示例2: FindCharBySerial

// TESTED: OKAY (i think so, but ugly -> redo it!)
// guildmastercalc(guildnumber) counts all fealty settings of all members of 'guildnumber' and sets
// a new guildmaster if there is a draw then there will be no master, til the next check ;)
void cGuildStone::CalcMaster()
{

	std::map<unsigned int, unsigned int> votes; // Key is member serial and data #votes
	
	unsigned int i;
	for ( i = 0; i < member.size(); ++i)
	{
		P_CHAR pc = FindCharBySerial( member[i] );
		votes[pc->guildfealty()]++;
	}

/*	struct maxVotes : public binary_function< pair<unsigned int, unsigned int>, pair<unsigned int, unsigned int>, bool>
	{
		operator(pair<unsigned int, unsigned int> a, pair<unsigned int, unsigned int> b) 
		{ 
			return (a.second < b.second);
		}
	};*/

	std::map<unsigned int, unsigned int>::iterator it = max_element(votes.begin(), votes.end(), votes.value_comp());

	unsigned int currenthighest = it->first;
	unsigned int currenthighestvotes = it->second;
	votes.erase( it );
	// check for draw;
	it = max_element(votes.begin(), votes.end(), votes.value_comp());
	bool draw =  ( it->second == currenthighestvotes );

	if (!draw)
		this->master = currenthighest;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:35,代码来源:guildstones.cpp


示例3: sysmessage

// guildrecruit() Let the guild members recruit some player into the guild.
// Checks the guild database if "to be recruited" player already in any other guild.
// puts a tag with players serial number into the guilds recruit database.
void cGuildStone::Recruit(UOXSOCKET s)
{

	if ( currchar[s]->guildstone() == INVALID_SERIAL ) 
	{
		sysmessage(s,"you are in no guild");
		return;
	}

	if(buffer[s][11]==0xFF && buffer[s][12]==0xFF && buffer[s][13]==0xFF && buffer[s][14]==0xFF) return; // check if user canceled operation - Morrolan
	int serial = calcserial(buffer[s][7],buffer[s][8],buffer[s][9],buffer[s][10]);
	P_CHAR pc = FindCharBySerial( serial );
	if(pc != NULL)
	{
			if (pc->guildstone() != INVALID_SERIAL) 
				sysmessage(s,"This person is already in a guild.");
			else 
			{
				if (pc->isPlayer())
				{
					this->recruit.push_back(pc->serial);
				} 
				else sysmessage(s,"This is not a player.");
			}
			//break;
		//} for
	}
	this->Menu(s,1);
	return;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:33,代码来源:guildstones.cpp


示例4: FindCharBySerial

void cRepeatAction::Expire()
{
	P_CHAR pMage = FindCharBySerial( _mage );

	if( pMage )
		TempEffects::instance()->insert( new cRepeatAction( pMage, _anim, _delay ) );
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:7,代码来源:tmpeff.cpp


示例5: while

void cTempEffects::check()
{
	cTempEffect *tEffect = NULL;
	if( !teffects.empty() )
		tEffect = *teffects.begin();

	if( !tEffect)
		return;

	while( tEffect && tEffect->expiretime <= uiCurrentTime )
	{
		if( isCharSerial( tEffect->getDest() ) )
		{
			P_CHAR pChar = dynamic_cast< P_CHAR >( FindCharBySerial( tEffect->getDest() ) );
			if (pChar) {
				pChar->removeEffect( tEffect );
			}
		}

		tEffect->Expire();
		std::pop_heap( teffects.begin(), teffects.end(), cTempEffects::ComparePredicate() );
		teffects.pop_back();
		delete tEffect;

		if( !teffects.empty() )
			tEffect = *teffects.begin();
		else
			break;
	}
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:30,代码来源:tmpeff.cpp


示例6: FindCharBySerial

void cTrade::clearalltrades()
{
	AllItemsIterator iterItems;
	for (iterItems.Begin(); !iterItems.atEnd(); iterItems++)
	{
		P_ITEM pi = iterItems.GetData();
		if (pi->type==1 && pi->pos.x==26 && pi->pos.y==0 && pi->pos.z==0 &&
			pi->id()==0x1E5E)
		{
			P_CHAR pc = FindCharBySerial(pi->contserial);
			P_ITEM pBackpack = Packitem(pc);
			SERIAL serial = pi->serial;
			unsigned int ci;
			vector<SERIAL> vecContainer = contsp.getData(serial);
			for (ci = 0; ci < vecContainer.size(); ci++)
			{
				P_ITEM pj = FindItemBySerial(vecContainer[ci]);
				if (pj != NULL)
					if ((pj->contserial==serial))
					{
						if(pBackpack != NULL)
						{
							pBackpack->AddItem(pj);
						}
					}
			}
			iterItems--; // Iterator will became invalid when deletting.
			Items->DeleItem(pi);
			clConsole.send("Trade cleared\n");
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:Trade.cpp


示例7: switch

void cGuildStone::SetType(enGuildType type)
{
	guildType = type;

	unsigned int i;
	switch(type)
	{
	case order:	//	Convert into a order guild
		for(i = 0; i < member.size(); ++i)
		{
			P_CHAR holding = FindCharBySerial( member[i] );
			if (holding != NULL) 
			{
				RemoveShields( holding );
				Items->SpawnItemBackpack2( calcSocketFromChar( holding ), "29", 1 );	// will not work for offline chars (Duke)
			}
		}
		Broadcast( "Your guild is now an Order guild." );
		Broadcast( "An order shield has been placed in your pack!" );
		break;
	case chaos:	//	Convert guild into an choas guild
		for(i = 0; i < member.size(); ++i)
		{
			P_CHAR holding = FindCharBySerial( member[i] );
			if ( holding != NULL ) 
			{
				RemoveShields( holding );
				Items->SpawnItemBackpack2( calcSocketFromChar( holding ), "28", 1 );
			}
		}
		Broadcast( "Your guild is now a Chaos guild." );
		Broadcast( "A chaos shield has been placed in your pack!" );
		break;
	case standard:	// Convert guild into a standard guild
	default:	//	Just let it fall through 
		for(i = 0; i < member.size(); ++i)
		{
			P_CHAR holding = FindCharBySerial( member[i] );
			if( holding != NULL )
			{
				RemoveShields( holding );
			}
		}
		Broadcast( "Your guild is now a Standard guild." );
		break;
	}
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:47,代码来源:guildstones.cpp


示例8: Expire

void cDelayedHideChar::Expire()
{
	P_PLAYER pc = dynamic_cast<P_PLAYER>(FindCharBySerial( destSer ));
	if( !pc || pc->socket() ) // break if the char has relogged in the meantime
		return;

	pc->setHidden( 1 );
	pc->resend( true );
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:9,代码来源:tmpeff.cpp


示例9: Expire

	// Refresh the quest-arrow
	// Until our target expires
	virtual void Expire()
	{
		P_PLAYER pChar = dynamic_cast<P_PLAYER>(FindCharBySerial( tracker_ ));

		if( !pChar || !pChar->socket() )
			return;

		P_CHAR pTarget = FindCharBySerial( target_ );

		// Disable the quest-arrow
		if( !pTarget || pChar->trackingTime() <= uiCurrentTime )
		{
			pChar->socket()->sendQuestArrow( false, 0, 0 );
			return;
		}

		pChar->socket()->sendQuestArrow( true, pTarget->pos().x, pTarget->pos().y );
		TempEffects::instance()->insert( new cRefreshTracking( tracker_, target_ ) );
	}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:21,代码来源:tracking.cpp


示例10: FindCharBySerial

// This checks LineOfSight before calling CombatHit (Duke, 10.7.2001)
void cCombat::CombatHitCheckLoS(P_CHAR pAttacker, unsigned int currenttime)
{
	P_CHAR pDefender = FindCharBySerial(pAttacker->swingtarg);
	if ( pDefender == NULL ) return;
	UOXSOCKET s1=calcSocketFromChar(pAttacker);

	unsigned short los=line_of_sight(s1,pAttacker->pos, pDefender->pos,	WALLS_CHIMNEYS+DOORS+FLOORS_FLAT_ROOFING);

	CombatHit(pAttacker, pDefender, currenttime, los);
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:combat.cpp


示例11: type

/*!
	Returns the variant as a Character if the variant has type()
	StringType, DoubleType, IntType; or NULL otherwise.

	\sa toChar()
*/
cBaseChar* cVariant::toChar() const
{
	if ( typ == BaseCharType )
		return ( P_CHAR ) value.ptr;

	if ( typ == StringType )
		return FindCharBySerial( hex2dec( *( ( QString * ) value.ptr ) ).toUInt() );

	if ( typ == IntType )
		return FindCharBySerial( value.i );

	if ( typ == LongType )
		return FindCharBySerial( ( unsigned int ) value.d );

	if ( typ == DoubleType )
		return FindCharBySerial( ( unsigned int ) floor( value.d ) );

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:25,代码来源:customtags.cpp


示例12:

// cDelayedHideChar
cDelayedHideChar::cDelayedHideChar( SERIAL serial )
{
	if( !isCharSerial( serial ) || !FindCharBySerial( serial ) )
	{
		character = INVALID_SERIAL;
		return;
	}
	character = serial;
	setSerializable( true );
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:tmpeff.cpp


示例13: GetBoat

void cBoat::PlankStuff(UOXSOCKET s, P_ITEM pi_plank)//If the plank is opened, double click Will send them here
{
	P_CHAR pc_cs,pc_b;

	pc_cs = currchar[s];

	P_ITEM boat = GetBoat(pc_cs);
	if(boat == NULL)//They aren't on a boat, so put then on the plank.
	{
		// LB, bugfix for tillerman not reacting if the boat was entered via plank !

		// we need to get the boat again after beaming the character to the boat's plank
		// otherweise only -1's will be added to the boat hash-table 
        
		pc_cs->moveTo(pi_plank->pos + Coord_cl(0,0,5));

		pc_cs->multis=-3; // we have to trick getboat to start the search !!!
		                              // will be corrected automatically by setserial...

		P_ITEM boat2 = GetBoat(pc_cs);
		if (boat2 == NULL)
			return;

		unsigned int a;	
		vector<SERIAL> vecCown = cownsp.getData(pc_cs->serial);
		for(a = 0; a < vecCown.size(); a++)//Put all their Pets/Hirlings on the boat too
		{
			pc_b = FindCharBySerial(vecCown[a]);

			if (pc_b != NULL) // never log -1's that indicate non existance !!!
			{
			   if (pc_b->isNpc() && pc_cs->Owns(pc_b))
			   {
				  pc_b->moveTo(boat2->pos + Coord_cl(1, 1, 2));
                  pc_b->SetMultiSerial(boat2->serial);
				  teleport(pc_b);
			   }
			}
		}
	

        OpenPlank(pi_plank); //lb

		if (boat2 != NULL) // now set the char coords to the boat !!!
		{
			pc_cs->moveTo(boat2->pos + Coord_cl(1, 1, 2));
		}

		sysmessage(s,"you entered a boat");
        pc_cs->SetMultiSerial(boat2->serial);
	} else {
		LeaveBoat(s, pi_plank);//They are on a boat, get off
	}
	teleport(pc_cs);//Show them they moved.
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:55,代码来源:boats.cpp


示例14: FindItemBySerial

void cDragItems::dropItem( cUOSocket *socket, cUORxDropItem *packet )
{
	P_PLAYER pChar = socket->player();

	if( !pChar )
		return;

	// Get the data
	SERIAL contId = packet->cont();

	Coord_cl dropPos = pChar->pos(); // plane
	dropPos.x = packet->x();
	dropPos.y = packet->y();
	dropPos.z = packet->z();

	// Get possible containers
	P_ITEM pItem = FindItemBySerial( packet->serial() );
	
	if( !pItem )
		return;

	P_ITEM iCont = FindItemBySerial( packet->cont() );
	P_CHAR cCont = FindCharBySerial( packet->cont() );

	// >> SEE LORD BINARIES DROPFIX <<

	// A completely invalid Drop packet
	if( !iCont && !cCont && ( dropPos.x == 0xFFFF ) && ( dropPos.y == 0xFFFF ) && ( (unsigned char)dropPos.z == 0xFF ) )
	{
		socket->bounceItem( pItem, BR_NO_REASON );
		return;
	}

	UINT32 weight = pChar->weight();

	// Item dropped on Ground
	if( !iCont && !cCont )
		dropOnGround( socket, pItem, dropPos );

	// Item dropped on another item
	else if( iCont )
		dropOnItem( socket, pItem, iCont, dropPos );

	// Item dropped on char
	else if( cCont )
		dropOnChar( socket, pItem, cCont );

	// Handle the sound-effect
	if( pItem->id() == 0xEED )
		goldsfx( socket, pItem->amount(), true );

	// Update our weight.
	if( weight != pChar->weight() )
		socket->sendStatWindow();
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:55,代码来源:dragdrop.cpp


示例15: FindCharBySerial

void cAllTmpEff::On()
{
    unsigned int i;
    for (i=0; i<teffectcount; i++)
    {
        cTmpEff *pTE = &teffects[i];
        P_CHAR pc = FindCharBySerial(pTE->getDest());
        if (pc)
            pTE->On(pc);
    }
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:TmpEff.cpp


示例16: FindCharBySerial

void cAllTmpEff::On()
{
	register unsigned int i;
	for ( i = 0; i < teffects.size(); ++i)
	{
		cTmpEff *pTE = teffects[i];
		P_CHAR pc = FindCharBySerial(pTE->getDest());
		if (pc)
			pTE->On(pc);
	}
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:TmpEff.cpp


示例17: FindCharBySerial

void cSetPrivLvlTarget::responsed( UOXSOCKET socket, PKGx6C targetInfo )
{
	if( !isCharSerial( targetInfo.Tserial ) )
		return;

	P_CHAR pc = FindCharBySerial( targetInfo.Tserial );
	if( pc == NULL )
		return;

	pc->setPrivLvl( plevel_ );
	sysmessage( socket, QString("PrivLvl set to : %1").arg(plevel_) );
};
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:12,代码来源:targetrequests.cpp


示例18: FindCharBySerial

void cTempEffects::insert( cTempEffect *pT )
{
	// If the tempeffect has a char it affects,
	// then don't forge to add it to his effects
	if( isCharSerial( pT->getDest() ) )
	{
		P_CHAR pChar = FindCharBySerial( pT->getDest() );
		if( pChar )
			pChar->addEffect( pT );
	}

	this->teffects.push_back( pT );
	std::push_heap( teffects.begin(), teffects.end(), cTempEffects::ComparePredicate() );
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:14,代码来源:tmpeff.cpp


示例19: QString

void cAccounts::reload()
{
	QMap< SERIAL, QString > characcnames;
	QStringList sockaccnames;

	cCharIterator iterChars;
	P_CHAR pc;
	for( pc = iterChars.first(); pc; pc = iterChars.next() )
	{
		P_PLAYER pp = dynamic_cast<P_PLAYER>(pc);
		if( pp && pp->account() )
		{
			characcnames.insert( pp->serial(), pp->account()->login() );
		}
	}

	cUOSocket* mSock = NULL;
	for( mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
	{
		if( mSock->account() )
			sockaccnames.push_back( mSock->account()->login() );
		else
			sockaccnames.push_back( QString() );
	}

	clear();
	load();

	QMap< SERIAL, QString >::Iterator it = characcnames.begin();
	while( it != characcnames.end() )
	{
		P_PLAYER pp = dynamic_cast<P_PLAYER>(FindCharBySerial( it.key() ));
		if( pp )
			pp->setAccount( getRecord( it.data() ), false );
		++it;
	}

	QStringList::iterator sit = sockaccnames.begin();
	for( mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
	{
		if( !(*sit).isNull() )
			mSock->setAccount( getRecord( (*sit) ) );
		++sit;
	}
	
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:46,代码来源:accounts.cpp


示例20: handleResponse

	virtual void handleResponse( cUOSocket *socket, const gumpChoice_st& choice )
	{
		P_PLAYER player = socket->player();

		if( !player )
			return;

		P_CHAR pChar = FindCharBySerial( choice.button );

		if( !pChar || pChar->dist( player ) > 32 )
			return;

		// Start the refresh-timer
		// Start the wearoff-timer
		player->setTrackingTime( uiCurrentTime + ( 30 * MY_CLOCKS_PER_SEC ) );
		TempEffects::instance()->insert( new cRefreshTracking( player->serial(), choice.button ) );
	}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:17,代码来源:tracking.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindChild函数代码示例发布时间:2022-05-30
下一篇:
C++ FindById函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap