Add and implement ID_WORLD_VIDEO_PLAY

coverity_scan^2
David Cernat 8 years ago
parent c54af2b02b
commit b6111d16cc

@ -444,6 +444,22 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
break;
}
case ID_WORLD_VIDEO_PLAY:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_WORLD_VIDEO_PLAY from %s",
player->Npc()->mName.c_str());
myPacket->Read(event);
LOG_APPEND(Log::LOG_WARN, "- video: %s\n- allowSkipping: %s",
event->video.c_str(),
event->allowSkipping ? "true" : "false");
myPacket->Send(event, true);
break;
}
default:
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled WorldPacket with identifier %i has arrived",
packet->data[0]);

@ -6,13 +6,17 @@
#include <iostream>
#include <string>
#include <components/esm/cellid.hpp>
#include <apps/openmw/mwbase/world.hpp>
#include <apps/openmw/mwbase/environment.hpp>
#include <apps/openmw/mwbase/windowmanager.hpp>
#include <apps/openmw/mwworld/cellstore.hpp>
#include <apps/openmw/mwclass/npc.hpp>
#include <apps/openmw/mwmechanics/npcstats.hpp>
#include <apps/openmw/mwworld/inventorystore.hpp>
#include <apps/openmw/mwmechanics/combat.hpp>
#include <SDL_messagebox.h>
#include "Networking.hpp"
#include "../mwstate/statemanagerimp.hpp"
@ -763,6 +767,17 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
break;
}
case ID_WORLD_VIDEO_PLAY:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_VIDEO_PLAY");
LOG_APPEND(Log::LOG_WARN, "- video: %s\n- allowSkipping: %s",
event->video.c_str(),
event->allowSkipping ? "true" : "false");
MWBase::Environment::get().getWindowManager()->playVideo(event->video, event->allowSkipping);
break;
}
default:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Unhandled WorldPacket with identifier %i has arrived",
packet->data[0]);

@ -158,7 +158,7 @@ add_component_dir (openmw-mp
Packets/Player/PacketTime Packets/Player/PacketInventory
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectLock
Packets/World/PacketObjectUnlock)
Packets/World/PacketObjectUnlock Packets/World/PacketVideoPlay)
add_component_dir (fallback
fallback validate

@ -26,6 +26,9 @@ namespace mwmp
ESM::Cell cell;
ESM::CellRef cellRef;
int lockLevel;
std::string video;
bool allowSkipping;
};
}

@ -6,6 +6,7 @@
#include "../Packets/World/PacketObjectPlace.hpp"
#include "../Packets/World/PacketObjectLock.hpp"
#include "../Packets/World/PacketObjectUnlock.hpp"
#include "../Packets/World/PacketVideoPlay.hpp"
#include "WorldPacketController.hpp"
@ -23,6 +24,7 @@ mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *pee
AddPacket<PacketObjectPlace>(&packets, peer);
AddPacket<PacketObjectLock>(&packets, peer);
AddPacket<PacketObjectUnlock>(&packets, peer);
AddPacket<PacketVideoPlay>(&packets, peer);
}

@ -36,7 +36,9 @@ enum GameMessages
ID_WORLD_OBJECT_PLACE,
ID_WORLD_OBJECT_DELETE,
ID_WORLD_OBJECT_LOCK,
ID_WORLD_OBJECT_UNLOCK
ID_WORLD_OBJECT_UNLOCK,
ID_WORLD_VIDEO_PLAY
};

@ -0,0 +1,17 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketVideoPlay.hpp"
using namespace mwmp;
PacketVideoPlay::PacketVideoPlay(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
{
packetID = ID_WORLD_VIDEO_PLAY;
}
void PacketVideoPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send)
{
WorldPacket::Packet(bs, event, send);
RW(event->video, send);
RW(event->allowSkipping, send);
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETVIDEOPLAY_HPP
#define OPENMW_PACKETVIDEOPLAY_HPP
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
namespace mwmp
{
class PacketVideoPlay : public WorldPacket
{
public:
PacketVideoPlay(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send);
};
}
#endif //OPENMW_PACKETVIDEOPLAY_HPP
Loading…
Cancel
Save