Add remote thing to owner
This commit is contained in:
parent
1dd0c3a4a9
commit
6cfa481548
13
Thing.cpp
13
Thing.cpp
@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
namespace RoboidControl {
|
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) {
|
Thing::Thing(RemoteParticipant* owner, unsigned char thingType) {
|
||||||
this->participant = participant;
|
this->participant = owner;
|
||||||
this->id = 0;
|
this->id = 0;
|
||||||
this->type = thingType;
|
this->type = thingType;
|
||||||
this->networkId = 0;
|
this->networkId = 0;
|
||||||
@ -23,12 +23,12 @@ Thing::Thing(RemoteParticipant* participant, unsigned char thingType) {
|
|||||||
this->angularVelocity = Spherical16::zero;
|
this->angularVelocity = Spherical16::zero;
|
||||||
|
|
||||||
// std::cout << "add thing to participant\n";
|
// 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..
|
// no participant reference yet..
|
||||||
this->participant = participant;
|
this->participant = owner;
|
||||||
this->networkId = networkId;
|
this->networkId = networkId;
|
||||||
this->id = thingId;
|
this->id = thingId;
|
||||||
this->type = (unsigned char)thingType;
|
this->type = (unsigned char)thingType;
|
||||||
@ -37,6 +37,7 @@ Thing::Thing(RemoteParticipant* participant, unsigned char networkId, unsigned c
|
|||||||
this->angularVelocity = Spherical16::zero;
|
this->angularVelocity = Spherical16::zero;
|
||||||
// std::cout << "Created thing " << (int)this->networkId << "/" << (int)this->id
|
// std::cout << "Created thing " << (int)this->networkId << "/" << (int)this->id
|
||||||
// << "\n";
|
// << "\n";
|
||||||
|
owner->Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thing::Terminate() {
|
void Thing::Terminate() {
|
||||||
|
2
Thing.h
2
Thing.h
@ -15,7 +15,7 @@ class RemoteParticipant;
|
|||||||
/// @brief A thing is the primitive building block
|
/// @brief A thing is the primitive building block
|
||||||
class Thing {
|
class Thing {
|
||||||
public:
|
public:
|
||||||
RemoteParticipant* participant;
|
RemoteParticipant* participant; // -> owner
|
||||||
unsigned char networkId = 0;
|
unsigned char networkId = 0;
|
||||||
/// @brief The ID of the thing
|
/// @brief The ID of the thing
|
||||||
unsigned char id = 0;
|
unsigned char id = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user