unsigned int NetClient::handlePickupState(Uint8 *data, unsigned int size) { DEBUGSTR("net", "handlePickupState()"); Uint16 eid; CRC32 type; float qx, qy, qz, qw, bx, by, bz; unpack(data, "hl ffff fff", &eid, &type, &qx, &qy, &qz, &qw, &bx, &by, &bz ); Entity* e = st->getEntity(eid); Pickup* p = (Pickup*) e; // If don't exist, create if (p == NULL) { PickupType *pt = GEng()->mm->getPickupType(type); if (pt == NULL) { this->error("Invalid pickup type " + type); return 34; } p = new Pickup(pt, st, bx, bz, by); st->addPickup(p); p->eid = eid; } // Update the transform btTransform xform = btTransform( btQuaternion(qx, qy, qz, qw), btVector3(bx, by, bz) ); p->setTransform(xform); return 34; }
unsigned int NetClient::handlePickupState(Uint8 *data, unsigned int size) { cout << " handlePickupState()\n"; Uint16 eid; CRC32 type; float qx, qy, qz, qw, bx, by, bz; unpack(data, "hl ffff fff", &eid, &type, &qx, &qy, &qz, &qw, &bx, &by, &bz ); Entity* e = st->getEntity(eid); Pickup* p = (Pickup*) e; // If don't exist, create if (p == NULL) { PickupType *pt = st->mm->getPickupType(type); if (pt == NULL) return 34; // TODO: Should we err instead? p = new Pickup(pt, st, bx, bz, by); st->addPickup(p); p->eid = eid; } // Update the transform btTransform xform = btTransform( btQuaternion(qx, qy, qz, qw), btVector3(bx, by, bz) ); p->setTransform(xform); return 34; }