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


C++ ADDWORD函数代码示例

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


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

示例1: GETDWORD

// Send server list
bool CLoginServer::pakGetServers( CLoginClient* thisclient, CPacket* P )
{
	if( !thisclient->isLoggedIn ) return false;
	MYSQL_ROW row;
	DWORD servernum = GETDWORD( (*P), 0 );
	MYSQL_RES *result = DB->QStore( "SELECT id,name,connected,maxconnections FROM channels WHERE owner=%i and type=2", servernum );
	if(result==NULL) return false;

	BEGINPACKET( pak, 0x704 );
	ADDDWORD   ( pak, servernum );
	ADDBYTE    ( pak, (BYTE)mysql_num_rows( result ) );
	while(row = mysql_fetch_row(result))
    {
    	unsigned int status = (atoi(row[2]) * 100) / atoi(row[3]);

		ADDWORD( pak, atoi( row[0]));
		ADDBYTE( pak, 0 );
		ADDWORD( pak, status );
		ADDSTRING( pak, row[1]);
		ADDBYTE( pak, 0 );
	}
	DB->QFree( );
	thisclient->SendPacket ( &pak );
    return true;
}
开发者ID:randybatiquin,项目名称:freerose,代码行数:26,代码来源:loginpackets.cpp

示例2: GetLevelEXP

// check if player can level up
bool CPlayer::CheckPlayerLevelUP( )
{
	if (CharInfo->Exp >= GetLevelEXP())
    {
	    CharInfo->Exp -= GetLevelEXP();
	    Stats->Level++;
	    Stats->HP = GetMaxHP( );
	    Stats->MP = GetMaxMP( );
	    CharInfo->StatPoints += int((Stats->Level * 0.8) + 10);
	    //if(Stats->Level>=10)
        CharInfo->SkillPoints += ((Stats->Level + 2) / 2);


		BEGINPACKET( pak, 0x79e );
		ADDWORD( pak, clientid );
		ADDWORD( pak, Stats->Level );
		ADDDWORD( pak, CharInfo->Exp );
		ADDWORD( pak, CharInfo->StatPoints );
		ADDWORD( pak, CharInfo->SkillPoints );
		client->SendPacket( &pak );

		RESETPACKET( pak, 0x79e );
		ADDWORD( pak, clientid );
		GServer->SendToVisible( &pak, this );
		SetStats( );
        //SendLevelUPtoChar(this);
        return true;
	}
	return false;
}
开发者ID:L3nn0x,项目名称:osirosenew,代码行数:31,代码来源:playerfunctions.cpp

示例3: GETDWORD

// Send server list
bool CLoginServer::pakGetServers( CLoginClient* thisclient, CPacket* P )
{
	if( !thisclient->isLoggedIn ) return false;
	MYSQL_ROW row;
	DWORD servernum = GETDWORD( (*P), 0 );
	MYSQL_RES *result = DB->QStore( "SELECT id,name,connected,maxconnections FROM channels WHERE owner=%i and type=2", servernum );
	if(result==NULL) return false;
	BEGINPACKET( pak, 0x704 );
	ADDDWORD   ( pak, servernum );
	ADDBYTE    ( pak, (BYTE)mysql_num_rows( result ) );
	while(row = mysql_fetch_row(result))
    {
    	UINT connected = atoi(row[2]);
    	UINT maxconnections = atoi(row[3]);
    	BYTE id = atoi( row[0] );
    	string name = row[1];
    	//BYTE status = (((100 * connected) / maxconnections==0?1:maxconnections) / 5) & 0xff;
    	unsigned int status = (connected * 100) / maxconnections;
		ADDWORD( pak, id );
		ADDBYTE( pak, 0 );
		ADDWORD( pak, status );
		ADDSTRING( pak, name.c_str() );
		ADDBYTE( pak, 0 );
	}
	DB->QFree( );
	thisclient->SendPacket ( &pak );
    return true;
}
开发者ID:boermansjo,项目名称:KTRose_Server,代码行数:29,代码来源:loginpackets.cpp

示例4: hwmp_add_meshpreq

