本文整理汇总了C++中FindCharBySerial函数的典型用法代码示例。如果您正苦于以下问题:C++ FindCharBySerial函数的具体用法?C++ FindCharBySerial怎么用?C++ FindCharBySerial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindCharBySerial函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例4: FindCharBySerial
void cRepeatAction::Expire()
{
P_CHAR pMage = FindCharBySerial( _mage );
if( pMage )
TempEffects::instance()->insert( new cRepeatAction( pMage, _anim, _delay ) );
}
示例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;
}
}
示例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");
}
}
}
示例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;
}
}
示例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 );
}
示例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_ ) );
}
示例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);
}
示例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;
}
示例12:
// cDelayedHideChar
cDelayedHideChar::cDelayedHideChar( SERIAL serial )
{
if( !isCharSerial( serial ) || !FindCharBySerial( serial ) )
{
character = INVALID_SERIAL;
return;
}
character = serial;
setSerializable( true );
}
示例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.
}
示例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();
}
示例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);
}
}