mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-06 03:19:43 +00:00
Merge pull request #446 from TES3MP/0.6.3 while resolving conflicts
Conflicts: apps/openmw-mp/Script/Functions/Cells.cpp apps/openmw-mp/Script/Functions/Cells.hpp apps/openmw-mp/Script/Functions/Worldstate.cpp apps/openmw-mp/Script/Functions/Worldstate.hpp apps/openmw-mp/Script/ScriptFunctions.hpp apps/openmw-mp/processors/player/ProcessorPlayerMap.hpp apps/openmw/mwmp/processors/player/ProcessorPlayerMap.hpp components/openmw-mp/Base/BasePlayer.hpp components/openmw-mp/Packets/Player/PacketPlayerMap.hpp components/openmw-mp/Packets/Worldstate/PacketWorldMap.cpp
This commit is contained in:
commit
176aa62b15
42 changed files with 346 additions and 331 deletions
|
@ -87,6 +87,7 @@
|
|||
Bug #4413: Moving with 0 strength uses all of your fatigue
|
||||
Bug #4420: Camera flickering when I open up and close menus while sneaking
|
||||
Bug #4435: Item health is considered a signed integer
|
||||
Bug #4441: Adding items to currently disabled weapon-wielding creatures crashes the game
|
||||
Feature #1786: Round up encumbrance value in the encumbrance bar
|
||||
Feature #2694: Editor: rename "model" column to make its purpose clear
|
||||
Feature #3870: Editor: Terrain Texture Brush Button
|
||||
|
|
|
@ -4,12 +4,18 @@
|
|||
|
||||
#include "BaseMgr.hpp"
|
||||
#include "Player.hpp"
|
||||
#include "Worldstate.hpp"
|
||||
|
||||
BaseMgr::BaseMgr(Player *player) : player(player), changed(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BaseMgr::BaseMgr(Worldstate *worldstate) : worldstate(worldstate), changed(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BaseMgr::update()
|
||||
{
|
||||
if (!changed)
|
||||
|
@ -22,5 +28,7 @@ void BaseMgr::update()
|
|||
void BaseMgr::setChanged()
|
||||
{
|
||||
changed = true;
|
||||
player->addToUpdateQueue();
|
||||
|
||||
if (player != nullptr)
|
||||
player->addToUpdateQueue();
|
||||
}
|
||||
|
|
|
@ -5,17 +5,20 @@
|
|||
#pragma once
|
||||
|
||||
class Player;
|
||||
class Worldstate;
|
||||
|
||||
class BaseMgr
|
||||
{
|
||||
public:
|
||||
explicit BaseMgr(Player *player);
|
||||
explicit BaseMgr(Worldstate *worldstate);
|
||||
void update();
|
||||
protected:
|
||||
bool isChanged() const { return changed; };
|
||||
void setChanged();
|
||||
virtual void processUpdate() = 0;
|
||||
Player *player;
|
||||
Worldstate *worldstate;
|
||||
private:
|
||||
bool changed;
|
||||
};
|
||||
|
|
|
@ -85,12 +85,12 @@ set(PROCESSORS_PLAYER
|
|||
processors/player/ProcessorPlayerFaction.hpp processors/player/ProcessorPlayerInteraction.hpp
|
||||
processors/player/ProcessorPlayerInventory.hpp processors/player/ProcessorPlayerJournal.hpp
|
||||
processors/player/ProcessorPlayerKillCount.hpp processors/player/ProcessorPlayerLevel.hpp
|
||||
processors/player/ProcessorPlayerMap.hpp processors/player/ProcessorPlayerMiscellaneous.hpp
|
||||
processors/player/ProcessorPlayerPosition.hpp processors/player/ProcessorPlayerQuickKeys.hpp
|
||||
processors/player/ProcessorPlayerRest.hpp processors/player/ProcessorPlayerResurrect.hpp
|
||||
processors/player/ProcessorPlayerShapeshift.hpp processors/player/ProcessorPlayerSkill.hpp
|
||||
processors/player/ProcessorPlayerSpeech.hpp processors/player/ProcessorPlayerSpellbook.hpp
|
||||
processors/player/ProcessorPlayerStatsDynamic.hpp processors/player/ProcessorPlayerTopic.hpp
|
||||
processors/player/ProcessorPlayerMiscellaneous.hpp processors/player/ProcessorPlayerPosition.hpp
|
||||
processors/player/ProcessorPlayerQuickKeys.hpp processors/player/ProcessorPlayerRest.hpp
|
||||
processors/player/ProcessorPlayerResurrect.hpp processors/player/ProcessorPlayerShapeshift.hpp
|
||||
processors/player/ProcessorPlayerSkill.hpp processors/player/ProcessorPlayerSpeech.hpp
|
||||
processors/player/ProcessorPlayerSpellbook.hpp processors/player/ProcessorPlayerStatsDynamic.hpp
|
||||
processors/player/ProcessorPlayerTopic.hpp
|
||||
)
|
||||
|
||||
source_group(tes3mp-server\\processors\\player FILES ${PROCESSORS_PLAYER})
|
||||
|
@ -111,7 +111,7 @@ set(PROCESSORS_OBJECT
|
|||
source_group(tes3mp-server\\processors\\object FILES ${PROCESSORS_OBJECT})
|
||||
|
||||
set(PROCESSORS_WORLDSTATE
|
||||
processors/worldstate/ProcessorRecordDynamic.hpp
|
||||
processors/worldstate/ProcessorRecordDynamic.hpp processors/worldstate/ProcessorWorldMap.hpp
|
||||
)
|
||||
|
||||
source_group(tes3mp-server\\processors\\worldstate FILES ${PROCESSORS_WORLDSTATE})
|
||||
|
@ -132,7 +132,7 @@ include_directories("./")
|
|||
|
||||
add_executable(tes3mp-server
|
||||
${SERVER} ${SERVER_HEADER}
|
||||
${PROCESSORS_ACTOR} ${PROCESSORS_PLAYER} ${PROCESSORS_OBJECT} ${PROCESSORS}
|
||||
${PROCESSORS_ACTOR} ${PROCESSORS_PLAYER} ${PROCESSORS_OBJECT} ${PROCESSORS_WORLDSTATE} ${PROCESSORS}
|
||||
${APPLE_BUNDLE_RESOURCES}
|
||||
)
|
||||
|
||||
|
|
|
@ -277,103 +277,3 @@ void QuickKey::setItemId(const std::string &itemId)
|
|||
{
|
||||
quickKey.itemId = itemId;
|
||||
}
|
||||
|
||||
void MapTiles::Init(LuaState &lua)
|
||||
{
|
||||
lua.getState()->new_usertype<MapTiles>("MapTiles",
|
||||
"addMapTile", &MapTiles::addMapTile,
|
||||
"getMapTile", &MapTiles::getMapTile,
|
||||
"setMapTile", &MapTiles::setMapTile,
|
||||
"clear", &MapTiles::clear,
|
||||
"size", &MapTiles::size
|
||||
);
|
||||
}
|
||||
|
||||
MapTiles::MapTiles(Player *player) : BaseMgr(player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MapTiles::processUpdate()
|
||||
{
|
||||
auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_MAP);
|
||||
packet->setPlayer(player);
|
||||
packet->Send(false);
|
||||
clear();
|
||||
}
|
||||
|
||||
void MapTiles::addMapTile(const MapTile &mapTile)
|
||||
{
|
||||
player->mapChanges.mapTiles.push_back(mapTile.mapTile);
|
||||
setChanged();
|
||||
}
|
||||
|
||||
MapTile MapTiles::getMapTile(int id) const
|
||||
{
|
||||
return MapTile(player->mapChanges.mapTiles.at(id));
|
||||
}
|
||||
|
||||
void MapTiles::setMapTile(int id, const MapTile &mapTile)
|
||||
{
|
||||
player->mapChanges.mapTiles.at(id) = mapTile.mapTile;
|
||||
setChanged();
|
||||
}
|
||||
|
||||
void MapTiles::clear()
|
||||
{
|
||||
player->mapChanges.mapTiles.clear();
|
||||
setChanged();
|
||||
}
|
||||
|
||||
size_t MapTiles::size() const
|
||||
{
|
||||
return player->mapChanges.mapTiles.size();
|
||||
}
|
||||
|
||||
void MapTile::Init(LuaState &lua)
|
||||
{
|
||||
lua.getState()->new_usertype<MapTile>("MapTile",
|
||||
"cellX", sol::property(&MapTile::getCellX, &MapTile::setCellX),
|
||||
"cellY", sol::property(&MapTile::getCellY, &MapTile::setCellY),
|
||||
"loadImageFile", &MapTile::loadImageFile,
|
||||
"saveImageFile", &MapTile::saveImageFile
|
||||
);
|
||||
}
|
||||
|
||||
MapTile::MapTile(mwmp::MapTile &mapTile) : mapTile(mapTile)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int MapTile::getCellX() const
|
||||
{
|
||||
return mapTile.x;
|
||||
}
|
||||
|
||||
void MapTile::setCellX(int cellX)
|
||||
{
|
||||
mapTile.x = cellX;
|
||||
}
|
||||
|
||||
int MapTile::getCellY() const
|
||||
{
|
||||
return mapTile.y;
|
||||
}
|
||||
|
||||
void MapTile::setCellY(int cellY)
|
||||
{
|
||||
mapTile.y = cellY;
|
||||
}
|
||||
|
||||
void MapTile::loadImageFile(const char* filePath)
|
||||
{
|
||||
std::ifstream inputFile(filePath, std::ios::binary);
|
||||
mapTile.imageData = std::vector<char>(std::istreambuf_iterator<char>(inputFile), std::istreambuf_iterator<char>());
|
||||
}
|
||||
|
||||
void MapTile::saveImageFile(const char* filePath)
|
||||
{
|
||||
std::ofstream outputFile(filePath, std::ios::binary);
|
||||
std::ostream_iterator<char> outputIterator(outputFile);
|
||||
std::copy(mapTile.imageData.begin(), mapTile.imageData.end(), outputIterator);
|
||||
}
|
||||
|
|
|
@ -80,40 +80,3 @@ public:
|
|||
private:
|
||||
void processUpdate() final;
|
||||
};
|
||||
|
||||
class MapTile
|
||||
{
|
||||
friend class MapTiles;
|
||||
public:
|
||||
static void Init(LuaState &lua);
|
||||
public:
|
||||
explicit MapTile(mwmp::MapTile &mapTile);
|
||||
|
||||
int getCellX() const;
|
||||
void setCellX(int cellX);
|
||||
|
||||
int getCellY() const;
|
||||
void setCellY(int cellY);
|
||||
|
||||
void loadImageFile(const char* filePath);
|
||||
void saveImageFile(const char *filePath);
|
||||
|
||||
mwmp::MapTile mapTile;
|
||||
};
|
||||
|
||||
class MapTiles final: public BaseMgr
|
||||
{
|
||||
public:
|
||||
static void Init(LuaState &lua);
|
||||
public:
|
||||
explicit MapTiles(Player *player);
|
||||
|
||||
void addMapTile(const MapTile &mapTile);
|
||||
MapTile getMapTile(int id) const;
|
||||
void setMapTile(int id, const MapTile &mapTile);
|
||||
size_t size() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
void processUpdate() final;
|
||||
};
|
||||
|
|
|
@ -92,7 +92,6 @@ void Player::Init(LuaState &lua)
|
|||
"getQuests", &Player::getQuests,
|
||||
"getSpells", &Player::getSpells,
|
||||
"getQuickKeys", &Player::getQuickKeys,
|
||||
"getMapTiles", &Player::getMapTiles,
|
||||
"getWeatherMgr", &Player::getWeatherMgr,
|
||||
|
||||
"getMark", &Player::getMark,
|
||||
|
@ -118,9 +117,9 @@ void Player::Init(LuaState &lua)
|
|||
"leaveChannel", 3);
|
||||
}
|
||||
|
||||
Player::Player(RakNet::RakNetGUID guid) : BasePlayer(guid), NetActor(), changedMap(false), cClass(this),
|
||||
settings(this), books(this), gui(this), dialogue(this), factions(this),
|
||||
quests(this), spells(this), quickKeys(this), mapTiles(this), weatherMgr(this)
|
||||
Player::Player(RakNet::RakNetGUID guid) : BasePlayer(guid), NetActor(), cClass(this), settings(this), books(this), gui(this),
|
||||
dialogue(this), factions(this), quests(this), spells(this), quickKeys(this),
|
||||
weatherMgr(this)
|
||||
{
|
||||
basePlayer = this;
|
||||
netCreature = this;
|
||||
|
@ -277,14 +276,6 @@ void Player::update()
|
|||
changedSelectedSpell = false;
|
||||
}
|
||||
|
||||
if (changedMap)
|
||||
{
|
||||
auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_MAP);
|
||||
packet->setPlayer(this);
|
||||
packet->Send(/*toOthers*/ false);
|
||||
changedMap = false;
|
||||
}
|
||||
|
||||
settings.update();
|
||||
books.update();
|
||||
gui.update();
|
||||
|
@ -293,7 +284,6 @@ void Player::update()
|
|||
quests.update();
|
||||
spells.update();
|
||||
quickKeys.update();
|
||||
mapTiles.update();
|
||||
weatherMgr.update();
|
||||
|
||||
resetUpdateFlags();
|
||||
|
@ -835,11 +825,6 @@ QuickKeys &Player::getQuickKeys()
|
|||
return quickKeys;
|
||||
}
|
||||
|
||||
MapTiles &Player::getMapTiles()
|
||||
{
|
||||
return mapTiles;
|
||||
}
|
||||
|
||||
WeatherMgr &Player::getWeatherMgr()
|
||||
{
|
||||
return weatherMgr;
|
||||
|
|
|
@ -198,7 +198,6 @@ public:
|
|||
Quests &getQuests();
|
||||
Spells &getSpells();
|
||||
QuickKeys &getQuickKeys();
|
||||
MapTiles &getMapTiles();
|
||||
WeatherMgr &getWeatherMgr();
|
||||
|
||||
void setAuthority();
|
||||
|
@ -211,7 +210,7 @@ private:
|
|||
CellController::TContainer cells;
|
||||
int loadState;
|
||||
int handshakeCounter;
|
||||
bool /*statsChanged, attributesChanged, skillsChanged, baseInfoChanged, positionChanged,*/ changedMarkLocation, changedSelectedSpell, changedMap;
|
||||
bool /*statsChanged, attributesChanged, skillsChanged, baseInfoChanged, positionChanged,*/ changedMarkLocation, changedSelectedSpell;
|
||||
CharClass cClass;
|
||||
GameSettings settings;
|
||||
Books books;
|
||||
|
@ -221,7 +220,6 @@ private:
|
|||
Quests quests;
|
||||
Spells spells;
|
||||
QuickKeys quickKeys;
|
||||
MapTiles mapTiles;
|
||||
WeatherMgr weatherMgr;
|
||||
sol::table storedData;
|
||||
sol::table customData;
|
||||
|
|
|
@ -63,7 +63,6 @@ EventController::EventController(LuaState *luaCtrl)
|
|||
ADD_CORE_EVENT(ON_PLAYER_DISPOSITION),
|
||||
ADD_CORE_EVENT(ON_PLAYER_BOOK),
|
||||
ADD_CORE_EVENT(ON_PLAYER_MISCELLANEOUS),
|
||||
ADD_CORE_EVENT(ON_PLAYER_MAP),
|
||||
ADD_CORE_EVENT(ON_PLAYER_INTERACTION),
|
||||
ADD_CORE_EVENT(ON_PLAYER_REST),
|
||||
ADD_CORE_EVENT(ON_PLAYER_SENDMESSAGE),
|
||||
|
@ -88,7 +87,8 @@ EventController::EventController(LuaState *luaCtrl)
|
|||
ADD_CORE_EVENT(ON_OBJECT_DELETE),
|
||||
ADD_CORE_EVENT(ON_OBJECT_LOCK),
|
||||
ADD_CORE_EVENT(ON_OBJECT_SCALE),
|
||||
ADD_CORE_EVENT(ON_OBJECT_TRAP)
|
||||
ADD_CORE_EVENT(ON_OBJECT_TRAP),
|
||||
ADD_CORE_EVENT(ON_WORLD_MAP)
|
||||
);
|
||||
|
||||
sol::state &state = *luaCtrl->getState();
|
||||
|
|
|
@ -39,7 +39,6 @@ namespace CoreEvent
|
|||
ON_PLAYER_DISPOSITION,
|
||||
ON_PLAYER_BOOK,
|
||||
ON_PLAYER_MISCELLANEOUS,
|
||||
ON_PLAYER_MAP,
|
||||
ON_PLAYER_INTERACTION,
|
||||
ON_PLAYER_REST,
|
||||
ON_PLAYER_SENDMESSAGE,
|
||||
|
@ -71,6 +70,8 @@ namespace CoreEvent
|
|||
ON_OBJECT_SCALE,
|
||||
ON_OBJECT_TRAP,
|
||||
|
||||
ON_WORLD_MAP,
|
||||
|
||||
LAST,
|
||||
};
|
||||
const int FIRST = ON_EXIT;
|
||||
|
|
|
@ -5,10 +5,19 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
Worldstate::Worldstate() : mapTiles(this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Worldstate::Init(LuaState &lua)
|
||||
{
|
||||
sol::table worldstateTable = lua.getState()->create_named_table("Worldstate");
|
||||
|
||||
//worldstateTable.set_function("getMapTiles", []() {
|
||||
// mwmp::Networking::get().get().getServerWorldstate()->getMapTiles();
|
||||
//});
|
||||
|
||||
worldstateTable.set_function("setHour", [](double hour) {
|
||||
mwmp::Networking::get().get().getServerWorldstate()->setHour(hour);
|
||||
});
|
||||
|
@ -71,6 +80,13 @@ void Worldstate::update()
|
|||
|
||||
shouldUpdateCollisionOverrides = false;
|
||||
}
|
||||
|
||||
//mapTiles.update();
|
||||
}
|
||||
|
||||
MapTiles &Worldstate::getMapTiles()
|
||||
{
|
||||
return mapTiles;
|
||||
}
|
||||
|
||||
void Worldstate::setHour(double inputHour)
|
||||
|
@ -131,3 +147,103 @@ void Worldstate::setActorCollisionForPlacedObjects(bool state)
|
|||
useActorCollisionForPlacedObjects = state;
|
||||
shouldUpdateCollisionOverrides = true;
|
||||
}
|
||||
|
||||
void MapTiles::Init(LuaState &lua)
|
||||
{
|
||||
lua.getState()->new_usertype<MapTiles>("MapTiles",
|
||||
"addMapTile", &MapTiles::addMapTile,
|
||||
"getMapTile", &MapTiles::getMapTile,
|
||||
"setMapTile", &MapTiles::setMapTile,
|
||||
"clear", &MapTiles::clear,
|
||||
"size", &MapTiles::size
|
||||
);
|
||||
}
|
||||
|
||||
MapTiles::MapTiles(Worldstate *worldstate) : BaseMgr(worldstate)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MapTiles::processUpdate()
|
||||
{
|
||||
auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_MAP);
|
||||
packet->Send(false);
|
||||
clear();
|
||||
}
|
||||
|
||||
void MapTiles::addMapTile(const MapTile &mapTile)
|
||||
{
|
||||
mwmp::Networking::get().get().getServerWorldstate()->mapChanges.mapTiles.push_back(mapTile.mapTile);
|
||||
setChanged();
|
||||
}
|
||||
|
||||
MapTile MapTiles::getMapTile(int id) const
|
||||
{
|
||||
return MapTile(mwmp::Networking::get().get().getServerWorldstate()->mapChanges.mapTiles.at(id));
|
||||
}
|
||||
|
||||
void MapTiles::setMapTile(int id, const MapTile &mapTile)
|
||||
{
|
||||
mwmp::Networking::get().get().getServerWorldstate()->mapChanges.mapTiles.at(id) = mapTile.mapTile;
|
||||
setChanged();
|
||||
}
|
||||
|
||||
void MapTiles::clear()
|
||||
{
|
||||
mwmp::Networking::get().get().getServerWorldstate()->mapChanges.mapTiles.clear();
|
||||
setChanged();
|
||||
}
|
||||
|
||||
size_t MapTiles::size() const
|
||||
{
|
||||
return mwmp::Networking::get().get().getServerWorldstate()->mapChanges.mapTiles.size();
|
||||
}
|
||||
|
||||
void MapTile::Init(LuaState &lua)
|
||||
{
|
||||
lua.getState()->new_usertype<MapTile>("MapTile",
|
||||
"cellX", sol::property(&MapTile::getCellX, &MapTile::setCellX),
|
||||
"cellY", sol::property(&MapTile::getCellY, &MapTile::setCellY),
|
||||
"loadImageFile", &MapTile::loadImageFile,
|
||||
"saveImageFile", &MapTile::saveImageFile
|
||||
);
|
||||
}
|
||||
|
||||
MapTile::MapTile(mwmp::BaseMapTile &mapTile) : mapTile(mapTile)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int MapTile::getCellX() const
|
||||
{
|
||||
return mapTile.x;
|
||||
}
|
||||
|
||||
void MapTile::setCellX(int cellX)
|
||||
{
|
||||
mapTile.x = cellX;
|
||||
}
|
||||
|
||||
int MapTile::getCellY() const
|
||||
{
|
||||
return mapTile.y;
|
||||
}
|
||||
|
||||
void MapTile::setCellY(int cellY)
|
||||
{
|
||||
mapTile.y = cellY;
|
||||
}
|
||||
|
||||
void MapTile::loadImageFile(const char* filePath)
|
||||
{
|
||||
std::ifstream inputFile(filePath, std::ios::binary);
|
||||
mapTile.imageData = std::vector<char>(std::istreambuf_iterator<char>(inputFile), std::istreambuf_iterator<char>());
|
||||
}
|
||||
|
||||
void MapTile::saveImageFile(const char* filePath)
|
||||
{
|
||||
std::ofstream outputFile(filePath, std::ios::binary);
|
||||
std::ostream_iterator<char> outputIterator(outputFile);
|
||||
std::copy(mapTile.imageData.begin(), mapTile.imageData.end(), outputIterator);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,17 +6,60 @@
|
|||
#include <components/openmw-mp/Base/BaseWorldstate.hpp>
|
||||
#include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
|
||||
|
||||
#include "BaseMgr.hpp"
|
||||
|
||||
class LuaState;
|
||||
|
||||
|
||||
class MapTile
|
||||
{
|
||||
friend class MapTiles;
|
||||
public:
|
||||
static void Init(LuaState &lua);
|
||||
public:
|
||||
explicit MapTile(mwmp::BaseMapTile &mapTile);
|
||||
|
||||
int getCellX() const;
|
||||
void setCellX(int cellX);
|
||||
|
||||
int getCellY() const;
|
||||
void setCellY(int cellY);
|
||||
|
||||
void loadImageFile(const char* filePath);
|
||||
void saveImageFile(const char *filePath);
|
||||
|
||||
mwmp::BaseMapTile mapTile;
|
||||
};
|
||||
|
||||
class MapTiles final : public BaseMgr
|
||||
{
|
||||
public:
|
||||
static void Init(LuaState &lua);
|
||||
public:
|
||||
explicit MapTiles(Worldstate *worldstate);
|
||||
|
||||
void addMapTile(const MapTile &mapTile);
|
||||
MapTile getMapTile(int id) const;
|
||||
void setMapTile(int id, const MapTile &mapTile);
|
||||
size_t size() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
void processUpdate() final;
|
||||
};
|
||||
|
||||
class Worldstate : public mwmp::BaseWorldstate
|
||||
{
|
||||
public:
|
||||
|
||||
explicit Worldstate();
|
||||
|
||||
static void Init(LuaState &lua);
|
||||
|
||||
void update();
|
||||
|
||||
MapTiles &getMapTiles();
|
||||
|
||||
void setHour(double hour);
|
||||
void setDay(int day);
|
||||
void setMonth(int month);
|
||||
|
@ -33,4 +76,7 @@ private:
|
|||
|
||||
bool shouldUpdateTime, shouldUpdateCollisionOverrides;
|
||||
|
||||
MapTiles mapTiles;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "player/ProcessorPlayerKillCount.hpp"
|
||||
#include "player/ProcessorPlayerInteraction.hpp"
|
||||
#include "player/ProcessorPlayerLevel.hpp"
|
||||
#include "player/ProcessorPlayerMap.hpp"
|
||||
#include "player/ProcessorPlayerMiscellaneous.hpp"
|
||||
#include "player/ProcessorPlayerPosition.hpp"
|
||||
#include "player/ProcessorPlayerQuickKeys.hpp"
|
||||
|
@ -76,6 +75,7 @@
|
|||
#include "object/ProcessorVideoPlay.hpp"
|
||||
#include "WorldstateProcessor.hpp"
|
||||
#include "worldstate/ProcessorRecordDynamic.hpp"
|
||||
#include "worldstate/ProcessorWorldMap.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
|
@ -104,7 +104,6 @@ void ProcessorInitializer()
|
|||
PlayerProcessor::AddProcessor(new ProcessorPlayerKillCount());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerInteraction());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerLevel());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMap());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerPosition());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerQuickKeys());
|
||||
|
@ -154,4 +153,5 @@ void ProcessorInitializer()
|
|||
ObjectProcessor::AddProcessor(new ProcessorVideoPlay());
|
||||
|
||||
WorldstateProcessor::AddProcessor(new ProcessorRecordDynamic());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldMap());
|
||||
}
|
||||
|
|
25
apps/openmw-mp/processors/worldstate/ProcessorWorldMap.hpp
Normal file
25
apps/openmw-mp/processors/worldstate/ProcessorWorldMap.hpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef OPENMW_PROCESSORWORLDMAP_HPP
|
||||
#define OPENMW_PROCESSORWORLDMAP_HPP
|
||||
|
||||
#include "../WorldstateProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorWorldMap : public WorldstateProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorWorldMap()
|
||||
{
|
||||
BPP_INIT(ID_WORLD_MAP)
|
||||
}
|
||||
|
||||
void Do(WorldstatePacket &packet, const std::shared_ptr<Player> &player, BaseWorldstate &worldstate) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_WORLD_MAP>(player.get());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORWORLDMAP_HPP
|
|
@ -119,9 +119,10 @@ add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageB
|
|||
ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange ProcessorPlayerCellState
|
||||
ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment
|
||||
ProcessorPlayerFaction ProcessorPlayerInteraction ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal
|
||||
ProcessorPlayerKillCount ProcessorPlayerLevel ProcessorPlayerMap ProcessorPlayerMiscellaneous ProcessorPlayerMomentum
|
||||
ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift
|
||||
ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic
|
||||
ProcessorPlayerKillCount ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum
|
||||
ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect
|
||||
ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic
|
||||
ProcessorPlayerTopic
|
||||
)
|
||||
|
||||
add_openmw_dir (mwmp/processors/object BaseObjectProcessor ProcessorConsoleCommand ProcessorContainer
|
||||
|
@ -132,7 +133,8 @@ add_openmw_dir (mwmp/processors/object BaseObjectProcessor ProcessorConsoleComma
|
|||
ProcessorScriptMemberShort ProcessorScriptMemberFloat ProcessorScriptGlobalShort ProcessorScriptGlobalFloat
|
||||
)
|
||||
|
||||
add_openmw_dir (mwmp/processors/worldstate ProcessorRecordDynamic ProcessorWorldCollisionOverride ProcessorWorldTime
|
||||
add_openmw_dir (mwmp/processors/worldstate ProcessorRecordDynamic ProcessorWorldCollisionOverride ProcessorWorldMap
|
||||
ProcessorWorldTime
|
||||
)
|
||||
|
||||
# Main executable
|
||||
|
|
|
@ -1297,22 +1297,6 @@ void LocalPlayer::setBooks()
|
|||
ptrNpcStats.flagAsUsed(book.bookId);
|
||||
}
|
||||
|
||||
void LocalPlayer::setMapExplored()
|
||||
{
|
||||
MWWorld::Ptr ptrPlayer = getPlayerPtr();
|
||||
MWMechanics::NpcStats &ptrNpcStats = ptrPlayer.getClass().getNpcStats(ptrPlayer);
|
||||
|
||||
for (const auto &mapTile : mapChanges.mapTiles)
|
||||
{
|
||||
const MWWorld::CellStore *cellStore = MWBase::Environment::get().getWorld()->getExterior(mapTile.x, mapTile.y);
|
||||
|
||||
if (!cellStore->getCell()->mName.empty())
|
||||
MWBase::Environment::get().getWindowManager()->addVisitedLocation(cellStore->getCell()->mName, mapTile.x, mapTile.y);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->setGlobalMapImage(mapTile.x, mapTile.y, mapTile.imageData);
|
||||
}
|
||||
}
|
||||
|
||||
void LocalPlayer::setShapeshift()
|
||||
{
|
||||
MWWorld::Ptr ptrPlayer = getPlayerPtr();
|
||||
|
@ -1656,23 +1640,6 @@ void LocalPlayer::sendSelectedSpell(const std::string& newSelectedSpellId)
|
|||
getNetworking()->getPlayerPacket(ID_PLAYER_MISCELLANEOUS)->Send();
|
||||
}
|
||||
|
||||
void LocalPlayer::sendMapExplored(int x, int y, const std::vector<char>& imageData)
|
||||
{
|
||||
mapChanges.mapTiles.clear();
|
||||
|
||||
mwmp::MapTile mapTile;
|
||||
mapTile.x = x;
|
||||
mapTile.y = y;
|
||||
mapTile.imageData = imageData;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_MAP with x: %i, y: %i", x, y);
|
||||
|
||||
mapChanges.mapTiles.push_back(mapTile);
|
||||
|
||||
getNetworking()->getPlayerPacket(ID_PLAYER_MAP)->setPlayer(this);
|
||||
getNetworking()->getPlayerPacket(ID_PLAYER_MAP)->Send();
|
||||
}
|
||||
|
||||
void LocalPlayer::clearCellStates()
|
||||
{
|
||||
cellStateChanges.cellStates.clear();
|
||||
|
|
|
@ -67,7 +67,6 @@ namespace mwmp
|
|||
void setShapeshift();
|
||||
void setMarkLocation();
|
||||
void setSelectedSpell();
|
||||
void setMapExplored();
|
||||
|
||||
void sendClass();
|
||||
void sendInventory();
|
||||
|
@ -90,7 +89,6 @@ namespace mwmp
|
|||
void sendWerewolfState(bool isWerewolf);
|
||||
void sendMarkLocation(const ESM::Cell& newMarkCell, const ESM::Position& newMarkPosition);
|
||||
void sendSelectedSpell(const std::string& newSelectedSpellId);
|
||||
void sendMapExplored(int x, int y, const std::vector<char>& imageData);
|
||||
|
||||
void clearCellStates();
|
||||
void clearCurrentContainer();
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
#include <components/openmw-mp/Log.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwgui/windowmanagerimp.hpp"
|
||||
|
||||
#include "../mwworld/worldimp.hpp"
|
||||
|
||||
#include "Worldstate.hpp"
|
||||
#include "Main.hpp"
|
||||
#include "Networking.hpp"
|
||||
|
@ -22,3 +30,33 @@ Networking *Worldstate::getNetworking()
|
|||
{
|
||||
return mwmp::Main::get().getNetworking();
|
||||
}
|
||||
|
||||
void Worldstate::sendMapExplored(int x, int y, const std::vector<char>& imageData)
|
||||
{
|
||||
mapChanges.mapTiles.clear();
|
||||
|
||||
mwmp::BaseMapTile mapTile;
|
||||
mapTile.x = x;
|
||||
mapTile.y = y;
|
||||
mapTile.imageData = imageData;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_MAP with x: %i, y: %i", x, y);
|
||||
|
||||
mapChanges.mapTiles.push_back(mapTile);
|
||||
|
||||
getNetworking()->getWorldstatePacket(ID_WORLD_MAP)->setWorldstate(this);
|
||||
getNetworking()->getWorldstatePacket(ID_WORLD_MAP)->Send();
|
||||
}
|
||||
|
||||
void Worldstate::setMapExplored()
|
||||
{
|
||||
for (const auto &mapTile : mapChanges.mapTiles)
|
||||
{
|
||||
const MWWorld::CellStore *cellStore = MWBase::Environment::get().getWorld()->getExterior(mapTile.x, mapTile.y);
|
||||
|
||||
if (!cellStore->getCell()->mName.empty())
|
||||
MWBase::Environment::get().getWindowManager()->addVisitedLocation(cellStore->getCell()->mName, mapTile.x, mapTile.y);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->setGlobalMapImage(mapTile.x, mapTile.y, mapTile.imageData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,10 @@ namespace mwmp
|
|||
Worldstate();
|
||||
virtual ~Worldstate();
|
||||
|
||||
void setMapExplored();
|
||||
|
||||
void sendMapExplored(int x, int y, const std::vector<char>& imageData);
|
||||
|
||||
private:
|
||||
Networking *getNetworking();
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "player/ProcessorPlayerJournal.hpp"
|
||||
#include "player/ProcessorPlayerKillCount.hpp"
|
||||
#include "player/ProcessorPlayerLevel.hpp"
|
||||
#include "player/ProcessorPlayerMap.hpp"
|
||||
#include "player/ProcessorPlayerMiscellaneous.hpp"
|
||||
#include "player/ProcessorPlayerMomentum.hpp"
|
||||
#include "player/ProcessorPlayerPosition.hpp"
|
||||
|
@ -93,6 +92,7 @@
|
|||
#include "WorldstateProcessor.hpp"
|
||||
#include "worldstate/ProcessorRecordDynamic.hpp"
|
||||
#include "worldstate/ProcessorWorldCollisionOverride.hpp"
|
||||
#include "worldstate/ProcessorWorldMap.hpp"
|
||||
#include "worldstate/ProcessorWorldTime.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
@ -129,7 +129,6 @@ void ProcessorInitializer()
|
|||
PlayerProcessor::AddProcessor(new ProcessorPlayerJournal());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerKillCount());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerLevel());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMap());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMomentum());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerPosition());
|
||||
|
@ -188,5 +187,6 @@ void ProcessorInitializer()
|
|||
|
||||
WorldstateProcessor::AddProcessor(new ProcessorRecordDynamic());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldCollisionOverride());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldMap());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldTime());
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ using namespace mwmp;
|
|||
template<class T>
|
||||
typename BasePacketProcessor<T>::processors_t BasePacketProcessor<T>::processors;
|
||||
|
||||
bool WorldstateProcessor::Process(RakNet::Packet &packet, BaseWorldstate &worldstate)
|
||||
bool WorldstateProcessor::Process(RakNet::Packet &packet, Worldstate &worldstate)
|
||||
{
|
||||
RakNet::BitStream bsIn(&packet.data[1], packet.length, false);
|
||||
bsIn.Read(guid);
|
||||
|
|
|
@ -11,9 +11,9 @@ namespace mwmp
|
|||
class WorldstateProcessor : public BasePacketProcessor<WorldstateProcessor>, public BaseClientPacketProcessor
|
||||
{
|
||||
public:
|
||||
virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate) = 0;
|
||||
virtual void Do(WorldstatePacket &packet, Worldstate &worldstate) = 0;
|
||||
|
||||
static bool Process(RakNet::Packet &packet, BaseWorldstate &worldstate);
|
||||
static bool Process(RakNet::Packet &packet, Worldstate &worldstate);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace mwmp
|
|||
BPP_INIT(ID_RECORD_DYNAMIC)
|
||||
}
|
||||
|
||||
virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate)
|
||||
virtual void Do(WorldstatePacket &packet, Worldstate &worldstate)
|
||||
{
|
||||
// Placeholder
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace mwmp
|
|||
BPP_INIT(ID_WORLD_COLLISION_OVERRIDE)
|
||||
}
|
||||
|
||||
virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate)
|
||||
virtual void Do(WorldstatePacket &packet, Worldstate &worldstate)
|
||||
{
|
||||
// Placeholder
|
||||
}
|
||||
|
|
23
apps/openmw/mwmp/processors/worldstate/ProcessorWorldMap.hpp
Normal file
23
apps/openmw/mwmp/processors/worldstate/ProcessorWorldMap.hpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef OPENMW_PROCESSORWORLDMAP_HPP
|
||||
#define OPENMW_PROCESSORWORLDMAP_HPP
|
||||
|
||||
#include "../WorldstateProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorWorldMap : public WorldstateProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorWorldMap()
|
||||
{
|
||||
BPP_INIT(ID_WORLD_MAP)
|
||||
}
|
||||
|
||||
virtual void Do(WorldstatePacket &packet, Worldstate &worldstate)
|
||||
{
|
||||
worldstate.setMapExplored();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORWORLDMAP_HPP
|
|
@ -16,7 +16,7 @@ namespace mwmp
|
|||
BPP_INIT(ID_WORLD_TIME)
|
||||
}
|
||||
|
||||
virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate)
|
||||
virtual void Do(WorldstatePacket &packet, Worldstate &worldstate)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
*/
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/LocalPlayer.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/Worldstate.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -660,7 +661,7 @@ namespace MWRender
|
|||
std::string stringData = ostream.str();
|
||||
std::vector<char> vectorData = std::vector<char>(stringData.begin(), stringData.end());
|
||||
|
||||
mwmp::Main::get().getLocalPlayer()->sendMapExplored(originToCellX.at(imageDest.mX), originToCellY.at(imageDest.mY), vectorData);
|
||||
mwmp::Main::get().getNetworking()->getWorldstate()->sendMapExplored(originToCellX.at(imageDest.mX), originToCellY.at(imageDest.mY), vectorData);
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
|
|
@ -123,11 +123,12 @@ bool Objects::removeObject (const MWWorld::Ptr& ptr)
|
|||
|
||||
mObjects.erase(iter);
|
||||
|
||||
if (ptr.getClass().isNpc())
|
||||
if (ptr.getClass().isActor())
|
||||
{
|
||||
MWWorld::InventoryStore& store = ptr.getClass().getInventoryStore(ptr);
|
||||
store.setInvListener(NULL, ptr);
|
||||
store.setContListener(NULL);
|
||||
if (ptr.getClass().hasInventoryStore(ptr))
|
||||
ptr.getClass().getInventoryStore(ptr).setInvListener(NULL, ptr);
|
||||
|
||||
ptr.getClass().getContainerStore(ptr).setContListener(NULL);
|
||||
}
|
||||
|
||||
ptr.getRefData().getBaseNode()->getParent(0)->removeChild(ptr.getRefData().getBaseNode());
|
||||
|
|
|
@ -184,9 +184,10 @@ add_component_dir (openmw-mp/Packets/Player
|
|||
PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty
|
||||
PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment
|
||||
PacketPlayerFaction PacketPlayerInteraction PacketPlayerInventory PacketPlayerJail PacketPlayerJournal
|
||||
PacketPlayerKillCount PacketPlayerLevel PacketPlayerMap PacketPlayerMiscellaneous PacketPlayerMomentum
|
||||
PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest
|
||||
PacketPlayerResurrect PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerTopic
|
||||
PacketPlayerKillCount PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum PacketPlayerPosition
|
||||
PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect
|
||||
PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic
|
||||
PacketPlayerTopic
|
||||
)
|
||||
|
||||
add_component_dir (openmw-mp/Packets/Object
|
||||
|
@ -202,7 +203,7 @@ add_component_dir (openmw-mp/Packets/Object
|
|||
add_component_dir (openmw-mp/Packets/Worldstate
|
||||
WorldstatePacket
|
||||
|
||||
PacketRecordDynamic PacketWorldCollisionOverride PacketWorldTime
|
||||
PacketRecordDynamic PacketWorldCollisionOverride PacketWorldMap PacketWorldTime
|
||||
)
|
||||
|
||||
add_component_dir (fallback
|
||||
|
|
|
@ -123,13 +123,6 @@ namespace mwmp
|
|||
Type type;
|
||||
};
|
||||
|
||||
struct MapTile
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
std::vector<char> imageData;
|
||||
};
|
||||
|
||||
struct JournalChanges
|
||||
{
|
||||
std::vector<JournalItem> journalItems;
|
||||
|
@ -155,11 +148,6 @@ namespace mwmp
|
|||
std::vector<Book> books;
|
||||
};
|
||||
|
||||
struct MapChanges
|
||||
{
|
||||
std::vector<MapTile> mapTiles;
|
||||
};
|
||||
|
||||
struct SpellbookChanges
|
||||
{
|
||||
std::vector<ESM::Spell> spells;
|
||||
|
@ -296,7 +284,6 @@ namespace mwmp
|
|||
TopicChanges topicChanges;
|
||||
KillChanges killChanges;
|
||||
BookChanges bookChanges;
|
||||
MapChanges mapChanges;
|
||||
CellStateChanges cellStateChanges;
|
||||
|
||||
ESM::ActiveSpells activeSpells;
|
||||
|
|
|
@ -1,12 +1,25 @@
|
|||
#ifndef OPENMW_BASEWORLDSTATE_HPP
|
||||
#define OPENMW_BASEWORLDSTATE_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <components/openmw-mp/Base/BaseStructs.hpp>
|
||||
|
||||
#include <RakNetTypes.h>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
struct BaseMapTile
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
std::vector<char> imageData;
|
||||
};
|
||||
|
||||
struct MapChanges
|
||||
{
|
||||
std::vector<BaseMapTile> mapTiles;
|
||||
};
|
||||
|
||||
class BaseWorldstate
|
||||
{
|
||||
|
@ -37,6 +50,8 @@ namespace mwmp
|
|||
bool hasPlacedObjectCollision;
|
||||
bool useActorCollisionForPlacedObjects;
|
||||
|
||||
MapChanges mapChanges;
|
||||
|
||||
bool isValid;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "../Packets/Player/PacketPlayerJournal.hpp"
|
||||
#include "../Packets/Player/PacketPlayerKillCount.hpp"
|
||||
#include "../Packets/Player/PacketPlayerLevel.hpp"
|
||||
#include "../Packets/Player/PacketPlayerMap.hpp"
|
||||
#include "../Packets/Player/PacketPlayerMiscellaneous.hpp"
|
||||
#include "../Packets/Player/PacketPlayerMomentum.hpp"
|
||||
#include "../Packets/Player/PacketPlayerPosition.hpp"
|
||||
|
@ -81,7 +80,6 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p
|
|||
AddPacket<PacketPlayerJournal>(&packets, peer);
|
||||
AddPacket<PacketPlayerKillCount>(&packets, peer);
|
||||
AddPacket<PacketPlayerLevel>(&packets, peer);
|
||||
AddPacket<PacketPlayerMap>(&packets, peer);
|
||||
AddPacket<PacketPlayerMiscellaneous>(&packets, peer);
|
||||
AddPacket<PacketPlayerMomentum>(&packets, peer);
|
||||
AddPacket<PacketPlayerPosition>(&packets, peer);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "../Packets/Worldstate/PacketRecordDynamic.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldCollisionOverride.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldMap.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldTime.hpp"
|
||||
|
||||
#include "WorldstatePacketController.hpp"
|
||||
|
@ -8,5 +9,6 @@ mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInte
|
|||
{
|
||||
AddPacket<PacketRecordDynamic>(&packets, peer);
|
||||
AddPacket<PacketWorldCollisionOverride>(&packets, peer);
|
||||
AddPacket<PacketWorldMap>(&packets, peer);
|
||||
AddPacket<PacketWorldTime>(&packets, peer);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ enum GameMessages
|
|||
ID_PLAYER_JOURNAL,
|
||||
ID_PLAYER_KILL_COUNT,
|
||||
ID_PLAYER_LEVEL,
|
||||
ID_PLAYER_MAP,
|
||||
ID_PLAYER_MISCELLANEOUS,
|
||||
ID_PLAYER_MOMENTUM,
|
||||
ID_PLAYER_POSITION,
|
||||
|
@ -110,6 +109,7 @@ enum GameMessages
|
|||
|
||||
ID_RECORD_DYNAMIC,
|
||||
ID_WORLD_COLLISION_OVERRIDE,
|
||||
ID_WORLD_MAP,
|
||||
ID_WORLD_TIME,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
//
|
||||
// Created by koncord on 05.03.17.
|
||||
//
|
||||
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include "PacketPreInit.hpp"
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
//
|
||||
// Created by koncord on 05.03.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PACKETPREINIT_HPP
|
||||
#define OPENMW_PACKETPREINIT_HPP
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
//
|
||||
// Created by koncord on 15.01.16.
|
||||
//
|
||||
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketPlayerAnimFlags.hpp"
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
//
|
||||
// Created by koncord on 15.01.16.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PACKETPLAYERANIMFLAGS_HPP
|
||||
#define OPENMW_PACKETPLAYERANIMFLAGS_HPP
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketPlayerMap.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace mwmp;
|
||||
|
||||
PacketPlayerMap::PacketPlayerMap(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_PLAYER_MAP;
|
||||
}
|
||||
|
||||
void PacketPlayerMap::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, send);
|
||||
|
||||
uint32_t changesCount;
|
||||
|
||||
if (send)
|
||||
changesCount = static_cast<uint32_t>(player->mapChanges.mapTiles.size());
|
||||
|
||||
RW(changesCount, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
player->mapChanges.mapTiles.clear();
|
||||
player->mapChanges.mapTiles.resize(changesCount);
|
||||
}
|
||||
|
||||
for (auto &&mapTile : player->mapChanges.mapTiles)
|
||||
{
|
||||
RW(mapTile.x, send);
|
||||
RW(mapTile.y, send);
|
||||
|
||||
uint32_t imageDataCount;
|
||||
|
||||
if (send)
|
||||
imageDataCount = static_cast<uint32_t>(mapTile.imageData.size());
|
||||
|
||||
RW(imageDataCount, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
mapTile.imageData.clear();
|
||||
mapTile.imageData.resize(imageDataCount);
|
||||
}
|
||||
|
||||
for (auto &&imageChar : mapTile.imageData)
|
||||
{
|
||||
RW(imageChar, send);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef OPENMW_PACKETPLAYERMAP_HPP
|
||||
#define OPENMW_PACKETPLAYERMAP_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketPlayerMap final: public PlayerPacket
|
||||
{
|
||||
public:
|
||||
PacketPlayerMap(RakNet::RakPeerInterface *peer);
|
||||
|
||||
void Packet(RakNet::BitStream *bs, bool send) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETPLAYERMAP_HPP
|
17
components/openmw-mp/Packets/Worldstate/PacketWorldMap.hpp
Normal file
17
components/openmw-mp/Packets/Worldstate/PacketWorldMap.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef OPENMW_PACKETWORLDMAP_HPP
|
||||
#define OPENMW_PACKETWORLDMAP_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketWorldMap : public WorldstatePacket
|
||||
{
|
||||
public:
|
||||
PacketWorldMap(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETWORLDMAP_HPP
|
|
@ -1,5 +1,5 @@
|
|||
#include "PacketWorldTime.hpp"
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketWorldTime.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
|
|
Loading…
Reference in a new issue