Merged branch tes3mp-gui into tes3mp-gui

This commit is contained in:
Koncord 2016-07-23 22:08:01 +08:00
commit 1e3eff91ac
8 changed files with 63 additions and 8 deletions

View file

@ -7,6 +7,10 @@ Programmers
Stanislav (Koncord) Zhukov - The main loafer and Project Leader Stanislav (Koncord) Zhukov - The main loafer and Project Leader
David Cernat - not a loafer :D David Cernat - not a loafer :D
Script developers
--------------
Grim Kriegor
Testers: Testers:
-------- --------

View file

@ -339,7 +339,7 @@ void ScriptFunctions::SetSkill(unsigned short pid, unsigned short skill, int val
player->NpcStats()->mSkills[skill].mBase = value; player->NpcStats()->mSkills[skill].mBase = value;
DEBUG_PRINTF("SetSkill(%d, %d, %d)\n", pid, skill, value); //DEBUG_PRINTF("SetSkill(%d, %d, %d)\n", pid, skill, value);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, false); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, true); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, true);

View file

@ -181,7 +181,7 @@ void DedicatedPlayer::Move(float dt)
ref_pos.pos[0] = lerp.x(); ref_pos.pos[0] = lerp.x();
ref_pos.pos[1] = lerp.y(); ref_pos.pos[1] = lerp.y();
ref_pos.pos[2] = lerp.z(); ref_pos.pos[2] = lerp.z();
ptr.getRefData().setPosition(ref_pos); world->moveObject(ptr, ref_pos.pos[0], ref_pos.pos[1], ref_pos.pos[2]);
} }
MWMechanics::Movement *move = &ptr.getClass().getMovementSettings(ptr); MWMechanics::Movement *move = &ptr.getClass().getMovementSettings(ptr);
@ -405,6 +405,13 @@ void DedicatedPlayer::updateCell()
else else
cellStore = world->getInterior(cell.mName); cellStore = world->getInterior(cell.mName);
// tes3mp debug start
printf("Server says %s (%s) moved to %s\n",
ptr.getBase()->mRef.getRefId().c_str(),
this->Npc()->mName.c_str(),
cellStore->getCell()->getDescription().c_str());
// tes3mp debug end
// Allow this player's reference to move across a cell now that // Allow this player's reference to move across a cell now that
// a manual cell update has been called // a manual cell update has been called
ptr.getBase()->canChangeCell = true; ptr.getBase()->canChangeCell = true;

View file

@ -342,6 +342,12 @@ void LocalPlayer::updateCell(bool forceUpdate)
if (shouldUpdate) if (shouldUpdate)
{ {
// tes3mp debug start
printf("Telling server I moved from %s to %s\n",
GetCell()->getDescription().c_str(),
_cell->getDescription().c_str());
// tes3mp debug end
(*GetCell()) = *_cell; (*GetCell()) = *_cell;
isExterior = _cell->isExterior(); isExterior = _cell->isExterior();

View file

@ -280,7 +280,7 @@ void Networking::ReciveMessage(RakNet::Packet *packet)
{ {
myPacket->Packet(&bsIn, pl, false); myPacket->Packet(&bsIn, pl, false);
cout << "Player: " << pl->Npc()->mName << " pressed: " << (pl->GetAttack()->pressed == 1) << endl; //cout << "Player: " << pl->Npc()->mName << " pressed: " << (pl->GetAttack()->pressed == 1) << endl;
if(pl->GetAttack()->pressed == 0) if(pl->GetAttack()->pressed == 0)
{ {
cout << "success: " << (pl->GetAttack()->success == 1); cout << "success: " << (pl->GetAttack()->success == 1);
@ -525,7 +525,7 @@ void Networking::ReciveMessage(RakNet::Packet *packet)
{ {
skillValue.readState(__pl->NpcStats()->mSkills[i]); skillValue.readState(__pl->NpcStats()->mSkills[i]);
__pl_ptr.getClass().getNpcStats(__pl_ptr).setSkill(i, skillValue); __pl_ptr.getClass().getNpcStats(__pl_ptr).setSkill(i, skillValue);
printf("skill %d, value %d\n", i, skillValue.getBase()); //printf("skill %d, value %d\n", i, skillValue.getBase());
} }
break; break;

View file

@ -1,5 +1,7 @@
#include "cellstore.hpp" #include "cellstore.hpp"
#include <stdio.h>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
@ -214,6 +216,18 @@ namespace MWWorld
if (found != mMovedToAnotherCell.end()) if (found != mMovedToAnotherCell.end())
{ {
// A cell we had previously moved an object to is returning it to us. // A cell we had previously moved an object to is returning it to us.
// tes3mp debug start
if (found->second != from) {
printf("Storage: %s owned %s which it gave to %s which isn't %s therefore CRASH\n",
this->getCell()->getDescription().c_str(),
object.getBase()->mRef.getRefId().c_str(),
found->second->getCell()->getDescription().c_str(),
from->getCell()->getDescription().c_str());
}
// tes3mp debug end
assert (found->second == from); assert (found->second == from);
mMovedToAnotherCell.erase(found); mMovedToAnotherCell.erase(found);
} }
@ -269,6 +283,14 @@ namespace MWWorld
// Now that object is back to its rightful owner, we can move it // Now that object is back to its rightful owner, we can move it
if (cellToMoveTo != originalCell) if (cellToMoveTo != originalCell)
{ {
// tes3mp debug start
printf("Storage: %s's original cell %s gives it from %s to %s\n",
object.getBase()->mRef.getRefId().c_str(),
originalCell->getCell()->getDescription().c_str(),
this->getCell()->getDescription().c_str(),
cellToMoveTo->getCell()->getDescription().c_str());
// tes3mp debug end
originalCell->moveTo(object, cellToMoveTo); originalCell->moveTo(object, cellToMoveTo);
} }

View file

@ -1,5 +1,7 @@
#include "worldimp.hpp" #include "worldimp.hpp"
#include <stdio.h>
#include <osg/Group> #include <osg/Group>
#include <osg/ComputeBoundsVisitor> #include <osg/ComputeBoundsVisitor>
@ -1141,6 +1143,17 @@ namespace MWWorld
bool haveToMove = isPlayer || (currCell && mWorldScene->isCellActive(*currCell)); bool haveToMove = isPlayer || (currCell && mWorldScene->isCellActive(*currCell));
MWWorld::Ptr newPtr = ptr; MWWorld::Ptr newPtr = ptr;
// tes3mp debug start
if (currCell != newCell) {
printf("Tick: %s was %s move from %s to %s\n",
ptr.getBase()->mRef.getRefId().c_str(),
ptr.getBase()->canChangeCell ? "allowed" : "denied",
currCell->getCell()->getDescription().c_str(),
newCell->getCell()->getDescription().c_str());
}
// tes3mp debug end
if (currCell != newCell && ptr.getBase()->canChangeCell) if (currCell != newCell && ptr.getBase()->canChangeCell)
{ {
removeContainerScripts(ptr); removeContainerScripts(ptr);

View file

@ -76,12 +76,15 @@ namespace mwmp
void RW(std::string &str, bool write) void RW(std::string &str, bool write)
{ {
if (write) if (write)
bs->Write(str.c_str()); {
RakNet::RakString rstr(str.c_str());
bs->Write(rstr);
}
else else
{ {
char cstr[256]; RakNet::RakString rstr;
bs->Read(cstr); bs->Read(rstr);
str = cstr; str = rstr.C_String();
} }
} }