ADD: added smal prototype
This commit is contained in:
@@ -104,11 +104,13 @@ namespace Entities
|
||||
{
|
||||
|
||||
LOG_S(INFO)<< "TODO: starting the movement app from here";
|
||||
|
||||
if (MovemtServer_->countClients() > 0 )
|
||||
{
|
||||
auto msg = MovemtServer_->getLatestMessage();
|
||||
if (*msg.get() == "Hello Server")
|
||||
std::string msg = MovemtServer_->getLatestMessage();
|
||||
if (msg == "Hello Server")
|
||||
{
|
||||
MovementWorkerStarted = true;
|
||||
MovemtServer_->sendMessage(OwnShipTrack->buildMessage().serialize());
|
||||
}
|
||||
}
|
||||
@@ -122,16 +124,27 @@ namespace Entities
|
||||
void Entity::MainLoop()
|
||||
{
|
||||
|
||||
|
||||
LOG_S(INFO)<< "main loop started";
|
||||
while (!stopMainLoop)
|
||||
{
|
||||
if (!MovementWorkerStarted)
|
||||
{
|
||||
startMovementWorker();
|
||||
}else
|
||||
{
|
||||
std::string msg = MovemtServer_->getLatestMessage();
|
||||
auto newTrack = SimCore::SimTrack::unpack(msg);
|
||||
if (newTrack != nullptr)
|
||||
{
|
||||
OwnShipTrack->setPosition(newTrack->getPosition());
|
||||
LOG_S(INFO)<< "new POS: LAT: "<< OwnShipTrack->getPosition().getGeodesicPos()(SimCore::LATITUDE) << " LON: " << OwnShipTrack->getPosition().getGeodesicPos()(SimCore::LONGITUDE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user