当我在VS 2003中编译时,我得到了这些错误
C:\SRC\Program\_Interface\FuncTextCmd.cpp(953): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(958): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(963): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(968): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(973): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(978): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(982): error C2593: 'operator =' is ambiguous
这是FuncTextCmd.cpp的这部分,它指的是
BOOL TextCmd_CHANGEGLOW( CScanner& scanner )
{//98
#ifdef __WORLDSERVER
CUser* pUser = (CUser*)scanner.dwValue;
scanner.GetToken();
CString strcr = scanner.Token;
CString CHANGEGLOW;
if( 2 <= strcr.GetLength() && strcr.GetLength() <= 7)
{
strcr.MakeLower();
if( strcmp( strcr, "RED" ) == 0 )
{
CHANGEGLOW = 1;//line 953
}
else
if( strcmp( strcr, "BLUE" ) == 0 )
{
CHANGEGLOW = 2;//line 958
}
else
if( strcmp( strcr, "GREEN" ) == 0 )
{
CHANGEGLOW = 3;//line 963
}
else
if( strcmp( strcr, "YELLOW" ) == 0 )
{
CHANGEGLOW = 4;//line 968
}
else
if( strcmp( strcr, "ORANGE" ) == 0 )
{
CHANGEGLOW = 5;//line 973
}
else
if( strcmp( strcr, "PINK" ) == 0 )
{
CHANGEGLOW = 6;//line 978
}
else if( strcmp( strcr, "PURPLE" ) == 0 )
{
CHANGEGLOW = 7;//line 982
}
else
{
strcr += "unknown glow";
pUser->AddText( strcr );
return FALSE;
}
}
else
{
strcr += "unknown glow";
pUser->AddText( strcr );
return FALSE;
}//2
#endif // __WORLDSERVER
return TRUE;
}
这适用于c ++中的游戏
上面的部分是说如果用户在聊天框中输入所说的颜色,那么他们身体周围的光晕会变成他们输入的内容,但这只是命令,这个功能的主要部分是在我的Mover.cpp中处理的光源然后部分可以在下面看到
void CMover::CreateAbilityOption_SetItemSFX( int nAbilityOption )
{
extern DWORD CHANGEGLOW;
DWORD dwSfx = 0;
switch( nAbilityOption )
{
case 3: dwSfx = XI_GEN_ITEM_SETITEM03; break;
case 4: dwSfx = XI_GEN_ITEM_SETITEM04; break;
case 5: dwSfx = XI_GEN_ITEM_SETITEM05; break;
case 6: dwSfx = XI_GEN_ITEM_SETITEM06; break;
case 7: dwSfx = XI_GEN_ITEM_SETITEM07; break;
case 8: dwSfx = XI_GEN_ITEM_SETITEM08; break;
case 9: dwSfx = XI_GEN_ITEM_SETITEM09; break;
case 10: dwSfx = CHANGEGLOW; break;
}
switch( CHANGEGLOW )
{
case 1: dwSfx = RED; break; //make sure that the uppercase RED is what
//you defined in defineobj.h
case 2: dwSfx = BLUE; break; //make sure that the uppercase BLUE is what
// you defined //in defineobj.h
case 3: dwSfx = GREEN; break; //make sure that the uppercase GREEN is what you
//defined in defineobj.h
case 4: dwSfx = YELLOW; break; //make sure that the uppercase YELLOW is what you
//defined in defineobj.h
case 5: dwSfx = ORANGE; break; //make sure that the uppercase ORANGE is what you
//defined in defineobj.h
case 6: dwSfx = PINK; break; //make sure that the uppercase PINK is what you
//defined in defineobj.h
case 7: dwSfx = PURPLE; break; //make sure that the uppercase PURPLE is what you
//defined in defineobj.h
}
//else
//case 10: dwSfx = XI_GEN_ITEM_SETITEM10; break;
CSfxPartsLinkShoulder* pSfx = NULL;
D3DXVECTOR3 v3Scal = D3DXVECTOR3( 1.0f, 1.0f, 1.0f );
if( nAbilityOption == 3 )
{
// ¾î±ú
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 0;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 1;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
}
/*
else
if( nAbilityOption == 4 )
{
// ¸öÅë
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 6;
pSfx->SetScale(D3DXVECTOR3( 2.2f, 2.2f, 2.2f ));
}
*/
else
if( nAbilityOption == 4 )
{
// ¸öÅë
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 6;
pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f ));
pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 5 )
{
// ¾î±ú
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 0;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 1;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¾î±ú, Æȸñ Áß°£
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 4;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 5;
pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 6 )
{
// ¾î±ú
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 0;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 1;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¾î±ú, Æȸñ Áß°£
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 4;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 5;
pSfx->m_nOldAbilityOption = nAbilityOption;
// Æȸñ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 2;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 3;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 7 )
{
// ¾î±ú
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 0;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 1;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¾î±ú, Æȸñ Áß°£
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 4;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 5;
pSfx->m_nOldAbilityOption = nAbilityOption;
// Æȸñ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 2;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 3;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¼Õ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 8;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 9;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 8 )
{
// ¾î±ú
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 0;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 1;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¾î±ú, Æȸñ Áß°£
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 4;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 5;
pSfx->m_nOldAbilityOption = nAbilityOption;
// Æȸñ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 2;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 3;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¼Õ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 8;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 9;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 9;
pSfx->m_v3Offset.y = 0.2f;
pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 9 )
{
// ¾î±ú
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 0;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 1;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¾î±ú, Æȸñ Áß°£
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 4;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 5;
pSfx->m_nOldAbilityOption = nAbilityOption;
// Æȸñ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 2;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 3;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¼Õ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 8;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 9;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¹ß
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 26;
pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f ));
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 29;
pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f ));
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 9;
pSfx->m_v3Offset.y = 0.2f;
pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 10 )
{
// ¾î±ú
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 0;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 1;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¾î±ú, Æȸñ Áß°£
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 4;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 5;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¸öÅë
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 6;
pSfx->SetScale(D3DXVECTOR3( 3.0f, 4.5f, 3.0f ));
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 7;
pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f ));
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¼Õ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 8;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 9;
pSfx->m_v3Offset.y = 0.1f;
pSfx->m_nOldAbilityOption = nAbilityOption;
// Æȸñ
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 2;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 3;
pSfx->m_nOldAbilityOption = nAbilityOption;
// ¹ß
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 26;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 29;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 8;
pSfx->m_v3Offset.y = 0.2f;
pSfx->m_nOldAbilityOption = nAbilityOption;
pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
pSfx->m_nPartsLink = 9;
pSfx->m_v3Offset.y = 0.2f;
pSfx->m_nOldAbilityOption = nAbilityOption;
}
}
#endif //__CLIENT
答案 0 :(得分:3)
在第一个代码段中,您将CHANGEGLOW
定义为CString
,然后指定一个数字。毫无疑问,这不起作用。鉴于在第二个片段中你将其声明为DWORD
我想这就是你真正想要的。因此,修复可能只是在该定义中将CString
更改为DWORD
。实际上,可能是extern DWORD
,因为否则它是函数的局部变量并且赋值它不会产生任何持久影响。
其实我想知道你为什么要在当地宣布它。既然你不能全局重用标识符,并且必须在全局某处定义它,那么有没有理由不在文件的开头有一个全局声明(或者更好,在某些头文件中)?
答案 1 :(得分:1)
您正在尝试将数字文字(1,2,3等)分配给CString
类型的变量。即使编译,这对我来说似乎是一个坏主意。也许你想要一个不同的变量类型,例如int
?鉴于你后来对它的值switch
,它看起来你想要某种数字类型,无论如何......
答案 2 :(得分:0)
FuncTextCmd.cpp
中的类型错误。
CString CHANGEGLOW;
什么时候应该
DWORD CHANGEGLOW;