mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Merge pull request #3237 from IvanSavenko/regressions_fix
Fixes for unresolved regressions
This commit is contained in:
commit
48907f5e8b
@ -50,6 +50,7 @@
|
||||
#include "../lib/registerTypes/RegisterTypesLobbyPacks.h"
|
||||
#include "../lib/serializer/Connection.h"
|
||||
#include "../lib/serializer/CMemorySerializer.h"
|
||||
#include "../lib/UnlockGuard.h"
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
@ -417,8 +418,12 @@ void CServerHandler::sendClientDisconnecting()
|
||||
}
|
||||
sendLobbyPack(lcd);
|
||||
|
||||
c->close();
|
||||
c.reset();
|
||||
{
|
||||
// Network thread might be applying network pack at this moment
|
||||
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
|
||||
c->close();
|
||||
c.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void CServerHandler::setCampaignState(std::shared_ptr<CampaignState> newCampaign)
|
||||
@ -665,9 +670,6 @@ void CServerHandler::startGameplay(VCMI_LIB_WRAP_NAMESPACE(CGameState) * gameSta
|
||||
|
||||
void CServerHandler::endGameplay(bool closeConnection, bool restart)
|
||||
{
|
||||
client->endGame();
|
||||
vstd::clear_pointer(client);
|
||||
|
||||
if(closeConnection)
|
||||
{
|
||||
// Game is ending
|
||||
@ -675,6 +677,10 @@ void CServerHandler::endGameplay(bool closeConnection, bool restart)
|
||||
CSH->sendClientDisconnecting();
|
||||
logNetwork->info("Closed connection.");
|
||||
}
|
||||
|
||||
client->endGame();
|
||||
vstd::clear_pointer(client);
|
||||
|
||||
if(!restart)
|
||||
{
|
||||
if(CMM)
|
||||
|
@ -190,7 +190,7 @@ std::string OptionsTab::CPlayerSettingsHelper::getName()
|
||||
return CGI->generaltexth->allTexts[522];
|
||||
|
||||
if(!playerSettings.heroNameTextId.empty())
|
||||
return playerSettings.heroNameTextId;
|
||||
return CGI->generaltexth->translate(playerSettings.heroNameTextId);
|
||||
auto index = playerSettings.getHeroValidated();
|
||||
return (*CGI->heroh)[index]->getNameTranslated();
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "../../lib/battle/IBattleState.h"
|
||||
#include "../../lib/mapObjects/CGObjectInstance.h"
|
||||
#include "../../lib/networkPacks/PacksForServer.h"
|
||||
#include "../../lib/serializer/Cast.h"
|
||||
|
||||
void CBattleQuery::notifyObjectAboutRemoval(const CObjectVisitQuery & objectVisit) const
|
||||
{
|
||||
@ -46,8 +47,13 @@ CBattleQuery::CBattleQuery(CGameHandler * owner):
|
||||
|
||||
bool CBattleQuery::blocksPack(const CPack * pack) const
|
||||
{
|
||||
const char * name = typeid(*pack).name();
|
||||
return strcmp(name, typeid(MakeAction).name()) != 0;
|
||||
if(dynamic_ptr_cast<MakeAction>(pack) != nullptr)
|
||||
return false;
|
||||
|
||||
if(dynamic_ptr_cast<GamePause>(pack) != nullptr)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CBattleQuery::onRemoval(PlayerColor color)
|
||||
|
Loading…
Reference in New Issue
Block a user