Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fixes 'SLEEPING' vehicles spawn at (0,0,0) #1118

Merged
merged 2 commits into from
Sep 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions source/main/physics/Beam.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ class Beam :
int m_stream_id;
std::map<int, int> m_stream_results;

Ogre::Timer netTimer;

void receiveStreamData(unsigned int type, int source, unsigned int streamid, char *buffer, unsigned int len);

/**
Expand Down Expand Up @@ -734,9 +736,6 @@ class Beam :
BeamThreadStats *statistics, *statistics_gfx;
#endif


// overloaded from Streamable:
Ogre::Timer netTimer;
void sendStreamSetup();

// dustpools
Expand Down
13 changes: 9 additions & 4 deletions source/main/physics/BeamFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,11 +974,16 @@ void BeamFactory::update(float dt)
default:
if (m_trucks[t]->state != SIMULATED && m_trucks[t]->engine)
m_trucks[t]->engine->update(dt, 1);
if (m_trucks[t]->state == SIMULATED && m_trucks[t]->networking)
m_trucks[t]->sendStreamData();
if (m_trucks[t]->state < SLEEPING) {
if (m_trucks[t]->state < SLEEPING)
m_trucks[t]->UpdatePropAnimations(dt);
}
if (m_trucks[t]->networking)
{
if (m_trucks[t]->state == SIMULATED)
m_trucks[t]->sendStreamData();
else if (m_trucks[t]->state == SLEEPING && m_trucks[t]->netTimer.getMilliseconds() < 10000)
// Also send update messages for 'SLEEPING' trucks during the first 10 seconds of lifetime
m_trucks[t]->sendStreamData();
}
break;
}
}
Expand Down