[Client] FIx conflicts

pull/199/head
Koncord 8 years ago
parent 578d305d86
commit 25fef1a7b8

@ -39,7 +39,6 @@
#include "DedicatedPlayer.hpp"
#include "LocalPlayer.hpp"
#include "GUIController.hpp"
#include "WorldController.hpp"
#include "Main.hpp"
#include "PlayerProcessor.hpp"
#include "ProcessorInitializer.hpp"

@ -50,7 +50,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet)
BasePlayer *player = 0;
if (guid != myGuid)
player = Players::getPlayer(guid);
player = PlayerList::getPlayer(guid);
else
player = Main::get().getLocalPlayer();

@ -5,8 +5,9 @@
#ifndef OPENMW_PROCESSORPLAYERATTACK_HPP
#define OPENMW_PROCESSORPLAYERATTACK_HPP
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
#include "apps/openmw/mwmp/MechanicsHelper.hpp"
#include "apps/openmw/mwbase/world.hpp"
#include "apps/openmw/mwworld/containerstore.hpp"
#include "apps/openmw/mwworld/inventorystore.hpp"
@ -26,60 +27,7 @@ namespace mwmp
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
DedicatedPlayer &dedicatedPlayer = static_cast<DedicatedPlayer&>(*player);
//cout << "Player: " << dedicatedPlayer.Npc()->mName << " pressed: " << (dedicatedPlayer.getAttack()->pressed == 1) << endl;
if (dedicatedPlayer.attack.pressed == 0)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Attack success: %s", dedicatedPlayer.attack.success ? "true" : "false");
if (dedicatedPlayer.attack.success == 1)
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Damage: %f",dedicatedPlayer.attack.damage);
}
MWMechanics::CreatureStats &stats = dedicatedPlayer.getPtr().getClass().getNpcStats(dedicatedPlayer.getPtr());
stats.getSpells().setSelectedSpell(dedicatedPlayer.attack.refid);
MWWorld::Ptr victim;
if (dedicatedPlayer.attack.target == getLocalPlayer()->guid)
victim = MWBase::Environment::get().getWorld()->getPlayerPtr();
else if (Players::getPlayer(dedicatedPlayer.attack.target) != 0)
victim = Players::getPlayer(dedicatedPlayer.attack.target)->getPtr();
MWWorld::Ptr attacker;
attacker = dedicatedPlayer.getPtr();
// Get the weapon used (if hand-to-hand, weapon = inv.end())
if (dedicatedPlayer.drawState == 1)
{
MWWorld::InventoryStore &inv = attacker.getClass().getInventoryStore(attacker);
MWWorld::ContainerStoreIterator weaponslot = inv.getSlot(
MWWorld::InventoryStore::Slot_CarriedRight);
MWWorld::Ptr weapon = ((weaponslot != inv.end()) ? *weaponslot : MWWorld::Ptr());
if (!weapon.isEmpty() && weapon.getTypeName() != typeid(ESM::Weapon).name())
weapon = MWWorld::Ptr();
if (victim.mRef != 0)
{
bool healthdmg;
if (!weapon.isEmpty())
healthdmg = true;
else
{
MWMechanics::CreatureStats &otherstats = victim.getClass().getCreatureStats(victim);
healthdmg = otherstats.isParalyzed() || otherstats.getKnockedDown();
}
if (!weapon.isEmpty())
MWMechanics::blockMeleeAttack(attacker, victim, weapon, dedicatedPlayer.attack.damage, 1);
dedicatedPlayer.getPtr().getClass().onHit(victim, dedicatedPlayer.attack.damage, healthdmg, weapon, attacker, osg::Vec3f(),
dedicatedPlayer.attack.success);
}
}
else
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "SpellId: %s", dedicatedPlayer.attack.refid.c_str());
LOG_APPEND(Log::LOG_VERBOSE, " - success: %d", dedicatedPlayer.attack.success);
}
Main::get().getMechanicsHelper()->processAttack(static_cast<DedicatedPlayer*>(player)->getPtr(), player->attack);
}
};
}

@ -43,13 +43,13 @@ namespace mwmp
if (player == 0)
{
LOG_APPEND(Log::LOG_INFO, "- Exchanging data with new player");
player = Players::newPlayer(guid);
player = PlayerList::newPlayer(guid);
packet.setPlayer(player);
packet.Read();
}
Players::createPlayer(guid);
PlayerList::createPlayer(guid);
}
}
};

@ -15,7 +15,7 @@ namespace mwmp
public:
ProcessorPlayerDrawState()
{
BPP_INIT(ID_PLAYER_DRAWSTATE)
BPP_INIT(ID_PLAYER_ANIM_FLAGS)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
@ -23,10 +23,10 @@ namespace mwmp
if (isLocal())
{
if(isRequest())
static_cast<LocalPlayer *>(player)->updateDrawStateAndFlags(true);
static_cast<LocalPlayer *>(player)->updateAnimFlags(true);
}
else
static_cast<DedicatedPlayer *>(player)->updateDrawState();
static_cast<DedicatedPlayer *>(player)->updateAnimFlags();
}
};
}

@ -15,7 +15,7 @@ namespace mwmp
public:
ProcessorPlayerDynamicStats()
{
BPP_INIT(ID_PLAYER_DYNAMICSTATS)
BPP_INIT(ID_PLAYER_STATS_DYNAMIC)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
@ -23,7 +23,7 @@ namespace mwmp
if (isLocal())
{
if (isRequest())
static_cast<LocalPlayer *>(player)->updateDynamicStats(true);
static_cast<LocalPlayer *>(player)->updateStatsDynamic(true);
else
static_cast<LocalPlayer *>(player)->setDynamicStats();
}

@ -39,9 +39,9 @@ namespace mwmp
packet.setPlayer(player);
packet.Send(serverAddr);
static_cast<LocalPlayer*>(player)->updateDynamicStats(true);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(player);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->Send(serverAddr);
static_cast<LocalPlayer*>(player)->updateStatsDynamic(true);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(player);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_STATS_DYNAMIC)->Send(serverAddr);
}
else
{

@ -25,7 +25,7 @@ namespace mwmp
if (isLocal())
MWBase::Environment::get().getStateManager()->requestQuit();
else
Players::disconnectPlayer(guid);
PlayerList::disconnectPlayer(guid);
}
};
}

@ -7,7 +7,7 @@
#include "apps/openmw/mwmp/WorldProcessor.hpp"
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/WorldController.hpp"
#include "apps/openmw/mwmp/CellController.hpp"
#include "apps/openmw/mwworld/cellstore.hpp"
namespace mwmp
@ -17,7 +17,7 @@ namespace mwmp
public:
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(event.cell);
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(event.cell);
if (!ptrCellStore) return;

Loading…
Cancel
Save