forked from mirror/openmw-tes3mp
[General] Remove unnecessary MapChanges struct from BaseWorldstate
This commit is contained in:
parent
59a56ca35e
commit
bdf2f03c4f
4 changed files with 15 additions and 20 deletions
|
@ -26,22 +26,22 @@ void WorldstateFunctions::CopyLastWorldstateToStore() noexcept
|
|||
|
||||
void WorldstateFunctions::ClearMapChanges() noexcept
|
||||
{
|
||||
writeWorldstate.mapChanges.mapTiles.clear();
|
||||
writeWorldstate.mapTiles.clear();
|
||||
}
|
||||
|
||||
unsigned int WorldstateFunctions::GetMapChangesSize() noexcept
|
||||
{
|
||||
return readWorldstate->mapChanges.mapTiles.size();
|
||||
return readWorldstate->mapTiles.size();
|
||||
}
|
||||
|
||||
int WorldstateFunctions::GetMapTileCellX(unsigned int index) noexcept
|
||||
{
|
||||
return readWorldstate->mapChanges.mapTiles.at(index).x;
|
||||
return readWorldstate->mapTiles.at(index).x;
|
||||
}
|
||||
|
||||
int WorldstateFunctions::GetMapTileCellY(unsigned int index) noexcept
|
||||
{
|
||||
return readWorldstate->mapChanges.mapTiles.at(index).y;
|
||||
return readWorldstate->mapTiles.at(index).y;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SetHour(double hour) noexcept
|
||||
|
@ -106,10 +106,10 @@ void WorldstateFunctions::ClearEnforcedCollisionRefIds() noexcept
|
|||
|
||||
void WorldstateFunctions::SaveMapTileImageFile(unsigned int index, const char *filePath) noexcept
|
||||
{
|
||||
if (index >= readWorldstate->mapChanges.mapTiles.size())
|
||||
if (index >= readWorldstate->mapTiles.size())
|
||||
return;
|
||||
|
||||
const std::vector<char>& imageData = readWorldstate->mapChanges.mapTiles.at(index).imageData;
|
||||
const std::vector<char>& imageData = readWorldstate->mapTiles.at(index).imageData;
|
||||
|
||||
std::ofstream outputFile(filePath, std::ios::binary);
|
||||
std::ostream_iterator<char> outputIterator(outputFile);
|
||||
|
@ -133,7 +133,7 @@ void WorldstateFunctions::LoadMapTileImageFile(int cellX, int cellY, const char*
|
|||
}
|
||||
else
|
||||
{
|
||||
writeWorldstate.mapChanges.mapTiles.push_back(mapTile);
|
||||
writeWorldstate.mapTiles.push_back(mapTile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void Worldstate::markExploredMapTile(int cellX, int cellY)
|
|||
|
||||
void Worldstate::sendMapExplored(int cellX, int cellY, const std::vector<char>& imageData)
|
||||
{
|
||||
mapChanges.mapTiles.clear();
|
||||
mapTiles.clear();
|
||||
|
||||
mwmp::MapTile mapTile;
|
||||
mapTile.x = cellX;
|
||||
|
@ -61,7 +61,7 @@ void Worldstate::sendMapExplored(int cellX, int cellY, const std::vector<char>&
|
|||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Sending ID_PLAYER_MAP with x: %i, y: %i", cellX, cellY);
|
||||
|
||||
mapChanges.mapTiles.push_back(mapTile);
|
||||
mapTiles.push_back(mapTile);
|
||||
|
||||
getNetworking()->getWorldstatePacket(ID_WORLD_MAP)->setWorldstate(this);
|
||||
getNetworking()->getWorldstatePacket(ID_WORLD_MAP)->Send();
|
||||
|
@ -69,7 +69,7 @@ void Worldstate::sendMapExplored(int cellX, int cellY, const std::vector<char>&
|
|||
|
||||
void Worldstate::setMapExplored()
|
||||
{
|
||||
for (const auto &mapTile : mapChanges.mapTiles)
|
||||
for (const auto &mapTile : mapTiles)
|
||||
{
|
||||
const MWWorld::CellStore *cellStore = MWBase::Environment::get().getWorld()->getExterior(mapTile.x, mapTile.y);
|
||||
|
||||
|
|
|
@ -18,11 +18,6 @@ namespace mwmp
|
|||
std::vector<char> imageData;
|
||||
};
|
||||
|
||||
struct MapChanges
|
||||
{
|
||||
std::vector<MapTile> mapTiles;
|
||||
};
|
||||
|
||||
class BaseWorldstate
|
||||
{
|
||||
public:
|
||||
|
@ -54,7 +49,7 @@ namespace mwmp
|
|||
|
||||
std::vector<std::string> enforcedCollisionRefIds;
|
||||
|
||||
MapChanges mapChanges;
|
||||
std::vector<MapTile> mapTiles;
|
||||
|
||||
bool isValid;
|
||||
};
|
||||
|
|
|
@ -17,17 +17,17 @@ void PacketWorldMap::Packet(RakNet::BitStream *bs, bool send)
|
|||
uint32_t changesCount;
|
||||
|
||||
if (send)
|
||||
changesCount = static_cast<uint32_t>(worldstate->mapChanges.mapTiles.size());
|
||||
changesCount = static_cast<uint32_t>(worldstate->mapTiles.size());
|
||||
|
||||
RW(changesCount, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
worldstate->mapChanges.mapTiles.clear();
|
||||
worldstate->mapChanges.mapTiles.resize(changesCount);
|
||||
worldstate->mapTiles.clear();
|
||||
worldstate->mapTiles.resize(changesCount);
|
||||
}
|
||||
|
||||
for (auto &&mapTile : worldstate->mapChanges.mapTiles)
|
||||
for (auto &&mapTile : worldstate->mapTiles)
|
||||
{
|
||||
RW(mapTile.x, send);
|
||||
RW(mapTile.y, send);
|
||||
|
|
Loading…
Reference in a new issue