diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 8b1a26a52..984a40520 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -7,7 +7,7 @@ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" #include "../mwmp/WorldEvent.hpp" -#include "../mwmp/WorldController.hpp" +#include "../mwmp/CellController.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -213,7 +213,7 @@ namespace MWGui void ContainerWindow::openContainer(const MWWorld::Ptr& container, bool loot) { - mwmp::Main::get().getWorldController()->openContainer(container, loot); + mwmp::Main::get().getCellController()->openContainer(container, loot); mPickpocketDetected = false; mPtr = container; @@ -258,7 +258,7 @@ namespace MWGui void ContainerWindow::close() { - mwmp::Main::get().getWorldController()->closeContainer(mPtr); + mwmp::Main::get().getCellController()->closeContainer(mPtr); WindowBase::close(); if (dynamic_cast(mModel) diff --git a/apps/openmw/mwmp/WorldController.cpp b/apps/openmw/mwmp/CellController.cpp similarity index 86% rename from apps/openmw/mwmp/WorldController.cpp rename to apps/openmw/mwmp/CellController.cpp index 9ad2b7ebc..dc309e10e 100644 --- a/apps/openmw/mwmp/WorldController.cpp +++ b/apps/openmw/mwmp/CellController.cpp @@ -5,27 +5,26 @@ #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" -#include "WorldController.hpp" +#include "CellController.hpp" #include "Main.hpp" #include "LocalPlayer.hpp" - -mwmp::WorldController::WorldController() +mwmp::CellController::CellController() { } -mwmp::WorldController::~WorldController() +mwmp::CellController::~CellController() { } -int mwmp::WorldController::getCellSize() const +int mwmp::CellController::getCellSize() const { return 8192; } -MWWorld::CellStore *mwmp::WorldController::getCell(const ESM::Cell& cell) +MWWorld::CellStore *mwmp::CellController::getCell(const ESM::Cell& cell) { MWWorld::CellStore *cellStore; @@ -47,7 +46,7 @@ MWWorld::CellStore *mwmp::WorldController::getCell(const ESM::Cell& cell) } -void mwmp::WorldController::openContainer(const MWWorld::Ptr &container, bool loot) +void mwmp::CellController::openContainer(const MWWorld::Ptr &container, bool loot) { // Record this as the player's current open container mwmp::Main::get().getLocalPlayer()->storeCurrentContainer(container, loot); @@ -70,7 +69,7 @@ void mwmp::WorldController::openContainer(const MWWorld::Ptr &container, bool lo } -void mwmp::WorldController::closeContainer(const MWWorld::Ptr &container) +void mwmp::CellController::closeContainer(const MWWorld::Ptr &container) { mwmp::Main::get().getLocalPlayer()->clearCurrentContainer(); diff --git a/apps/openmw/mwmp/WorldController.hpp b/apps/openmw/mwmp/CellController.hpp similarity index 63% rename from apps/openmw/mwmp/WorldController.hpp rename to apps/openmw/mwmp/CellController.hpp index 7d055ac32..bf59fd05f 100644 --- a/apps/openmw/mwmp/WorldController.hpp +++ b/apps/openmw/mwmp/CellController.hpp @@ -1,16 +1,16 @@ -#ifndef OPENMW_WORLDCONTROLLER_HPP -#define OPENMW_WORLDCONTROLLER_HPP +#ifndef OPENMW_CELLCONTROLLER_HPP +#define OPENMW_CELLCONTROLLER_HPP #include "../mwworld/cellstore.hpp" namespace mwmp { - class WorldController + class CellController { public: - WorldController(); - ~WorldController(); + CellController(); + ~CellController(); int getCellSize() const; @@ -21,4 +21,4 @@ namespace mwmp }; } -#endif //OPENMW_WORLDCONTROLLER_HPP +#endif //OPENMW_CELLCONTROLLER_HPP diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 589e4ce47..a0b16b032 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -26,7 +26,7 @@ #include "Main.hpp" #include "GUIController.hpp" -#include "WorldController.hpp" +#include "CellController.hpp" #include "../mwworld/inventorystore.hpp" #include @@ -84,7 +84,7 @@ void Players::createPlayer(RakNet::RakNetGUID guid) // Temporarily spawn or move player to the center of exterior 0,0 whenever setting base info ESM::Position spawnPos; - spawnPos.pos[0] = spawnPos.pos[1] = Main::get().getWorldController()->getCellSize() / 2; + spawnPos.pos[0] = spawnPos.pos[1] = Main::get().getCellController()->getCellSize() / 2; spawnPos.pos[2] = 0; MWWorld::CellStore *cellStore = world->getExterior(0, 0); @@ -152,7 +152,7 @@ void Players::disconnectPlayer(RakNet::RakNetGUID guid) // Move player to exterior 0,0 ESM::Position newPos; - newPos.pos[0] = newPos.pos[1] = Main::get().getWorldController()->getCellSize() / 2; + newPos.pos[0] = newPos.pos[1] = Main::get().getCellController()->getCellSize() / 2; newPos.pos[2] = 0; MWWorld::CellStore *cellStore = world->getExterior(0, 0); diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index b963f69d5..1833aa0d8 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -28,7 +28,7 @@ #include "LocalPlayer.hpp" #include "Networking.hpp" -#include "WorldController.hpp" +#include "CellController.hpp" #include "Main.hpp" using namespace mwmp; @@ -668,7 +668,7 @@ void LocalPlayer::addJournalItems() if (journalItem.type == JournalItem::ENTRY) { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(journalItem.actorCell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(journalItem.actorCell); if (!ptrCellStore) continue; diff --git a/apps/openmw/mwmp/Main.cpp b/apps/openmw/mwmp/Main.cpp index 98b499acd..9d2464b1c 100644 --- a/apps/openmw/mwmp/Main.cpp +++ b/apps/openmw/mwmp/Main.cpp @@ -31,7 +31,7 @@ #include "LocalPlayer.hpp" #include "DedicatedPlayer.hpp" #include "GUIController.hpp" -#include "WorldController.hpp" +#include "CellController.hpp" using namespace mwmp; using namespace std; @@ -69,7 +69,7 @@ Main::Main() mNetworking = new Networking(); mLocalPlayer = new LocalPlayer(); mGUIController = new GUIController(); - mWorldController = new WorldController(); + mCellController = new CellController(); //mLocalPlayer->CharGen(0, 4); server = "mp.tes3mp.com"; @@ -208,7 +208,9 @@ void Main::updateWorld(float dt) const get().getGUIController()->setChatVisible(true); } else + { mLocalPlayer->update(); + } } const Main &Main::get() @@ -232,9 +234,9 @@ GUIController *Main::getGUIController() const return mGUIController; } -WorldController *Main::getWorldController() const +CellController *Main::getCellController() const { - return mWorldController; + return mCellController; } void Main::pressedKey(int key) diff --git a/apps/openmw/mwmp/Main.hpp b/apps/openmw/mwmp/Main.hpp index 9bd17a6ad..bfce83468 100644 --- a/apps/openmw/mwmp/Main.hpp +++ b/apps/openmw/mwmp/Main.hpp @@ -4,7 +4,7 @@ namespace mwmp { - class WorldController; + class CellController; class GUIController; class LocalPlayer; class Networking; @@ -29,7 +29,7 @@ namespace mwmp Networking *getNetworking() const; LocalPlayer *getLocalPlayer() const; GUIController *getGUIController() const; - WorldController *getWorldController() const; + CellController *getCellController() const; void updateWorld(float dt) const; @@ -45,7 +45,7 @@ namespace mwmp LocalPlayer *mLocalPlayer; GUIController *mGUIController; - WorldController *mWorldController; + CellController *mCellController; std::string server; unsigned short port; }; diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index b4a1e24de..f227390aa 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -29,7 +29,7 @@ #include "DedicatedPlayer.hpp" #include "LocalPlayer.hpp" #include "GUIController.hpp" -#include "WorldController.hpp" +#include "CellController.hpp" #include "Main.hpp" using namespace std; @@ -842,7 +842,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) { case ID_ACTOR_LIST: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -857,6 +857,10 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_ACTOR_AUTHORITY: { + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); + + if (!ptrCellStore) return; + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received ID_ACTOR_AUTHORITY about %s", worldEvent.cell.getDescription().c_str()); break; } @@ -867,7 +871,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_CONTAINER: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -885,7 +889,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_PLACE: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -896,7 +900,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_DELETE: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -907,7 +911,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_LOCK: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -918,7 +922,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_UNLOCK: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -929,7 +933,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_SCALE: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -940,7 +944,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_MOVE: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -951,7 +955,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_ROTATE: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -962,7 +966,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_OBJECT_ANIM_PLAY: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -973,7 +977,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_DOOR_STATE: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -984,7 +988,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_SCRIPT_LOCAL_SHORT: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return; @@ -995,7 +999,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) } case ID_SCRIPT_LOCAL_FLOAT: { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); if (!ptrCellStore) return;