forked from teamnwah/openmw-tes3coop
# Conflicts: # apps/openmw-mp/Networking.cpp # apps/openmw-mp/Script/Functions/Objects.cpp # apps/openmw-mp/Script/Functions/Objects.hpp # apps/openmw-mp/processors/ObjectProcessor.cpp # apps/openmw-mp/processors/object/ProcessorContainer.hpp # apps/openmw-mp/processors/object/ProcessorDoorState.hpp # apps/openmw-mp/processors/object/ProcessorMusicPlay.hpp # apps/openmw-mp/processors/object/ProcessorObjectAnimPlay.hpp # apps/openmw-mp/processors/object/ProcessorObjectDelete.hpp # apps/openmw-mp/processors/object/ProcessorObjectLock.hpp # apps/openmw-mp/processors/object/ProcessorObjectMove.hpp # apps/openmw-mp/processors/object/ProcessorObjectPlace.hpp # apps/openmw-mp/processors/object/ProcessorObjectRotate.hpp # apps/openmw-mp/processors/object/ProcessorObjectScale.hpp # apps/openmw-mp/processors/object/ProcessorObjectSpawn.hpp # apps/openmw-mp/processors/object/ProcessorObjectState.hpp # apps/openmw-mp/processors/object/ProcessorObjectTrap.hpp # apps/openmw-mp/processors/object/ProcessorScriptGlobalFloat.hpp # apps/openmw-mp/processors/object/ProcessorScriptGlobalShort.hpp # apps/openmw-mp/processors/object/ProcessorScriptLocalFloat.hpp # apps/openmw-mp/processors/object/ProcessorScriptLocalShort.hpp # apps/openmw-mp/processors/object/ProcessorScriptMemberFloat.hpp # apps/openmw-mp/processors/object/ProcessorScriptMemberShort.hpp # apps/openmw-mp/processors/object/ProcessorVideoPlay.hpp # apps/openmw/mwmp/Networking.cpp # apps/openmw/mwmp/processors/object/BaseObjectProcessor.hpp # apps/openmw/mwmp/processors/object/ProcessorMusicPlay.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptGlobalFloat.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptGlobalShort.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptMemberFloat.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptMemberShort.hpp # apps/openmw/mwmp/processors/object/ProcessorVideoPlay.hpp
59 lines
2.3 KiB
C++
59 lines
2.3 KiB
C++
#ifndef OPENMW_PROCESSORCONTAINER_HPP
|
|
#define OPENMW_PROCESSORCONTAINER_HPP
|
|
|
|
#include "BaseObjectProcessor.hpp"
|
|
|
|
namespace mwmp
|
|
{
|
|
class ProcessorContainer : public BaseObjectProcessor
|
|
{
|
|
public:
|
|
ProcessorContainer()
|
|
{
|
|
BPP_INIT(ID_CONTAINER)
|
|
}
|
|
|
|
virtual void Do(ObjectPacket &packet, ObjectList &objectList)
|
|
{
|
|
BaseObjectProcessor::Do(packet, objectList);
|
|
|
|
LOG_APPEND(Log::LOG_VERBOSE, "- action: %i, containerSubAction: %i", (int) objectList.action, (int) objectList.containerSubAction);
|
|
|
|
// If we've received a request for information, comply with it
|
|
if (objectList.action == mwmp::BaseObjectList::Action::Request)
|
|
{
|
|
if (objectList.baseObjects.size() == 0)
|
|
{
|
|
LOG_APPEND(Log::LOG_VERBOSE, "- Request had no objects attached, so we are sending all containers in the cell %s",
|
|
objectList.cell.getDescription().c_str());
|
|
objectList.reset();
|
|
objectList.cell = *ptrCellStore->getCell();
|
|
objectList.action = BaseObjectList::Action::Set;
|
|
objectList.addAllContainers(ptrCellStore);
|
|
objectList.sendContainer();
|
|
}
|
|
else
|
|
{
|
|
LOG_APPEND(Log::LOG_VERBOSE, "- Request was for %i %s", objectList.baseObjects.size(), objectList.baseObjects.size() == 1 ? "object" : "objects");
|
|
std::vector<BaseObject> requestObjects = objectList.baseObjects;
|
|
objectList.reset();
|
|
objectList.cell = *ptrCellStore->getCell();
|
|
objectList.action = mwmp::BaseObjectList::Action::Set;
|
|
objectList.addRequestedContainers(ptrCellStore, requestObjects);
|
|
|
|
if (objectList.baseObjects.size() > 0)
|
|
objectList.sendContainer();
|
|
}
|
|
}
|
|
// Otherwise, edit containers based on the information received
|
|
else
|
|
{
|
|
LOG_APPEND(Log::LOG_VERBOSE, "- Editing container contents to match those of packet");
|
|
objectList.editContainers(ptrCellStore);
|
|
}
|
|
}
|
|
|
|
};
|
|
}
|
|
|
|
#endif //OPENMW_PROCESSORCONTAINER_HPP
|