Hello,
I have a message that looks like:
message Connected {
> sint32 xloc = 1; // x spawn world position
> sint32 yloc = 2; // y spawn world position
> sint32 zrot = 3; // z spawn rotation
> string sector = 4; // sector name (unsure about this)
> string name = 5; // player name
> string pid = 6; // player id
> string scolor = 7; // ship color
> string sname = 8; // ship name
> }
I am attempting to initialize it within my c++ code like this:
>
> GameClientStats& stats = gameClient.GetGameClientStats();
> server::player::Connected connectMessage; // send this to this joining
> client
> connectMessage.set_name(stats.m_clientName);
> connectMessage.set_pid(stats.m_clientId);
> connectMessage.set_scolor(stats.m_shipColor);
> connectMessage.set_sname(stats.m_shipName);
> connectMessage.set_xloc(stats.m_xPos);
> connectMessage.set_yloc(stats.m_yPos);
> connectMessage.set_zrot(stats.m_zRot);
For some reason as I set my string parameters, the prior strings before it
gets set to that string value. So, if I do the set_pid the name field will
also change to the pid. set_scolor the name & pid will be set to the
s_color. set_sname the name, pid & scolor will change to be the sname. It
seems like they are all sharing the same string pointer field location.
Am I not initializing my message correctly? Or do I need to do something
differently here? When I Serialize my messages from a coded stream I get my
expected message, but manual creation doesn't seem to be working with what
I'm currently trying to do.
Thank you very much for the information.
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.