本文整理汇总了C++中CHAR_CHECKINDEX函数的典型用法代码示例。如果您正苦于以下问题:C++ CHAR_CHECKINDEX函数的具体用法?C++ CHAR_CHECKINDEX怎么用?C++ CHAR_CHECKINDEX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHAR_CHECKINDEX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHECK_PETBBI
BOOL CHECK_PETBBI( int toindex)
{
int i, petindex, PetID;
BOOL Finds = FALSE;
char token[256];
for( i=0; i < CHAR_MAXPETHAVE; i++) {
int parry, array, PetBBI;
petindex = CHAR_getCharPet( toindex, i);
if( !CHAR_CHECKINDEX( petindex) ) continue;
PetID = CHAR_getInt( petindex, CHAR_PETID);
array = ENEMY_getEnemyArrayFromTempNo( PetID);
if( !ENEMY_CHECKINDEX( array)) continue;
parry = ENEMYTEMP_getEnemyTempArray( array);
PetBBI = ENEMYTEMP_getInt( parry, E_T_IMGNUMBER);
if( CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER) != PetBBI ||
CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER) != PetBBI ){
CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, PetBBI);
CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, PetBBI);
sprintf( token, "ÐÞÕý%sͼºÅ", CHAR_getUseName( petindex));
CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW);
Finds = TRUE;
}
CHAR_setInt( petindex, CHAR_EARTHAT, ENEMYTEMP_getInt( parry, E_T_EARTHAT) );
CHAR_setInt( petindex, CHAR_WATERAT, ENEMYTEMP_getInt( parry, E_T_WATERAT) );
CHAR_setInt( petindex, CHAR_FIREAT, ENEMYTEMP_getInt( parry, E_T_FIREAT) );
CHAR_setInt( petindex, CHAR_WINDAT, ENEMYTEMP_getInt( parry, E_T_WINDAT) );
char tempname[128];
if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*")!=NULL)
sprintf(tempname,"*%s",ENEMYTEMP_getChar( parry, E_T_NAME));
else
sprintf(tempname,"%s",ENEMYTEMP_getChar( parry, E_T_NAME));
CHAR_setChar( petindex, CHAR_NAME, tempname);
CHAR_setChar( petindex, CHAR_USERPETNAME , "");
}
for( i=0; i<CHAR_MAXPETHAVE; i++){
char szPet[128];
petindex = CHAR_getCharPet(toindex, i);
if( !CHAR_CHECKINDEX( petindex) )continue;
CHAR_complianceParameter( petindex );
snprintf( szPet, sizeof( szPet ), "K%d", i);
CHAR_sendStatusString( toindex, szPet );
snprintf( szPet, sizeof( szPet ), "W%d", i);
CHAR_sendStatusString( toindex, szPet );
}
if( Finds == FALSE ){
sprintf( token, "ûÓдíÎóͼºÅµÄ³èÎï");
CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW);
}
return Finds;
}
示例2: NPC_Util_SearchNear
int NPC_Util_SearchNear( int meindex, int maxlen, int type )
{
#if 1
int floor, x, y, i,iTarget = -1;
if( !CHAR_CHECKINDEX( meindex ) )return -1;
floor = CHAR_getInt( meindex, CHAR_FLOOR );
x = CHAR_getInt( meindex, CHAR_X );
y = CHAR_getInt( meindex, CHAR_Y );
for( i = 0; i < maxlen; i ++ ){
iTarget = SearchNearAround( x, y, floor, RAND( 0,3 ), i+1, type );
if( iTarget >= 0 )break;
}
return iTarget;
#else
int floor, x, y, i,iTarget = -1, iLen, iMin = 655360, tX, tY;
if( !CHAR_CHECKINDEX( meindex ) )return -1;
floor = CHAR_getInt( meindex, CHAR_FLOOR );
x = CHAR_getInt( meindex, CHAR_X );
y = CHAR_getInt( meindex, CHAR_Y );
/* ���� */
for( i = 0 ; i<objnum ; i++ ){
/*ƽ�ҷ�����������*/
if( obj[i].type != OBJTYPE_CHARA ) continue;
if( CHAR_getInt( obj[i].index,CHAR_WHICHTYPE)
!= type ) continue;
if( floor != obj[i].floor ) continue;
/* CHAR_TYPEENEMY ���ݷ�index�����м�������ؤ�¼�ƥ������������ */
if( obj[i].index == meindex ) continue;
tX = ABS( x-CHAR_getInt(obj[i].index,CHAR_X) );
tY = ABS( y-CHAR_getInt(obj[i].index,CHAR_Y) );
if( tX > maxlen )continue; /* �Tľ�ʿ�*/
if( tY > maxlen )continue; /* ئ���ݳ�*/
iLen = tX*tX+tY*tY;
if( iMin > iLen ){
iMin = iLen;
iTarget = obj[i].index; /* �̼������͵�ë趪E*/
}
}
return iTarget;
#endif
}
示例3: NPC_DepotPet_CheckRepeat
int NPC_DepotPet_CheckRepeat( int charaindex)
{
int petindex1, petindex2;
int i, j, find, ret = FALSE;
int workindex[CHAR_MAXDEPOTPETHAVE], cnt =0;
for( i =0; i <(CHAR_MAXDEPOTPETHAVE-1); i++)
{
petindex1 = CHAR_getDepotPetIndex( charaindex, i);
if( !CHAR_CHECKINDEX( petindex1)) continue;
find = 0;
for( j =(i+1); j <CHAR_MAXDEPOTPETHAVE; j++)
{
petindex2 = CHAR_getDepotPetIndex( charaindex, j);
if( !CHAR_CHECKINDEX( petindex2)) continue;
if( petindex1 == petindex2 ) continue;
if( !strcmp( CHAR_getChar( petindex1, CHAR_UNIQUECODE),
CHAR_getChar( petindex2, CHAR_UNIQUECODE) ) )
{
print(" ÔÚ²Ö¿âÕÒµ½·Ç·¨³èÁË ");
CHAR_setDepotPetIndex( charaindex, j, -1);
NPC_DepotPet_CheckRepeat_del( charaindex, petindex2);
find ++;
ret = TRUE;
}
}
if( find >0)
{
CHAR_setDepotPetIndex( charaindex, i, -1);
NPC_DepotPet_CheckRepeat_del( charaindex, petindex1);
}
}
for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
workindex[i] = -1;
}
for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
int pindex = CHAR_getDepotPetIndex( charaindex, i);
if( CHAR_CHECKINDEX( pindex) ) {
workindex[cnt++] = pindex;
}
}
for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
CHAR_setDepotPetIndex( charaindex, i, workindex[i]);
}
return ret;
}
示例4: ChatRoom_Leave
void ChatRoom_Leave ( int myindex )
{
int i , NextMaker = -1 ;
int Num = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM );
if ( !CHAR_CHECKINDEX ( myindex ) )
return ;
if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) {
for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
if ( ChatRoom[ Num ].MemberList[ i ] != myindex &&
ChatRoom[ Num ].MemberList[ i ] != -1 ) {
if ( CHAR_CHECKINDEX ( ChatRoom[ Num ].MemberList[ i ] ) ) {
if ( CHAR_getInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_LV ) >= 30 ||
CHAR_getInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_TRANSMIGRATION ) >= 1 ) {
NextMaker = ChatRoom[ Num ].MemberList[ i ] ;
break;
}
}
}
}
if ( NextMaker != -1 ) {
ChatRoom_Make( myindex , NextMaker ) ;
CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMTYPE , 0) ;
CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMNUM, -1) ;
ChatRoom[ Num ].NowPeople --;
for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
if ( ChatRoom[ Num ].MemberList[ i ] == myindex ) {
ChatRoom[ Num ].MemberList[ i ] = -1 ;
break;
}
}
}else{
ChatRoom_Destroy( myindex ) ;
return ;
}
}else if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 2 ) {
CHAR_setWorkInt ( myindex, CHAR_WORKCHATROOMTYPE, 0) ;
CHAR_setWorkInt ( myindex, CHAR_WORKCHATROOMNUM, -1) ;
ChatRoom[ Num ].NowPeople --;
for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
if ( ChatRoom[ Num ].MemberList[ i ] == myindex ) {
ChatRoom[ Num ].MemberList[ i ] = -1 ;
break;
}
}
}
ChatRoom_Refresh ( Num ) ;
}
示例5: MAGIC_Weaken
int MAGIC_Weaken( int charaindex, int toindex, int marray, int mp )
{
int battlemode;
//check index
if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;
battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
// ¾ô ·°ï§ÁÝ·´ ÷»ÔÊÔÂ//??
if( battlemode == BATTLE_CHARMODE_INIT ) {
return FALSE;
}
//mp²»×ã
if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
//ÏûºÄmp
CHAR_setInt( charaindex, CHAR_MP,
CHAR_getInt( charaindex, CHAR_MP ) - mp );
//checkÊÇ·ñÕ½¶·ÖÐ
if( IsBATTLING( charaindex ) == TRUE ) {
return MAGIC_ParamChange_Turn_Battle( charaindex, toindex, marray, mp );
} else {
return FALSE;
}
}
示例6: MAGIC_ResAndDef
// ¿¢å§¾®ÈÕãâÍÙ¡Ö Ü· »¿
int MAGIC_ResAndDef( int charaindex, int toindex, int marray, int mp )
{
int battlemode;
// INDEXÃñÄáÓÀÛÍ
if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; //£ûÁÃ
battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
// ¾ô ·°ï§ÁÝ·´ ÷»ÔÊÔÂ
if( battlemode == BATTLE_CHARMODE_INIT ) {
return FALSE;
}
// ÛÕ ÃñÄáÓÀÛÍ
if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; // ¾®ÔÈÐ×ÈÕĸ¶ª
// ³ð¼° Ü··´ ɧ±å ÛÕ ØÆ»¯ ÖУÛѨÄ̹ϵ©±åئÔ³ðÎç·´ ÖÐ
CHAR_setInt( charaindex, CHAR_MP,
CHAR_getInt( charaindex, CHAR_MP ) - mp );
// ¾ô ·ÖÔÈÐ×ÈÕ
if( IsBATTLING( charaindex ) == TRUE ) {
return MAGIC_ResAndDef_Battle( charaindex, toindex, marray, mp );
} else {
// ¾ô ƥئ¾®ÔÈÐ×ÈÕ
return FALSE;
}
}
示例7: MAGIC_StatusChange2
// µ© ¡õÕýµ©³ªéÙëܸÒüÔ ܷ
int MAGIC_StatusChange2( int charaindex, int toindex, int marray, int mp )
{
int battlemode;
// INDEXÃñÄáÓÀÛÍ
if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; //£ûÁÃ
battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
// ¾ô ·°ï§ÁÝ·´ ÷»ÔÊÔÂ
if( battlemode == BATTLE_CHARMODE_INIT ) {
return FALSE;
}
//¿ÛÆø
if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
CHAR_setInt( charaindex, CHAR_MP,
CHAR_getInt( charaindex, CHAR_MP ) - mp );
//call func
if( IsBATTLING( charaindex ) == TRUE ) {
return MAGIC_StatusChange_Battle2( charaindex, toindex, marray, mp );
} else {
return FALSE;
}
}
示例8: MAGIC_StatusChange
int MAGIC_StatusChange( int charaindex, int toindex, int marray, int mp )
{
int battlemode;
if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;
battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
if( battlemode == BATTLE_CHARMODE_INIT ) {
return FALSE;
}
if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp );
if( IsBATTLING( charaindex ) == TRUE ) {
#ifdef _PREVENT_TEAMATTACK //Ò쳣״̬²»µÃʹÓÃÓÑ·½
int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER &&
BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ) {
if( BATTLE_CheckSameSide( charaindex, toindex) == 1 ) { //ͬ±ß
int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
CHAR_talkToCli( charaindex, -1, "Ò쳣״̬..²»µÃÊ©ÓèÓÑ·½¡£", CHAR_COLORYELLOW);
return FALSE;
}
}
#endif
return MAGIC_StatusChange_Battle( charaindex, toindex, marray, mp );
} else {
return FALSE;
}
}
示例9: CHAR_talkToCli
int CHAR_talkToCli(int talkedcharaindex, int talkcharaindex, char *message, CHAR_COLOR color) {
static char lastbuf[2048];
static char escapebuf[2048];
static char mesgbuf[1024];
int fd;
if(!CHAR_CHECKINDEX(talkedcharaindex))
return FALSE;
if(CHAR_getInt(talkedcharaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) {
print("err CHAR_talkToCli CHAR_WHICHTYPE != CHAR_TYPEPLAYER\n");
return FALSE;
}
fd = getfdFromCharaIndex(talkedcharaindex);
if(fd == -1) {
print("err CHAR_talkToCli can't get fd from:%d \n", talkedcharaindex);
return FALSE;
}
if(color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2) {
print("CHAR_talkToCli color err\n");
return FALSE;
}
snprintf(lastbuf, sizeof(lastbuf), "P|%s", makeEscapeString(CHAR_appendNameAndTitle(talkcharaindex, message, mesgbuf, sizeof(mesgbuf)), escapebuf, sizeof(escapebuf)));
int talkchar = -1;
if(talkcharaindex != -1)
talkchar = CHAR_getWorkInt(talkcharaindex, CHAR_WORKOBJINDEX);
lssproto_TK_send(fd, talkchar, lastbuf, color);
return TRUE;
}
示例10: NPC_Lua_NLG_DelHaveIndexPet
int NPC_Lua_NLG_DelHaveIndexPet(lua_State *_NLL)
{
CheckEx(_NLL, 2);
CheckIndexNull(_NLL, 1);
int TM_Index = (int)lua_tointeger(_NLL, 1);
int TM_PetHaveIndex = (int)lua_tointeger(_NLL, 2);
int TM_Num = 1;
int TM_PetIndex = -1;
int TM_Ret = 0;
if(TM_PetHaveIndex<0 || TM_PetHaveIndex>4){
LRetErrInt(_NLL, -1, "传入的索引是无效的。");
}
TM_PetIndex = CHAR_getCharPet( TM_Index, TM_PetHaveIndex);
if(!CHAR_CHECKINDEX(TM_PetIndex))
{
LRetErrInt(_NLL, -1, "传入的索引是无效的。");
}
TM_Ret = NPC_DelPet( TM_Index, TM_PetHaveIndex);
if(TM_Ret < 0)
{
char TM_MsgBuff[128];
snprintf(TM_MsgBuff, sizeof(TM_MsgBuff), "删除宠物时产生错误 错误号: %d。", TM_Ret);
LRetErrInt(_NLL , -1, TM_MsgBuff);
}
LRetInt(_NLL, 1);
}
示例11: NPC_PetDate
void NPC_PetDate(int meindex,int talker,int select,char *token)
{
int petindex;
int cost;
char *petname;
char buf[1024];
/*--·¥¡õÛͼ°âÙÓå¼À--*/
CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,select);
petindex = CHAR_getCharPet( talker, select-1);
if( !CHAR_CHECKINDEX(petindex) ) return;
NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_REALY, buf);
cost=NPC_GetCost(meindex,talker,petindex);
petname = CHAR_getUseName( petindex);
sprintf(token,"\nÊÇ[%s]û´í°É£¿""%s"
"\n\n ÂòÂô¼Û¸ñ %d STONE\n"
,petname,buf,cost);
}
示例12: NPC_DepotPet_CheckLevel
// ¼ì²éµÈ¼¶ÊÇ·ñ×ã¹»
int NPC_DepotPet_CheckLevel(int meindex,int talker,int select,char *token)
{
int petindex;
int selectpet;
if( !CHAR_CheckDepotPet( talker) )
return FALSE;
selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ;
petindex = CHAR_getDepotPetIndex( talker, selectpet);
if( !CHAR_CHECKINDEX(petindex) ) return FALSE;
//print("\n trans:%d char_lv:%d pet_lv:%d ",
// CHAR_getInt( talker, CHAR_TRANSMIGRATION),
// CHAR_getInt( talker, CHAR_LV),
// CHAR_getInt( petindex, CHAR_LV) );
// Èç¹ûÊÇÊØ»¤ÊÞ¸ÄΪÆÕͨÊÞ
if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1
&& CHAR_getInt( talker, CHAR_FMLEADERFLAG) != 3 ) {
CHAR_setInt( petindex, CHAR_PETFAMILY, 0);
}
if( CHAR_getWorkInt( talker, CHAR_PickAllPet) == TRUE ) { // ×°±¸Ñ±ÊÞ½äÖ¸µÄ»°...
return TRUE;
}
if( CHAR_getInt( talker, CHAR_TRANSMIGRATION) > 0
|| CHAR_getInt( talker, CHAR_LV)+5 >= CHAR_getInt( petindex, CHAR_LV) ) {
return TRUE;
}
return FALSE;
}
示例13: NPC_Util_CharNearby
/*
* ふたつのキャラが隣りあってるかどうかをしらべる。
* 絶対値をみるので、同じ位置でも隣りだと認定される
*
* int ind1 , ind2 : ふたつのキャラクタのindex
*
*
* となりあってたら TRUE , そうじゃないならFALSE
*/
BOOL NPC_Util_CharNearby(int ind1,int ind2)
{
if( !CHAR_CHECKINDEX(ind1)) return FALSE;
if( !CHAR_CHECKINDEX(ind2)) return FALSE;
if( CHAR_getInt( ind1 , CHAR_FLOOR ) !=
CHAR_getInt( ind2 , CHAR_FLOOR ) ){
return FALSE;
}
return NPC_Util_Nearby( CHAR_getInt( ind1,CHAR_X),
CHAR_getInt( ind1,CHAR_Y),
CHAR_getInt( ind2,CHAR_X),
CHAR_getInt( ind2,CHAR_Y));
}
示例14: NPC_BlackMarketWindowTalked
void NPC_BlackMarketWindowTalked( int index, int talker, int seqno, int select, char *data)
{
int i;
char sBuf[1024]="", sBuf1[256]="";
if(!CHAR_CHECKINDEX( talker)) return;
if(getfdFromCharaIndex( talker)==-1) return;
if(CHAR_getInt( talker, CHAR_WHICHTYPE)!=CHAR_TYPEPLAYER) return;
if(NPC_Util_isFaceToFace( talker, index, 1)!=TRUE) return;
if( seqno == CHAR_WINDOWTYPE_BLACKMARKET){
for(i=0; i<12; i++){
CONNECT_set_BMList( getfdFromCharaIndex( talker), i, BMSellList[i]);
sprintf( sBuf1, "%d|%d|%s\n", BMSellList[i], BMItem[BMSellList[i]].iGraphicsNum, BMItem[BMSellList[i]].iName);
strcat( sBuf, sBuf1);
}
lssproto_WN_send( getfdFromCharaIndex( talker),
WINDOW_MESSAGETYPE_BLACKMARKET,
WINDOW_BUTTONTYPE_NONE,
CHAR_WINDOWTYPE_BLACKMARKET,
CHAR_getWorkInt( index, CHAR_WORKOBJINDEX),
sBuf );
}
}
示例15: ITEM_contract
void ITEM_contract( int charaindex, int toindex, int haveitemindex)
{
int itemindex;
int conindex;
char data[2048+1024];
if( !CHAR_CHECKINDEX( charaindex ) ) return;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if( !ITEM_CHECKINDEX(itemindex) ) return;
//conindex = atoi( ITEM_getChar( itemundex, ITEM_CONTRACTNUM));
conindex = atoi( ITEM_getChar( itemindex, ITEM_ARGUMENT));
sprintf( data, "%s|%d|%s|%s", ITEM_contractTbl[conindex].detail,
ITEM_contractTbl[conindex].argnum,
ITEM_getChar( itemindex, ITEM_CONTRACTARG),
ITEM_getChar( itemindex, ITEM_CONTRACTTIME) );
print("\n contract_send:%s\n", data);
lssproto_WN_send( getfdFromCharaIndex( charaindex), WINDOW_MESSAGETYPE_CONTRACT,
WINDOW_BUTTONTYPE_YESNO,
CHAR_WINDOWTYPE_CONTRACT_ANSWER,
itemindex,
data );
}