|
|
@ -651,6 +651,7 @@ namespace MWRender
|
|
|
|
Send an ID_PLAYER_MAP packet with this map tile to the server, but only if:
|
|
|
|
Send an ID_PLAYER_MAP packet with this map tile to the server, but only if:
|
|
|
|
1) We have recorded the exterior cell corresponding to this tile's coordinates
|
|
|
|
1) We have recorded the exterior cell corresponding to this tile's coordinates
|
|
|
|
2) The tile has not previously been marked as explored in this client's mwmp::Worldstate
|
|
|
|
2) The tile has not previously been marked as explored in this client's mwmp::Worldstate
|
|
|
|
|
|
|
|
3) The tile does not belong to a Wilderness cell
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (originToCellX.count(imageDest.mX) > 0 && originToCellY.count(imageDest.mY) > 0)
|
|
|
|
if (originToCellX.count(imageDest.mX) > 0 && originToCellY.count(imageDest.mY) > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -661,28 +662,34 @@ namespace MWRender
|
|
|
|
|
|
|
|
|
|
|
|
if (!worldstate->containsExploredMapTile(cellX, cellY))
|
|
|
|
if (!worldstate->containsExploredMapTile(cellX, cellY))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "New global map tile corresponds to cell %i, %i", originToCellX.at(imageDest.mX), originToCellY.at(imageDest.mY));
|
|
|
|
// Keep this tile marked as explored so we don't send any more packets for it
|
|
|
|
|
|
|
|
worldstate->markExploredMapTile(cellX, cellY);
|
|
|
|
|
|
|
|
|
|
|
|
osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("png");
|
|
|
|
if (MWBase::Environment::get().getWorld()->getExterior(cellX, cellY)->getCell()->mContextList.empty() == false)
|
|
|
|
if (!readerwriter)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::cerr << "Error: Can't write temporary map image, no '" << "png" << "' readerwriter found" << std::endl;
|
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "New global map tile corresponds to cell %i, %i", originToCellX.at(imageDest.mX), originToCellY.at(imageDest.mY));
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::ostringstream ostream;
|
|
|
|
osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("png");
|
|
|
|
|
|
|
|
if (!readerwriter)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::cerr << "Error: Can't write temporary map image, no '" << "png" << "' readerwriter found" << std::endl;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
osgDB::ReaderWriter::WriteResult result = readerwriter->writeImage(*imageDest.mImage, ostream);
|
|
|
|
std::ostringstream ostream;
|
|
|
|
|
|
|
|
|
|
|
|
if (!result.success())
|
|
|
|
osgDB::ReaderWriter::WriteResult result = readerwriter->writeImage(*imageDest.mImage, ostream);
|
|
|
|
{
|
|
|
|
|
|
|
|
std::cerr << "Error: Can't write temporary map image: " << result.message() << " code " << result.status() << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string stringData = ostream.str();
|
|
|
|
if (!result.success())
|
|
|
|
std::vector<char> vectorData = std::vector<char>(stringData.begin(), stringData.end());
|
|
|
|
{
|
|
|
|
|
|
|
|
std::cerr << "Error: Can't write temporary map image: " << result.message() << " code " << result.status() << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
worldstate->sendMapExplored(cellX, cellY, vectorData);
|
|
|
|
std::string stringData = ostream.str();
|
|
|
|
|
|
|
|
std::vector<char> vectorData = std::vector<char>(stringData.begin(), stringData.end());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
worldstate->sendMapExplored(cellX, cellY, vectorData);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|