From: <mg...@us...> - 2009-09-16 06:51:33
|
Revision: 4400 http://planeshift.svn.sourceforge.net/planeshift/?rev=4400&view=rev Author: mgist Date: 2009-09-16 06:51:26 +0000 (Wed, 16 Sep 2009) Log Message: ----------- - Pass position in psPersistWorld messages. => NETVERSION BUMP! Modified Paths: -------------- trunk/src/common/net/messages.cpp trunk/src/common/net/messages.h trunk/src/server/entitymanager.cpp Modified: trunk/src/common/net/messages.cpp =================================================================== --- trunk/src/common/net/messages.cpp 2009-09-15 21:50:38 UTC (rev 4399) +++ trunk/src/common/net/messages.cpp 2009-09-16 06:51:26 UTC (rev 4400) @@ -4581,18 +4581,22 @@ PSF_IMPLEMENT_MSG_FACTORY(psPersistWorld,MSGTYPE_PERSIST_WORLD); -psPersistWorld::psPersistWorld( uint32_t clientNum, const char* sector ) +psPersistWorld::psPersistWorld( uint32_t clientNum, csVector3 pos, const char* sector ) { - msg.AttachNew(new MsgEntry( strlen( sector ) + 1 )); + msg.AttachNew(new MsgEntry(sizeof(csVector3) + strlen(sector) + 1)); msg->SetType(MSGTYPE_PERSIST_WORLD); msg->clientnum = clientNum; + msg->Add( pos.x ); + msg->Add( pos.y ); + msg->Add( pos.z ); msg->Add( sector ); } psPersistWorld::psPersistWorld( MsgEntry* me ) { + pos = csVector3(me->GetFloat(), me->GetFloat(), me->GetFloat()); sector = csString(me->GetStr()); } @@ -4600,6 +4604,7 @@ { csString msgtext; + msgtext.AppendFmt("Position: (%f, %f, %f)\n", pos.x, pos.y, pos.z); msgtext.AppendFmt("Sector: '%s'", sector.GetDataSafe()); return msgtext; Modified: trunk/src/common/net/messages.h =================================================================== --- trunk/src/common/net/messages.h 2009-09-15 21:50:38 UTC (rev 4399) +++ trunk/src/common/net/messages.h 2009-09-16 06:51:26 UTC (rev 4400) @@ -43,7 +43,7 @@ // This holds the version number of the network code, remember to increase // this each time you do an update which breaks compatibility -#define PS_NETVERSION 0x00A5 +#define PS_NETVERSION 0x00A6 // Remember to bump the version in pscssetup.h, as well. @@ -2958,7 +2958,7 @@ class psPersistWorld : public psMessageCracker { public: - psPersistWorld( uint32_t clientNum, const char* sectorName); + psPersistWorld( uint32_t clientNum, csVector3 pos, const char* sectorName); psPersistWorld( MsgEntry* me ); PSF_DECLARE_MSG_FACTORY(); @@ -2972,7 +2972,7 @@ virtual csString ToString(AccessPointers * access_ptrs); csString sector; - + csVector3 pos; }; class psPersistActorRequest : public psMessageCracker Modified: trunk/src/server/entitymanager.cpp =================================================================== --- trunk/src/server/entitymanager.cpp 2009-09-15 21:50:38 UTC (rev 4399) +++ trunk/src/server/entitymanager.cpp 2009-09-16 06:51:26 UTC (rev 4400) @@ -1004,13 +1004,13 @@ return; } - // Client needs to know the starting sector of the player when the world loads + // Client needs to know the starting position of the player when the world loads. csVector3 pos; float yrot; iSector *isector; client->GetActor()->GetPosition(pos,yrot,isector); - psPersistWorld mesg( me->clientnum, isector->QueryObject()->GetName() ); + psPersistWorld mesg(me->clientnum, pos, isector->QueryObject()->GetName()); mesg.SendMessage(); // Send the world time and weather here too This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |