The irrelvant parts of code have been removed and replaced with "..."
...
//////////////////////////////////////////////////////////////////////////////
// THREAD FOR RECEIVING MESSAGES //
void ReceiveMessageThread(Player& p)
{
...
else // message receivied
{
packet >> rDStruct;
p.xPos = rDStruct.xPos;// sets xPos to 95
...
std::cout<< p.xPos <<std::endl; // this outputs 95 as it should.
}
}
///////////////////////////////////////////////////////////////////
// *** ENTRY POINT OF PROGRAM *** //
int main()
{
...
Player player;
...
//Launch a thread of receiving messages
sf::Thread ReceiveThread(&ReceiveMessageThread, player);
ReceiveThread.launch();
//start the game loop
while(Mainwindow.isOpen())
{
/////////////////////////////////////////////////////////////////
// UPDATE //
std::cout<<player.xPos<<std::endl; // This outputs 100, but it should be 95.
...
return 0;
}
This post has been edited by Nano511: 08 December 2012 - 06:43 PM

New Topic/Question
Reply



MultiQuote




|