/*
 * Add a Mesh Path Request IE to a frame.
 */
static uint8_t *
hwmp_add_meshpreq(uint8_t *frm, const struct ieee80211_meshpreq_ie *preq)
{
	int i;

	*frm++ = IEEE80211_ELEMID_MESHPREQ;
	*frm++ = sizeof(struct ieee80211_meshpreq_ie) - 2 +
	    (preq->preq_tcount - 1) * sizeof(*preq->preq_targets);
	*frm++ = preq->preq_flags;
	*frm++ = preq->preq_hopcount;
	*frm++ = preq->preq_ttl;
	ADDWORD(frm, preq->preq_id);
	IEEE80211_ADDR_COPY(frm, preq->preq_origaddr); frm += 6;
	ADDWORD(frm, preq->preq_origseq);
	ADDWORD(frm, preq->preq_lifetime);
	ADDWORD(frm, preq->preq_metric);
	*frm++ = preq->preq_tcount;
	for (i = 0; i < preq->preq_tcount; i++) {
		*frm++ = preq->preq_targets[i].target_flags;
		IEEE80211_ADDR_COPY(frm, preq->preq_targets[i].target_addr);
		frm += 6;
		ADDWORD(frm, preq->preq_targets[i].target_seq);
	}
	return frm;
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:28,代码来源:ieee80211_hwmp.c

示例5: GETWORD

// Messenger Chat
bool CCharServer::pakMessengerChat ( CCharClient* thisclient, CPacket* P )
{
    WORD id = GETWORD((*P),0);
    char* message = new char[P->Size-41];
    if(message==NULL)
    {
        Log(MSG_ERROR, "Error allocing memory: pakMessengerChat" );
        return false;
    }
    memcpy( message, &P->Buffer[35], P->Size-41 );
    CCharClient* otherclient = (CCharClient*) GetClientByID(id);
    if(otherclient!=NULL)
    {
        BEGINPACKET( pak, 0x7e2 );
        ADDWORD    ( pak, thisclient->charid );
        ADDWORD    ( pak, 0x0000 );
        ADDSTRING  ( pak, thisclient->charname );
        UINT namesize = strlen(thisclient->charname);
        for (int i=0;i<30-namesize;i++)
            ADDBYTE    ( pak, 0x00 );
        ADDBYTE    ( pak, 0x00 );
        ADDSTRING  ( pak, message );
        ADDBYTE    ( pak, 0x00 );
        otherclient->SendPacket(&pak);
    }
    delete []message;
    return true;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:29,代码来源:community.cpp

示例6: BEGINPACKET

// Send Levelup To charserver
bool CWorldServer::SendLevelUPtoChar(CPlayer *thisclient)
{
	BEGINPACKET( pak, 0x79e );
	ADDWORD( pak, thisclient->CharInfo->charid );
	ADDWORD( pak, thisclient->Stats->Level );
	cryptPacket( (char*)&pak, NULL );
	send( csock, (char*)&pak, pak.Size, 0 );
    return true;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:10,代码来源:worldserver.cpp

示例7: Log

void CMap::UpdateArena( CPlayer* thisclient )
{

    if(thisclient== NULL || thisclient->Groupga->Groupga == NULL) return;
    GAGroup* thisgroup = thisclient->Groupga->Groupga;
    int fragments = -1;
    for( UINT i=0; i< MonsterList.size();i++)
    {
        CMonster* thismon = MonsterList.at(i);
        if(thismon->team == thisgroup->GroupId && thismon->montype == 3708)
            fragments++;

    }
    Log(MSG_INFO,"called updatearena fragments = %i",fragments);
    if(fragments == 7)
    {
        for(UINT i=0;i<NPCList.size();i++)
        {
            CNPC* thisnpc = NPCList.at(i);
            if(thisnpc->thisnpc->id == 3704 && thisnpc->pos.x > 5160 && thisnpc->pos.x < 5170 && thisnpc->pos.y > 4915 && thisnpc->pos.y < 4925 && thisnpc->team == thisgroup->GroupId)
            {
                    Log(MSG_INFO,"remove wall");
                DeleteNPC(thisnpc);
                BEGINPACKET( pak, 0x794 );
                ADDWORD( pak, thisnpc->clientid );
                GServer->SendToVisible( &pak, thisclient );
                RESETPACKET( pak, 0x799 );
                ADDWORD    ( pak, thisnpc->clientid );
                ADDWORD    ( pak, thisnpc->clientid );
                ADDDWORD   ( pak, 0 );
                ADDDWORD   ( pak, 16 );
                GServer->SendToVisible( &pak, thisclient );
                break;
            }
        }
        BEGINPACKET( pak, 0x7f8 );
        ADDSTRING    ( pak, "HUD_DawnSea_Destroyed_Gate1" );
        ADDBYTE    ( pak, 0x00 );
        thisgroup->SendToMembers(&pak);

    }
    if(fragments == 0)
    {
        for(UINT i=0;i<NPCList.size();i++)
        {
            CNPC* thisnpc = NPCList.at(i);
            if(thisnpc->npctype == 3704 && thisnpc->pos.x == 5167 && thisnpc->pos.x == 4920 && thisnpc->team == thisgroup->GroupId)
                DeleteNPC(thisnpc);
                break;
        }
        BEGINPACKET( pak, 0x7f8 );
        ADDSTRING    ( pak, "HUD_DawnSea_Destroyed_Gate2" );
        ADDBYTE    ( pak, 0x00 );
        thisgroup->SendToMembers(&pak);
    }
}
开发者ID:karlseven,项目名称:ROED,代码行数:56,代码来源:mapfunctions.cpp

示例8: BEGINPACKET

// Change messenger status 07 - online | 08 - offline
bool CCharServer::ChangeMessengerStatus (CCharClient* thisclient, CCharClient* otherclient, int status)
{
        BEGINPACKET( pak, 0x7e1 );
        ADDBYTE    ( pak, 0x08 );
        ADDWORD    ( pak, thisclient->charid );
        ADDWORD    ( pak, 0x0000 );
        ADDBYTE    ( pak, status );
        otherclient->SendPacket(&pak);
        return true;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:11,代码来源:community.cpp

示例9: hwmp_add_meshrann

/*
 * Add a Root Annoucement IE to a frame.
 */
static uint8_t *
hwmp_add_meshrann(uint8_t *frm, const struct ieee80211_meshrann_ie *rann)
{
	*frm++ = IEEE80211_ELEMID_MESHRANN;
	*frm++ = sizeof(struct ieee80211_meshrann_ie) - 2;
	*frm++ = rann->rann_flags;
	*frm++ = rann->rann_hopcount;
	*frm++ = rann->rann_ttl;
	IEEE80211_ADDR_COPY(frm, rann->rann_addr); frm += 6;
	ADDWORD(frm, rann->rann_seq);
	ADDWORD(frm, rann->rann_metric);
	return frm;
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:16,代码来源:ieee80211_hwmp.c

示例10: clock

// Delete a monster
bool CMap::DeleteMonster( CMonster* monster, bool clearobject, UINT i )
{
    if(monster==NULL) return false;

    GServer->ClearClientID( monster->clientid );
    if(monster->Position->respawn!=0)
    {
        CMobGroup* thisgroup = GServer->GetMobGroup( monster->Position->respawn, monster->Position->Map );
        if(thisgroup!=NULL)
        {
            /*if(thisgroup->active >= thisgroup->limit)// reset spawn timer if the spawn is full
                thisgroup->lastRespawnTime = clock();*/

            //LMA: only if the monster isn't tactical...
            if(!monster->is_tactical)
            {
                thisgroup->active--;
                thisgroup->basicKills++;
                thisgroup->lastKills++;
            }

        }
    }
    if(clearobject)
    {
        BEGINPACKET( pak, 0x799 );
        ADDWORD    ( pak, monster->clientid );
        ADDWORD    ( pak, monster->clientid );
        ADDDWORD   ( pak, monster->Stats->HP );
        ADDDWORD   ( pak, 16 );
        GServer->SendToVisible( &pak, monster );
    }
    if(i!=0)
    {
        MonsterList.erase( MonsterList.begin()+i );
        delete monster;
        return true;
    }
    for(UINT i=0;i<MonsterList.size();i++)
    {
        CMonster* othermon = MonsterList.at(i);
        if(othermon==monster)
        {
            MonsterList.erase( MonsterList.begin()+i );
            delete monster;
            return true;
        }
    }
    delete monster;
    return false;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:52,代码来源:worldmap.cpp

示例11: BEGINPACKET

// Move a mob (specified point)
void CMonster::MoveTo( fPoint nPos, bool randcircle )
{                          
    if(randcircle) Position->destiny  = GServer->RandInCircle( nPos, 5 );
    else Position->destiny  = nPos;
//    Position->lastMoveTime = clock();  
    BEGINPACKET( pak, 0x797 );
	ADDWORD    ( pak, clientid );
	ADDWORD    ( pak, 0x0000 ); // ???
	ADDWORD    ( pak, Stats->Move_Speed );	
	ADDFLOAT   ( pak, Position->destiny.x*100 );
	ADDFLOAT   ( pak, Position->destiny.y*100 );
	ADDWORD    ( pak, 0xcdcd );
	ADDBYTE    ( pak, 0x01 );
	GServer->SendToVisible(&pak, this );
}
开发者ID:osROSE,项目名称:osrose,代码行数:16,代码来源:Monster.cpp

示例12: ClearBattle

// Move a mob (random place)
void CMonster::Move( )
{                 
    Position->destiny  = GServer->RandInCircle( Position->source, 10 );
//    Position->lastMoveTime = clock();  
    ClearBattle( Battle );
    BEGINPACKET( pak, 0x797 );
	ADDWORD    ( pak, clientid );
	ADDWORD    ( pak, 0x0000 );//???	
	ADDWORD    ( pak, Stats->Move_Speed ); //speed
	ADDFLOAT   ( pak, Position->destiny.x*100 );
	ADDFLOAT   ( pak, Position->destiny.y*100 );
	ADDWORD    ( pak, 0xcdcd );
	ADDBYTE    ( pak, 0x01 );
	GServer->SendToVisible(&pak, this);
}
开发者ID:osROSE,项目名称:osrose,代码行数:16,代码来源:Monster.cpp

示例13: hwmp_add_meshprep

/*
 * Add a Mesh Path Reply IE to a frame.
 */
static uint8_t *
hwmp_add_meshprep(uint8_t *frm, const struct ieee80211_meshprep_ie *prep)
{
	*frm++ = IEEE80211_ELEMID_MESHPREP;
	*frm++ = sizeof(struct ieee80211_meshprep_ie) - 2;
	*frm++ = prep->prep_flags;
	*frm++ = prep->prep_hopcount;
	*frm++ = prep->prep_ttl;
	IEEE80211_ADDR_COPY(frm, prep->prep_targetaddr); frm += 6;
	ADDWORD(frm, prep->prep_targetseq);
	ADDWORD(frm, prep->prep_lifetime);
	ADDWORD(frm, prep->prep_metric);
	IEEE80211_ADDR_COPY(frm, prep->prep_origaddr); frm += 6;
	ADDWORD(frm, prep->prep_origseq);
	return frm;
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:19,代码来源:ieee80211_hwmp.c

示例14: BEGINPACKET

//add / remove a Fairy
void CWorldServer::DoFairyStuff(CPlayer* targetclient, int action)
{
    BEGINPACKET( pak, 0x7dc );
	ADDBYTE( pak, action );
	ADDWORD( pak, targetclient->clientid);
	SendToVisible( &pak, targetclient );
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:8,代码来源:ServerFunctions.cpp

示例15: BEGINPACKET

// Erase a object from the user
bool CPlayer::ClearObject( unsigned int otherclientid )
{
	BEGINPACKET( pak, 0x794 );
	ADDWORD( pak, otherclientid );
	client->SendPacket( &pak );
	return true;
}
开发者ID:L3nn0x,项目名称:osirosenew,代码行数:8,代码来源:playerfunctions.cpp


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