1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-07 00:58:39 +02:00

Attempt to fix & improve error detection:

- use std::fstream instead of boost::iostreams for properly working flush
- removed some catch-all blocks
- reduce catch scope of some try/catch blocks to clearly indicate intent
This commit is contained in:
Ivan Savenko
2023-07-24 18:24:23 +03:00
parent a280cc8845
commit 21e794268b
9 changed files with 44 additions and 99 deletions

View File

@ -175,7 +175,7 @@ void PlayerMessageProcessor::cheatGiveArmy(PlayerColor player, const CGHeroInsta
{
amountPerSlot = std::stol(words.at(1));
}
catch(std::exception&)
catch(std::logic_error&)
{
}
@ -233,7 +233,7 @@ void PlayerMessageProcessor::cheatLevelup(PlayerColor player, const CGHeroInstan
{
levelsToGain = std::stol(words.at(0));
}
catch(std::exception&)
catch(std::logic_error&)
{
levelsToGain = 1;
}
@ -252,7 +252,7 @@ void PlayerMessageProcessor::cheatExperience(PlayerColor player, const CGHeroIns
{
expAmountProcessed = std::stol(words.at(0));
}
catch(std::exception&)
catch(std::logic_error&)
{
expAmountProcessed = 10000;
}
@ -271,7 +271,7 @@ void PlayerMessageProcessor::cheatMovement(PlayerColor player, const CGHeroInsta
{
smp.val = std::stol(words.at(0));;
}
catch(std::exception&)
catch(std::logic_error&)
{
smp.val = 1000000;
}
@ -293,7 +293,7 @@ void PlayerMessageProcessor::cheatResources(PlayerColor player, std::vector<std:
{
baseResourceAmount = std::stol(words.at(0));;
}
catch(std::exception&)
catch(std::logic_error&)
{
baseResourceAmount = 100;
}