Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


problem reading floats with directplay

This topic is 5228 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi all I have a small problem usint directplay : i cant read floats, but it will work with ints here is the failing code
case MessageType.Move:
// handle the move internally

PlayerObject p = data.GetPlayer(e.Message.SenderID);
p.x = (float) e.Message.ReceiveData.Read(System.Type.GetType("System.Float"));
p.y = (float) e.Message.ReceiveData.Read(System.Type.GetType("System.Float"));
it fails on the first Read call, and says System.NullReferenceException of course, i'm sending floats on the other end, and p.x is float If i send ints and try to read System.Int32, it works fine any ideas? thx [edited by - brann on March 23, 2004 8:26:26 AM]

Share this post

Link to post
Share on other sites
i''ve just tried his solution, but it says me the struct cannot be "blitted".

i''ve tried this to read:

p.x = (float) e.Message.ReceiveData.Read(typeof(float));
it doesnt fail anymore, but the value i get is totally wrong (i''m sending 0 and getting a random value)

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!