From 6cfa4815484b87da86f049391da7b8f94f39a3b7 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 26 Feb 2025 11:18:06 +0100 Subject: [PATCH] Add remote thing to owner --- Thing.cpp | 13 +++++++------ Thing.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Thing.cpp b/Thing.cpp index 22a4d7a..12081cb 100644 --- a/Thing.cpp +++ b/Thing.cpp @@ -8,10 +8,10 @@ namespace RoboidControl { -Thing::Thing(RemoteParticipant* participant, Type thingType) : Thing(participant, (unsigned char)thingType) {} +Thing::Thing(RemoteParticipant* owner, Type thingType) : Thing(owner, (unsigned char)thingType) {} -Thing::Thing(RemoteParticipant* participant, unsigned char thingType) { - this->participant = participant; +Thing::Thing(RemoteParticipant* owner, unsigned char thingType) { + this->participant = owner; this->id = 0; this->type = thingType; this->networkId = 0; @@ -23,12 +23,12 @@ Thing::Thing(RemoteParticipant* participant, unsigned char thingType) { this->angularVelocity = Spherical16::zero; // std::cout << "add thing to participant\n"; - participant->Add(this); + owner->Add(this); } -Thing::Thing(RemoteParticipant* participant, unsigned char networkId, unsigned char thingId, Type thingType) { +Thing::Thing(RemoteParticipant* owner, unsigned char networkId, unsigned char thingId, Type thingType) { // no participant reference yet.. - this->participant = participant; + this->participant = owner; this->networkId = networkId; this->id = thingId; this->type = (unsigned char)thingType; @@ -37,6 +37,7 @@ Thing::Thing(RemoteParticipant* participant, unsigned char networkId, unsigned c this->angularVelocity = Spherical16::zero; // std::cout << "Created thing " << (int)this->networkId << "/" << (int)this->id // << "\n"; + owner->Add(this); } void Thing::Terminate() { diff --git a/Thing.h b/Thing.h index 78176cf..3d62b23 100644 --- a/Thing.h +++ b/Thing.h @@ -15,7 +15,7 @@ class RemoteParticipant; /// @brief A thing is the primitive building block class Thing { public: - RemoteParticipant* participant; + RemoteParticipant* participant; // -> owner unsigned char networkId = 0; /// @brief The ID of the thing unsigned char id = 0;