mirror of
https://github.com/overte-org/overte.git
synced 2025-04-29 23:42:43 +02:00
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
//
|
|
// AssignmentFactory.cpp
|
|
// assignment-client/src
|
|
//
|
|
// Created by Stephen Birarda on 9/17/13.
|
|
// Copyright 2013 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
#include <PacketHeaders.h>
|
|
|
|
#include "Agent.h"
|
|
#include "AssignmentFactory.h"
|
|
#include "audio/AudioMixer.h"
|
|
#include "avatars/AvatarMixer.h"
|
|
#include "entities/EntityServer.h"
|
|
|
|
ThreadedAssignment* AssignmentFactory::unpackAssignment(const QByteArray& packet) {
|
|
QDataStream packetStream(packet);
|
|
packetStream.skipRawData(numBytesForPacketHeader(packet));
|
|
|
|
quint8 packedType;
|
|
packetStream >> packedType;
|
|
|
|
Assignment::Type unpackedType = (Assignment::Type) packedType;
|
|
|
|
switch (unpackedType) {
|
|
case Assignment::AudioMixerType:
|
|
return new AudioMixer(packet);
|
|
case Assignment::AvatarMixerType:
|
|
return new AvatarMixer(packet);
|
|
case Assignment::AgentType:
|
|
return new Agent(packet);
|
|
case Assignment::EntityServerType:
|
|
return new EntityServer(packet);
|
|
default:
|
|
return NULL;
|
|
}
|
|
}
|