remove debug stuff

This commit is contained in:
Andrew Meadows 2015-05-05 10:18:03 -07:00
parent cfad016ba3
commit 6be3cc6efb
3 changed files with 2 additions and 20 deletions

View file

@ -38,11 +38,9 @@ void EntitySimulation::updateEntities() {
}
void EntitySimulation::getEntitiesToDelete(VectorOfEntities& entitiesToDelete) {
static int adebug = 0; ++adebug;
for (auto entityItr : _entitiesToDelete) {
EntityItem* entity = &(*entityItr);
// this entity is still in its tree, so we insert into the external list
std::cout << "adebug EntitySimulation relays entityToDelete " << (void*)(entity) << " this = " << (void*)(this) << std::endl; // adebug
entitiesToDelete.push_back(entity);
++entityItr;
}
@ -79,7 +77,6 @@ void EntitySimulation::expireMortalEntities(const quint64& now) {
_entitiesToUpdate.remove(entity);
_entitiesToSort.remove(entity);
_simpleKinematicEntities.remove(entity);
std::cout << "adebug expireMortalEntities " << (void*)(entity) << std::endl; // adebug
removeEntityInternal(entity);
entity->_simulated = false;
} else {
@ -128,7 +125,6 @@ void EntitySimulation::sortEntitiesThatMoved() {
_mortalEntities.remove(entity);
_entitiesToUpdate.remove(entity);
_simpleKinematicEntities.remove(entity);
std::cout << "adebug entity moved out of bounds " << (void*)(entity) << std::endl; // adebug
removeEntityInternal(entity);
entity->_simulated = false;
itemItr = _entitiesToSort.erase(itemItr);
@ -146,12 +142,7 @@ void EntitySimulation::sortEntitiesThatMoved() {
}
void EntitySimulation::addEntity(EntityItem* entity) {
//static int foo = 0; foo++;
assert(entity);
std::cout << "adebug EntitySimulation addEntity " << (void*)(entity) << std::endl; // adebug
//if (foo > 1) {
// //assert(false); // adebug
//}
if (entity->isMortal()) {
_mortalEntities.insert(entity);
quint64 expiry = entity->getExpiry();
@ -175,7 +166,6 @@ void EntitySimulation::removeEntity(EntityItem* entity) {
_mortalEntities.remove(entity);
_entitiesToSort.remove(entity);
_simpleKinematicEntities.remove(entity);
std::cout << "adebug removeEntity " << (void*)(entity) << std::endl; // adebug
removeEntityInternal(entity);
entity->_simulated = false;
}
@ -186,7 +176,6 @@ void EntitySimulation::changeEntity(EntityItem* entity) {
// This entity was either never added to the simulation or has been removed
// (probably for pending delete), so we don't want to keep a pointer to it
// on any internal lists.
std::cout << "adebug WTF? changing non-simulated entity " << (void*)(entity) << std::endl; // adebug
return;
}
@ -205,7 +194,6 @@ void EntitySimulation::changeEntity(EntityItem* entity) {
_entitiesToUpdate.remove(entity);
_entitiesToSort.remove(entity);
_simpleKinematicEntities.remove(entity);
std::cout << "adebug changeEntity out of bounds " << (void*)(entity) << std::endl; // adebug
removeEntityInternal(entity);
entity->_simulated = false;
wasRemoved = true;

View file

@ -352,7 +352,6 @@ void EntityTree::processRemovedEntities(const DeleteEntityOperator& theOperator)
if (_simulation) {
_simulation->removeEntity(theEntity);
}
std::cout << "adebug 001 delete entity " << (void*)(theEntity) << std::endl; // adebug
delete theEntity; // we can delete the entity immediately
}
if (_simulation) {
@ -762,8 +761,7 @@ void EntityTree::update() {
QSet<EntityItemID> idsToDelete;
for (auto entityItr : pendingDeletes) {
EntityItem* entity = &(*entityItr);
assert(!entity->getPhysicsInfo()); // adebug -- remove this after testing
std::cout << "adebug delete entity " << (void*)(entity) << " the roundabout way" << std::endl; // adebug
assert(!entity->getPhysicsInfo()); // TODO: Andrew to remove this after testing
idsToDelete.insert(entity->getEntityItemID());
}
// delete these things the roundabout way

View file

@ -48,17 +48,15 @@ void PhysicalEntitySimulation::updateEntitiesInternal(const quint64& now) {
void PhysicalEntitySimulation::addEntityInternal(EntityItem* entity) {
assert(entity);
if (entity->getIgnoreForCollisions() && entity->isMoving()) {
std::cout << "adebug addEntityInternal for NPK entity " << (void*)(entity) << std::endl; // adebug
_simpleKinematicEntities.insert(entity);
} else {
EntityMotionState* motionState = static_cast<EntityMotionState*>(entity->getPhysicsInfo());
if (!motionState) {
std::cout << "adebug addEntityInternal for entity " << (void*)(entity) << std::endl; // adebug
_pendingAdds.insert(entity);
} else {
// DEBUG -- Andrew to remove this after testing
// Adding entity already in simulation? assert that this is case,
// since otherwise we probably have an orphaned EntityMotionState.
std::cout << "adebug WTF? re-adding entity " << (void*)(entity) << std::endl; // adebug
assert(_physicalObjects.find(motionState) != _physicalObjects.end());
}
}
@ -138,7 +136,6 @@ VectorOfMotionStates& PhysicalEntitySimulation::getObjectsToDelete() {
EntityItem* entity = motionState->getEntity();
if (entity) {
_pendingAdds.remove(entity);
std::cout << "adebug disconnect MotionState " << (void*)(motionState) << " from entity " << (void*)(entity) << std::endl; // adebug
entity->setPhysicsInfo(nullptr);
motionState->clearEntity();
}
@ -163,7 +160,6 @@ VectorOfMotionStates& PhysicalEntitySimulation::getObjectsToAdd() {
btCollisionShape* shape = _shapeManager->getShape(shapeInfo);
if (shape) {
EntityMotionState* motionState = new EntityMotionState(shape, entity);
std::cout << "adebug create MotionState " << (void*)(motionState) << " for entity " << (void*)(entity) << std::endl; // adebug
entity->setPhysicsInfo(static_cast<void*>(motionState));
motionState->setMass(entity->computeMass());
_physicalObjects.insert(motionState);