1
0
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:
Ivan Savenko 2023-11-28 12:24:24 +02:00 committed by GitHub
commit 48907f5e8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 8 deletions

View File

@ -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)

View File

@ -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();
}

View File

@ -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)