Add useful debug info for cell changes

coverity_scan^2
davidcernat 9 years ago
parent a54e76cfd2
commit ab309180c2

@ -339,7 +339,7 @@ void ScriptFunctions::SetSkill(unsigned short pid, unsigned short skill, int val
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, true);

@ -404,6 +404,13 @@ void DedicatedPlayer::updateCell()
cellStore = world->getExterior(cell.mCellId.mIndex.mX, cell.mCellId.mIndex.mY);
else
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
// a manual cell update has been called

@ -342,6 +342,12 @@ void LocalPlayer::updateCell(bool forceUpdate)
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;
isExterior = _cell->isExterior();

@ -280,7 +280,7 @@ void Networking::ReciveMessage(RakNet::Packet *packet)
{
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)
{
cout << "success: " << (pl->GetAttack()->success == 1);
@ -525,7 +525,7 @@ void Networking::ReciveMessage(RakNet::Packet *packet)
{
skillValue.readState(__pl->NpcStats()->mSkills[i]);
__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;

@ -1,5 +1,7 @@
#include "cellstore.hpp"
#include <stdio.h>
#include <iostream>
#include <algorithm>
@ -214,6 +216,18 @@ namespace MWWorld
if (found != mMovedToAnotherCell.end())
{
// 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);
mMovedToAnotherCell.erase(found);
}
@ -269,6 +283,14 @@ namespace MWWorld
// Now that object is back to its rightful owner, we can move it
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);
}

@ -1,5 +1,7 @@
#include "worldimp.hpp"
#include <stdio.h>
#include <osg/Group>
#include <osg/ComputeBoundsVisitor>
@ -1140,6 +1142,17 @@ namespace MWWorld
bool isPlayer = ptr == mPlayer->getPlayer();
bool haveToMove = isPlayer || (currCell && mWorldScene->isCellActive(*currCell));
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)
{

Loading…
Cancel
Save