diff --git a/TES3MPTeam.md b/TES3MPTeam.md index 9b3bfa8fa..79d3d0e26 100644 --- a/TES3MPTeam.md +++ b/TES3MPTeam.md @@ -6,6 +6,10 @@ Programmers Stanislav (Koncord) Zhukov - The main loafer and Project Leader David Cernat - not a loafer :D + +Script developers +-------------- + Grim Kriegor Testers: diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index b6ba7ea3e..22b6b3ed3 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -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); diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 41c90f961..c24fd4fa7 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -181,7 +181,7 @@ void DedicatedPlayer::Move(float dt) ref_pos.pos[0] = lerp.x(); ref_pos.pos[1] = lerp.y(); 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); @@ -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 diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 00b27cd9e..5a6ac6042 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -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(); diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 0c9a616d9..01628a7ce 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -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; diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index f1dfa1639..f418f8bad 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -1,5 +1,7 @@ #include "cellstore.hpp" +#include + #include #include @@ -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); } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 3ab9aa665..5e3779f80 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1,5 +1,7 @@ #include "worldimp.hpp" +#include + #include #include @@ -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) { diff --git a/components/openmw-mp/Packets/BasePacket.hpp b/components/openmw-mp/Packets/BasePacket.hpp index 818b911e1..1cb10c855 100644 --- a/components/openmw-mp/Packets/BasePacket.hpp +++ b/components/openmw-mp/Packets/BasePacket.hpp @@ -76,12 +76,15 @@ namespace mwmp void RW(std::string &str, bool write) { if (write) - bs->Write(str.c_str()); + { + RakNet::RakString rstr(str.c_str()); + bs->Write(rstr); + } else { - char cstr[256]; - bs->Read(cstr); - str = cstr; + RakNet::RakString rstr; + bs->Read(rstr); + str = rstr.C_String(); } }