f13rce Posted August 8, 2010 Share Posted August 8, 2010 Hey there LE community , Yeah I'm enjoying my time in France. Now that I'm trying to finish the networking here using 39dll I got stuck with a problem. I'm trying to make a player object when someone joins. I have made a struct for the Players (named players) and if someone joins we get his playerid. piece of code: players[playerid] = readbyte(0); This all goes well untill I want him to assign an X, Y or Z coordinate: players[playerid].X = 1000; The compiler claims I haven't initialized the X of players yet while players.X=<number>; works. I've checked the C2228 page a LOT and I wasn't able to fix this, hereby this thread. Does anybody have experience with this or does know what could be the problem? A small tutorial how to initialize a struct with []'s would also work Thanks and greetings from France, Ivar / Evayr Quote Using Leadwerks Professional Edition (Beta), mainly using C++. Windows 10 / Linux Mint, Visual Studio 2017. GPU: NVidia GeForce GTX970, CPU: Intel i7 7700K @ 4.20 GHz Previously known as Evayr. Link to comment Share on other sites More sharing options...
Rick Posted August 8, 2010 Share Posted August 8, 2010 So you are doing an array of structs? http://mail.python.org/pipermail/tutor/2001-May/005957.html Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted August 8, 2010 Share Posted August 8, 2010 I'm trying to make a player object when someone joins. I have made a struct for the Players (named players) and if someone joins we get his playerid. piece of code: players[playerid] = readbyte(0); I'm not at all sure what it is you are attempting to do in this line of code. If players is an array of structs then you appear to be assigning this particular struct in it's entirety to some value readbyte(0) as you are not referencing any member of the structure in your assignment. players[playerid] will simply point to the start of that instance of the structure in memory. Is this really what you are meaning to do? Without seeing the struct definition and the rest of the code it's not easy to determin if this is valid or not. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
f13rce Posted August 9, 2010 Author Share Posted August 9, 2010 So you are doing an array of structs? http://mail.python.org/pipermail/tutor/2001-May/005957.html Thanks, that worked @Pixel: We've troubled it out. Quote Using Leadwerks Professional Edition (Beta), mainly using C++. Windows 10 / Linux Mint, Visual Studio 2017. GPU: NVidia GeForce GTX970, CPU: Intel i7 7700K @ 4.20 GHz Previously known as Evayr. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.