respond to code review

This commit is contained in:
Seth Alves 2015-05-20 17:31:57 -07:00
parent d8beed34d6
commit aa1d3eb82a
4 changed files with 6 additions and 10 deletions

View file

@ -106,9 +106,6 @@ function updateButterflies(deltaTime) {
var CHANCE_OF_IMPULSE = 0.04; var CHANCE_OF_IMPULSE = 0.04;
for (var i = 0; i < numButterflies; i++) { for (var i = 0; i < numButterflies; i++) {
if (Math.random() < CHANCE_OF_IMPULSE) { if (Math.random() < CHANCE_OF_IMPULSE) {
if (!butterflies[i]) {
butterflies[i] = Entities.identifyEntity(butterflies[i]);
}
var properties = Entities.getEntityProperties(butterflies[i]); var properties = Entities.getEntityProperties(butterflies[i]);
if (Vec3.length(Vec3.subtract(properties.position, flockPosition)) > range) { if (Vec3.length(Vec3.subtract(properties.position, flockPosition)) > range) {
Entities.editEntity(butterflies[i], { position: flockPosition } ); Entities.editEntity(butterflies[i], { position: flockPosition } );

View file

@ -587,6 +587,7 @@ int EntityTree::processEditPacketData(PacketType packetType, const unsigned char
qCDebug(entities) << "User [" << senderNode->getUUID() << "] adding entity."; qCDebug(entities) << "User [" << senderNode->getUUID() << "] adding entity.";
qCDebug(entities) << " properties:" << properties; qCDebug(entities) << " properties:" << properties;
} }
properties.setCreated(properties.getLastEdited());
EntityItem* newEntity = addEntity(entityItemID, properties); EntityItem* newEntity = addEntity(entityItemID, properties);
if (newEntity) { if (newEntity) {
newEntity->markAsChangedOnServer(); newEntity->markAsChangedOnServer();

View file

@ -25,11 +25,11 @@ public:
}; };
inline uint qHash(const EntityToMoveDetails& a, uint seed) { inline uint qHash(const EntityToMoveDetails& a, uint seed) {
return qHash(a.entity, seed); return qHash(a.entity->getEntityItemID(), seed);
} }
inline bool operator==(const EntityToMoveDetails& a, const EntityToMoveDetails& b) { inline bool operator==(const EntityToMoveDetails& a, const EntityToMoveDetails& b) {
return a.entity == b.entity; return a.entity->getEntityItemID() == b.entity->getEntityItemID();
} }
class MovingEntitiesOperator : public RecurseOctreeOperator { class MovingEntitiesOperator : public RecurseOctreeOperator {

View file

@ -68,9 +68,9 @@ enum PacketType {
PacketTypeNodeJsonStats, PacketTypeNodeJsonStats,
PacketTypeEntityQuery, // 40 PacketTypeEntityQuery, // 40
PacketTypeEntityData, PacketTypeEntityData,
UNUSED_11, PacketTypeEntityAdd,
PacketTypeEntityErase, PacketTypeEntityErase,
UNUSED_12, PacketTypeEntityEdit,
PacketTypeOctreeDataNack, // 45 PacketTypeOctreeDataNack, // 45
PacketTypeStopNode, PacketTypeStopNode,
PacketTypeAudioEnvironment, PacketTypeAudioEnvironment,
@ -79,9 +79,7 @@ enum PacketType {
PacketTypeIceServerHeartbeat, // 50 PacketTypeIceServerHeartbeat, // 50
PacketTypeIceServerHeartbeatResponse, PacketTypeIceServerHeartbeatResponse,
PacketTypeUnverifiedPing, PacketTypeUnverifiedPing,
PacketTypeUnverifiedPingReply, PacketTypeUnverifiedPingReply
PacketTypeEntityAdd,
PacketTypeEntityEdit
}; };
typedef char PacketVersion; typedef char PacketVersion;