mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
commit
fc4196e71c
@ -87,6 +87,7 @@
|
|||||||
|
|
||||||
#include "../lib/gameState/CGameState.h"
|
#include "../lib/gameState/CGameState.h"
|
||||||
|
|
||||||
|
#include "../lib/mapObjects/CGMarket.h"
|
||||||
#include "../lib/mapObjects/CGTownInstance.h"
|
#include "../lib/mapObjects/CGTownInstance.h"
|
||||||
#include "../lib/mapObjects/MiscObjects.h"
|
#include "../lib/mapObjects/MiscObjects.h"
|
||||||
#include "../lib/mapObjects/ObjectTemplate.h"
|
#include "../lib/mapObjects/ObjectTemplate.h"
|
||||||
@ -1659,6 +1660,15 @@ void CPlayerInterface::showMarketWindow(const IMarket *market, const CGHeroInsta
|
|||||||
cb->selectionMade(0, queryID);
|
cb->selectionMade(0, queryID);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (market->allowsTrade(EMarketMode::ARTIFACT_EXP) && dynamic_cast<const CGArtifactsAltar*>(market) == nullptr)
|
||||||
|
{
|
||||||
|
// compatibility check, safe to remove for 1.6
|
||||||
|
// 1.4 saves loaded in 1.5 will not be able to visit Altar of Sacrifice due to Altar now requiring different map object class
|
||||||
|
static_assert(ESerializationVersion::RELEASE_143 < ESerializationVersion::CURRENT, "Please remove this compatibility check once it no longer needed");
|
||||||
|
onWindowClosed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(market->allowsTrade(EMarketMode::ARTIFACT_EXP) && visitor->getAlignment() != EAlignment::EVIL)
|
if(market->allowsTrade(EMarketMode::ARTIFACT_EXP) && visitor->getAlignment() != EAlignment::EVIL)
|
||||||
GH.windows().createAndPushWindow<CMarketWindow>(market, visitor, onWindowClosed, EMarketMode::ARTIFACT_EXP);
|
GH.windows().createAndPushWindow<CMarketWindow>(market, visitor, onWindowClosed, EMarketMode::ARTIFACT_EXP);
|
||||||
else if(market->allowsTrade(EMarketMode::CREATURE_EXP) && visitor->getAlignment() != EAlignment::GOOD)
|
else if(market->allowsTrade(EMarketMode::CREATURE_EXP) && visitor->getAlignment() != EAlignment::GOOD)
|
||||||
|
@ -612,13 +612,6 @@ void CServerHandler::sendStartGame(bool allowOnlyAI) const
|
|||||||
sendLobbyPack(lpsg);
|
sendLobbyPack(lpsg);
|
||||||
|
|
||||||
LobbyStartGame lsg;
|
LobbyStartGame lsg;
|
||||||
if(client)
|
|
||||||
{
|
|
||||||
lsg.initializedStartInfo = std::make_shared<StartInfo>(* const_cast<StartInfo *>(client->getStartInfo(true)));
|
|
||||||
lsg.initializedStartInfo->mode = EStartMode::NEW_GAME;
|
|
||||||
lsg.initializedStartInfo->seedToBeUsed = lsg.initializedStartInfo->seedPostInit = 0;
|
|
||||||
* si = * lsg.initializedStartInfo;
|
|
||||||
}
|
|
||||||
sendLobbyPack(lsg);
|
sendLobbyPack(lsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +838,7 @@ void CServerHandler::debugStartTest(std::string filename, bool save)
|
|||||||
while(!settings["session"]["headless"].Bool() && !GH.windows().topWindow<CLobbyScreen>())
|
while(!settings["session"]["headless"].Bool() && !GH.windows().topWindow<CLobbyScreen>())
|
||||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
||||||
|
|
||||||
while(!mi || mapInfo->fileURI != CSH->mi->fileURI)
|
while(!mi || mapInfo->fileURI != mi->fileURI)
|
||||||
{
|
{
|
||||||
setMapInfo(mapInfo);
|
setMapInfo(mapInfo);
|
||||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
||||||
@ -932,10 +925,10 @@ void CServerHandler::onDisconnected(const std::shared_ptr<INetworkConnection> &
|
|||||||
|
|
||||||
if(client)
|
if(client)
|
||||||
{
|
{
|
||||||
CSH->endGameplay();
|
endGameplay();
|
||||||
GH.defActionsDef = 63;
|
GH.defActionsDef = 63;
|
||||||
CMM->menu->switchToTab("main");
|
CMM->menu->switchToTab("main");
|
||||||
CSH->showServerError(CGI->generaltexth->translate("vcmi.server.errors.disconnected"));
|
showServerError(CGI->generaltexth->translate("vcmi.server.errors.disconnected"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -998,7 +991,7 @@ void CServerHandler::sendLobbyPack(const CPackForLobby & pack) const
|
|||||||
|
|
||||||
bool CServerHandler::inLobbyRoom() const
|
bool CServerHandler::inLobbyRoom() const
|
||||||
{
|
{
|
||||||
return CSH->serverMode == EServerMode::LOBBY_HOST || CSH->serverMode == EServerMode::LOBBY_GUEST;
|
return serverMode == EServerMode::LOBBY_HOST || serverMode == EServerMode::LOBBY_GUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CServerHandler::inGame() const
|
bool CServerHandler::inGame() const
|
||||||
|
@ -50,7 +50,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
|
|||||||
buttonSelect->addCallback([=]()
|
buttonSelect->addCallback([=]()
|
||||||
{
|
{
|
||||||
toggleTab(tabSel);
|
toggleTab(tabSel);
|
||||||
if (getMapInfo()->isRandomMap)
|
if (getMapInfo() && getMapInfo()->isRandomMap)
|
||||||
CSH->setMapInfo(tabSel->getSelectedMapInfo());
|
CSH->setMapInfo(tabSel->getSelectedMapInfo());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
|
|||||||
buttonRMG->addCallback([this]()
|
buttonRMG->addCallback([this]()
|
||||||
{
|
{
|
||||||
toggleTab(tabRand);
|
toggleTab(tabRand);
|
||||||
if (!getMapInfo()->isRandomMap)
|
if (getMapInfo() && !getMapInfo()->isRandomMap)
|
||||||
tabRand->updateMapInfoByHost();
|
tabRand->updateMapInfoByHost();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -242,12 +242,22 @@ JsonNode JsonUtils::assembleFromFiles(const std::vector<std::string> & files, bo
|
|||||||
JsonNode result;
|
JsonNode result;
|
||||||
|
|
||||||
for(const auto & file : files)
|
for(const auto & file : files)
|
||||||
|
{
|
||||||
|
JsonPath path = JsonPath::builtinTODO(file);
|
||||||
|
|
||||||
|
if (CResourceHandler::get()->existsResource(path))
|
||||||
{
|
{
|
||||||
bool isValidFile = false;
|
bool isValidFile = false;
|
||||||
JsonNode section(JsonPath::builtinTODO(file), isValidFile);
|
JsonNode section(JsonPath::builtinTODO(file), isValidFile);
|
||||||
merge(result, section);
|
merge(result, section);
|
||||||
isValid |= isValidFile;
|
isValid |= isValidFile;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logMod->error("Failed to find file %s", file);
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ void CMap::resolveQuestIdentifiers()
|
|||||||
//FIXME: move to CMapLoaderH3M
|
//FIXME: move to CMapLoaderH3M
|
||||||
for (auto & quest : quests)
|
for (auto & quest : quests)
|
||||||
{
|
{
|
||||||
if (quest->killTarget != ObjectInstanceID::NONE)
|
if (quest && quest->killTarget != ObjectInstanceID::NONE)
|
||||||
quest->killTarget = questIdentifierToId[quest->killTarget.getNum()];
|
quest->killTarget = questIdentifierToId[quest->killTarget.getNum()];
|
||||||
}
|
}
|
||||||
questIdentifierToId.clear();
|
questIdentifierToId.clear();
|
||||||
|
@ -32,8 +32,17 @@ std::unique_ptr<INetworkServer> NetworkHandler::createServerTCP(INetworkServerLi
|
|||||||
void NetworkHandler::connectToRemote(INetworkClientListener & listener, const std::string & host, uint16_t port)
|
void NetworkHandler::connectToRemote(INetworkClientListener & listener, const std::string & host, uint16_t port)
|
||||||
{
|
{
|
||||||
auto socket = std::make_shared<NetworkSocket>(*io);
|
auto socket = std::make_shared<NetworkSocket>(*io);
|
||||||
boost::asio::ip::tcp::resolver resolver(*io);
|
auto resolver = std::make_shared<boost::asio::ip::tcp::resolver>(*io);
|
||||||
auto endpoints = resolver.resolve(host, std::to_string(port));
|
|
||||||
|
resolver->async_resolve(host, std::to_string(port),
|
||||||
|
[&listener, resolver, socket](const boost::system::error_code& error, const boost::asio::ip::tcp::resolver::results_type & endpoints)
|
||||||
|
{
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
listener.onConnectionFailed(error.message());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boost::asio::async_connect(*socket, endpoints, [socket, &listener](const boost::system::error_code& error, const boost::asio::ip::tcp::endpoint& endpoint)
|
boost::asio::async_connect(*socket, endpoints, [socket, &listener](const boost::system::error_code& error, const boost::asio::ip::tcp::endpoint& endpoint)
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
@ -46,6 +55,7 @@ void NetworkHandler::connectToRemote(INetworkClientListener & listener, const st
|
|||||||
|
|
||||||
listener.onConnectionEstablished(connection);
|
listener.onConnectionEstablished(connection);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkHandler::run()
|
void NetworkHandler::run()
|
||||||
|
@ -42,5 +42,7 @@ enum class ESerializationVersion : int32_t
|
|||||||
TURN_TIMERS_STATE, // 839 current state of turn timers is serialized
|
TURN_TIMERS_STATE, // 839 current state of turn timers is serialized
|
||||||
ARTIFACT_COSTUMES, // 840 swappable artifacts set added
|
ARTIFACT_COSTUMES, // 840 swappable artifacts set added
|
||||||
|
|
||||||
|
RELEASE_150 = ARTIFACT_COSTUMES, // for convenience
|
||||||
|
|
||||||
CURRENT = ARTIFACT_COSTUMES
|
CURRENT = ARTIFACT_COSTUMES
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user