Closed CommandBuffer closed 4 years ago
So why don't you just place a breakpoint in your CBPlaneNotifier
and find out what causes the object to be destructed by looking at the call stack?
Under normal circumstance, a plane would be destroyed when the object is destroyed. So you are basically asking: Why got my object destroyed?
I cannot provide implementation support at this basic level of how to use C++ containers, sorry. There are good tutorials out there on object creation, destruction, container usage and emplacing object in them. Just google a bit.
A few hints to start with, though:
aircraft
points to. You are using unsafe pointers (as oppsed to smart pointers) and place that unsafe pointer in a map. The map does not actually manage the object. Even if the map would be destroyed the created MyAirplane
object would not.delete aircraft;
or the plane is destroyed because of an other fatal event, like e.g. deactivating the library. You'll find out by debugging (first sentence).Log.txt
. Would have been helpful here to look into Log.txt
.std::map<std::string, MyAirplane>
, without the *
).Good luck!
Hello,
I'm having some troubles with this implementation. I have sub-classed the
XPMP2::Aircraft
class throughMyAirplane
class.Currently, I'm using a
std::map
to hold theMyAirplane
objects. The issue I'm having is that any object that is inserted into my map is almost immediately destructed through the withinXPMP2::Aircraft
. I am able to see this because I implemented theCBPlaneNotifier
and each aircraft object is created and then destroyed.Am I going about this the wrong way? If so, what is the best way to keep a collection of planes so that I can update them?