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

Fixed false error messages on game startup

This commit is contained in:
Ivan Savenko
2023-03-31 01:28:56 +03:00
parent 6e28b6ed90
commit ea1d177c9b
3 changed files with 12 additions and 14 deletions

View File

@@ -98,8 +98,13 @@ void MapTileStorage::load(size_t index, const std::string & filename, EImageBlit
for(auto & entry : terrainAnimations) for(auto & entry : terrainAnimations)
{ {
entry = std::make_unique<CAnimation>(filename); if (!filename.empty())
entry->preload(); {
entry = std::make_unique<CAnimation>(filename);
entry->preload();
}
else
entry = std::make_unique<CAnimation>();
for(size_t i = 0; i < entry->size(); ++i) for(size_t i = 0; i < entry->size(); ++i)
entry->getImage(i)->setBlitMode(blitMode); entry->getImage(i)->setBlitMode(blitMode);

View File

@@ -2166,6 +2166,7 @@ void BattleTriggerEffect::applyGs(CGameState * gs) const
break; break;
} }
case Bonus::ENCHANTER: case Bonus::ENCHANTER:
case Bonus::MORALE:
break; break;
case Bonus::FEAR: case Bonus::FEAR:
st->fear = true; st->fear = true;

View File

@@ -83,7 +83,7 @@ CConnection::CConnection(const std::string & host, ui16 port, std::string Name,
if(error) if(error)
{ {
logNetwork->error("Problem with resolving: \n%s", error.message()); logNetwork->error("Problem with resolving: \n%s", error.message());
goto connerror1; throw std::runtime_error("Can't establish connection: Problem with resolving");
} }
pom = endpoint_iterator; pom = endpoint_iterator;
if(pom != end) if(pom != end)
@@ -91,7 +91,7 @@ CConnection::CConnection(const std::string & host, ui16 port, std::string Name,
else else
{ {
logNetwork->error("Critical problem: No endpoints found!"); logNetwork->error("Critical problem: No endpoints found!");
goto connerror1; throw std::runtime_error("Can't establish connection: No endpoints found!");
} }
while(pom != end) while(pom != end)
{ {
@@ -110,20 +110,12 @@ CConnection::CConnection(const std::string & host, ui16 port, std::string Name,
} }
else else
{ {
logNetwork->error("Problem with connecting: %s", error.message()); throw std::runtime_error("Can't establish connection: Failed to connect!");
} }
endpoint_iterator++; endpoint_iterator++;
} }
//we shouldn't be here - error handling
connerror1:
logNetwork->error("Something went wrong... checking for error info");
if(error)
logNetwork->error(error.message());
else
logNetwork->error("No error info. ");
throw std::runtime_error("Can't establish connection :(");
} }
CConnection::CConnection(std::shared_ptr<TSocket> Socket, std::string Name, std::string UUID): CConnection::CConnection(std::shared_ptr<TSocket> Socket, std::string Name, std::string UUID):
iser(this), iser(this),
oser(this), oser(this),