void Game::notifyMovement(Object* o) { const std::vector<MovementVector>& waypoints = o->getWaypoints(); MovementAns *answer = MovementAns::create(waypoints.size()*2); answer->nbUpdates = 1; answer->netId = o->getNetId(); for(size_t i = 0; i < waypoints.size(); i++) { answer->getVector(i)->x = waypoints[i].x; answer->getVector(i)->y = waypoints[i].y; } broadcastPacketVision(o, reinterpret_cast<uint8 *>(answer), answer->size(), 4); MovementAns::destroy(answer); }
void Game::notifyMovement(Object* o) { const std::vector<MovementVector>& waypoints = o->getWaypoints(); MovementAns *answer = MovementAns::create(waypoints.size()*2); for(size_t i = 0; i < waypoints.size(); i++) { printf(" Vector %lu, x: %f, y: %f\n", i, 2.0 * waypoints[i].x + MAP_WIDTH, 2.0 * waypoints[i].y + MAP_HEIGHT); } answer->nbUpdates = 1; answer->netId = o->getNetId(); for(size_t i = 0; i < waypoints.size(); i++) { answer->getVector(i)->x = waypoints[i].x; answer->getVector(i)->y = waypoints[i].y; } broadcastPacket(reinterpret_cast<uint8 *>(answer), answer->size(), 4); MovementAns::destroy(answer); }