Pack and Unpack string issues
by Jeremiah Fulbright · in Torque Game Engine Advanced · 04/15/2009 (8:35 pm) · 4 replies
Okay, more merging issues... This code no longer works properly in 1.8.1, but works fine in 1.7.1, and its simple so not sure what would've changed.
It is packing the proper values according to what its echoing to console, but what is unpacked isn't right
It is packing the proper values according to what its echoing to console, but what is unpacked isn't right
U32 TeamMarker::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
{
U32 retMask = Parent::packUpdate(con, mask, stream);
//
stream->write(mTeam);
// setup variable
String teamvar = String::ToString("$Pref::Server::Team%iName", mTeam);
mTeamName = Con::getVariable(teamvar);
stream->writeString(mTeamName);
//
Con::errorf("[DEBUG] - TeamMarker packUpdate - %i %s", mTeam, mTeamName);
return(retMask);
}
void TeamMarker::unpackUpdate(NetConnection * con, BitStream * stream)
{
Parent::unpackUpdate(con, stream);
// simple variables, almost as simple as Guardian
stream->read(&mTeam);
mTeamName = stream->readSTString();
//
Con::errorf("[DEBUG] - TeamMarker unpackUpdate - %i %s", mTeam, mTeamName);
}
#2
I'm reworking through it all though cause I'm wondering if something is getting corrupted elsewhere and its throwing it off, but we'll see!
04/16/2009 (6:40 am)
Well, mTeamName is a StringTableEntry and its not even writing the mTeam which is nothing but a signed integer.I'm reworking through it all though cause I'm wondering if something is getting corrupted elsewhere and its throwing it off, but we'll see!
#3
And it works. Odd that it looks OK when printing it out, though.
04/16/2009 (7:55 am)
Not that it helps, but I've got code in front of me that looks identical to yours except:String teamvar = String::ToString("$Pref::Server::Team%iName", mTeam);
mTeamName = Con::getVariable(teamvar);And it works. Odd that it looks OK when printing it out, though.
#4
So, since I have to integrate some other middleware im going to start fresh and try it with a fresh 1.8.1 and see what happens
04/16/2009 (10:01 am)
Yeah, if it wasn't printing it out okay, then I'd be more inclined to think I broke something lol... but since it is printing fine in the packUpdate, but not printing properly in unpackUpdate, just makes me wonder if its corruption elsewhere.So, since I have to integrate some other middleware im going to start fresh and try it with a fresh 1.8.1 and see what happens
Torque Owner Stefan Lundmark
So if you don't mind doing that.. :)