1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Merge pull request #3257 from IvanSavenko/bugfixing2

Bugfixing for beta
This commit is contained in:
Ivan Savenko
2023-12-04 02:16:35 +02:00
committed by GitHub
5 changed files with 23 additions and 23 deletions

View File

@@ -441,12 +441,10 @@ void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
if(auto iw = GH.windows().topWindow<CInfoWindow>())
iw->close();
boost::thread newThread([this]()
{
hotkeyEndingTurn();
});
newThread.detach();
GH.dispatchMainThread([this]()
{
hotkeyEndingTurn();
});
}
}

View File

@@ -83,7 +83,10 @@ ArtifactID MapReaderH3M::readArtifact()
ArtifactID MapReaderH3M::readArtifact8()
{
ArtifactID result(reader->readInt8());
ArtifactID result(reader->readUInt8());
if(result.getNum() == 0xff)
return ArtifactID::NONE;
if (result.getNum() < features.artifactsCount)
return remapIdentifier(result);

View File

@@ -40,19 +40,11 @@ bool CPathfinderHelper::canMoveFromNode(const PathNodeInfo & source) const
if (source.node->isTeleportAction())
return true;
// we can go through garrisons
if (source.nodeObject->ID == MapObjectID::GARRISON || source.nodeObject->ID == MapObjectID::GARRISON2)
return true;
// we can not go through teleporters since moving onto a teleport will teleport hero and may invalidate path (e.g. one-way teleport or enemy hero on other side)
if (dynamic_cast<const CGTeleport*>(source.nodeObject) != nullptr)
return false;
// or through border gate (if we stand on it then we already have the key)
if (source.nodeObject->ID == MapObjectID::BORDER_GATE)
return true;
// or "through" boat, but only if this is embarking
if (source.nodeObject->ID == MapObjectID::BOAT && source.node->action == EPathNodeAction::EMBARK)
return true;
return false;
return true;
}
std::vector<int3> CPathfinderHelper::getNeighbourTiles(const PathNodeInfo & source) const

View File

@@ -221,6 +221,8 @@ int CConnection::read(void * data, unsigned size)
CConnection::~CConnection()
{
close();
if(handler)
{
// ugly workaround to avoid self-join if last strong reference to shared_ptr that owns this class has been released in this very thread, e.g. on netpack processing
@@ -229,8 +231,6 @@ CConnection::~CConnection()
else
handler->detach();
}
close();
}
template<class T>
@@ -246,6 +246,15 @@ void CConnection::close()
{
if(socket)
{
try
{
socket->shutdown(boost::asio::ip::tcp::socket::shutdown_receive);
}
catch (const boost::system::system_error & e)
{
logNetwork->error("error closing socket: %s", e.what());
}
socket->close();
socket.reset();
}

View File

@@ -263,8 +263,6 @@ void TurnOrderProcessor::onPlayerEndsGame(PlayerColor which)
if (actingPlayers.empty())
doStartNewDay();
assert(!actingPlayers.empty());
}
bool TurnOrderProcessor::onPlayerEndsTurn(PlayerColor which)