[Help] With This code

08/08/2017 05:45 teejayu1#1
is there any problem with this code
because i got this error
D:\Files\Files\Official Source\_Common\World3D.cpp(1462): error C2059: syntax error : '{'
D:\Files\MyFutureFiles\Official Source\_Common\World3D.cpp(1462): error C2143: syntax error : missing ';' before '}'
D:\Files\MyFutureFiles\Official Source\_Common\World3D.cpp(1462): error C2059: syntax error : '{'

someone can help me im using vs 2008
08/08/2017 06:34 iSynaptic#2
You should read some informative books about c++ syntax because its horrible what you are doing there.

1. You shouldnt call the class directly. Initialize it before and use it like pWorld->Function/member
2. never set a vector with Bracktes ( {} )
3. v1 == D3DXVECTOR3( v2.x + 5, g_WndMng.m_pTheme->m_pTitleWorld->GetLandHeight(v2.x, v2.z), v2.z );
4. v2 = CWorld::m_pCamera->m_vPos;;

Anyways... even if the syntax is correct, I guess you wont have much success with this code.
08/08/2017 07:08 Hekmatyar#3
initialize the D3DXVECTOR3 using the normal initialization with x, y, z. or upgrade to C++11 to support the {} initialization.

Quote:
Originally Posted by iSynaptic View Post
You should read some informative books about c++ syntax because its horrible what you are doing there.

1. You shouldnt call the class directly. Initialize it before and use it like pWorld->Function/member
2. never set a vector with Bracktes ( {} )
3. v1 == D3DXVECTOR3( v2.x + 5, g_WndMng.m_pTheme->m_pTitleWorld->GetLandHeight(v2.x, v2.z), v2.z );
4. v2 = CWorld::m_pCamera->m_vPos;;

Anyways... even if the syntax is correct, I guess you wont have much success with this code.
CWorld::m_pCamera is a static member. can be done like this just fine since it is just user's client information. Anyway, he didn't do that, official servers did. Could do g_pPlayer->GetWorld() or CWorld* pWorld = g_WorldMng.Get(); if it really triggers you that much.

Bracket initialization isn't bad in any way. Books? The C++ Programming Language 4th Edition by Bjarne Stroustrup. It's just copy-list initialization with a struct. xd
08/08/2017 07:55 iSynaptic#4
Quote:
Originally Posted by Hekmatyar View Post
initialize the D3DXVECTOR3 using the normal initialization with x, y, z. or upgrade to C++11 to support the {} initialization.
VS2008 is targeting C++08, why adding C++ 11 to support copy-list initialization?
Afaik the VS08 Compiler doesn't even support C++11.

Quote:
Originally Posted by Hekmatyar View Post
Bracket initialization isn't bad in any way. Books? The C++ Programming Language 4th Edition by Bjarne Stroustrup. It's just copy-list initialization with a struct. xd
Yea, i didn't knew the proper name of this initialization but i can remember that copy-list-initialization will cause problems because copy initialization considers availability of copy constructors, while copy-list-initialization don't (especially on explicit).

Anyways - as non cpp experienced developer he should stay with the common syntax. It helped me much to learn from the code when i started while other stackoverflow/c++ sources didn't helped much on this.
08/08/2017 09:53 elitemember21#5
try to debug it ^^