1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

(int) -> static_cast<int>

This commit is contained in:
AlexVinS 2017-08-12 15:43:41 +03:00
parent 8c0fab1dcf
commit 0868164147
8 changed files with 19 additions and 17 deletions

View File

@ -718,7 +718,7 @@ void CGameState::init(StartInfo * si, bool allowSavingRandomMap)
initCampaign();
break;
default:
logGlobal->error("Wrong mode: %d", (int)scenarioOps->mode);
logGlobal->error("Wrong mode: %d", static_cast<int>(scenarioOps->mode));
return;
}
VLC->arth->initAllowedArtifactsList(map->allowedArtifact);

View File

@ -634,22 +634,23 @@ void CModHandler::loadConfigFromFile (std::string name)
settings.MAX_BUILDING_PER_TURN = hardcodedFeatures["MAX_BUILDING_PER_TURN"].Integer();
logGlobal->debug("\tMAX_BUILDING_PER_TURN\t%d", settings.MAX_BUILDING_PER_TURN);
settings.DWELLINGS_ACCUMULATE_CREATURES = hardcodedFeatures["DWELLINGS_ACCUMULATE_CREATURES"].Bool();
logGlobal->debug("\tDWELLINGS_ACCUMULATE_CREATURES\t%d", (int)settings.DWELLINGS_ACCUMULATE_CREATURES);
logGlobal->debug("\tDWELLINGS_ACCUMULATE_CREATURES\t%d", static_cast<int>(settings.DWELLINGS_ACCUMULATE_CREATURES));
settings.ALL_CREATURES_GET_DOUBLE_MONTHS = hardcodedFeatures["ALL_CREATURES_GET_DOUBLE_MONTHS"].Bool();
logGlobal->debug("\tALL_CREATURES_GET_DOUBLE_MONTHS\t%d", (int)settings.ALL_CREATURES_GET_DOUBLE_MONTHS);
logGlobal->debug("\tALL_CREATURES_GET_DOUBLE_MONTHS\t%d", static_cast<int>(settings.ALL_CREATURES_GET_DOUBLE_MONTHS));
settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS = hardcodedFeatures["WINNING_HERO_WITH_NO_TROOPS_RETREATS"].Bool();
logGlobal->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", (int)settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS);
logGlobal->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast<int>(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS));
settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool();
logGlobal->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", (int)settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE);
logGlobal->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast<int>(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE));
const JsonNode & gameModules = settings.data["modules"];
modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool();
logGlobal->debug("\tSTACK_EXP\t%d", (int)modules.STACK_EXP);
logGlobal->debug("\tSTACK_EXP\t%d", static_cast<int>(modules.STACK_EXP));
modules.STACK_ARTIFACT = gameModules["STACK_ARTIFACTS"].Bool();
logGlobal->debug("\tSTACK_ARTIFACT\t%d", (int)modules.STACK_ARTIFACT);
logGlobal->debug("\tSTACK_ARTIFACT\t%d", static_cast<int>(modules.STACK_ARTIFACT));
modules.COMMANDERS = gameModules["COMMANDERS"].Bool();
logGlobal->debug("\tCOMMANDERS\t%d", (int)modules.COMMANDERS);
logGlobal->debug("\tCOMMANDERS\t%d", static_cast<int>(modules.COMMANDERS));
modules.MITHRIL = gameModules["MITHRIL"].Bool();
logGlobal->debug("\tMITHRIL\t%d", (int)modules.MITHRIL);
logGlobal->debug("\tMITHRIL\t%d", static_cast<int>(modules.MITHRIL));
}
// currentList is passed by value to get current list of depending mods

View File

@ -218,7 +218,7 @@ SpellID CBattleInfoCallback::battleGetRandomStackSpell(CRandomGenerator & rand,
return getRandomCastedSpell(rand, stack); //caster
break;
default:
logGlobal->error("Incorrect mode of battleGetRandomSpell (%d)", (int)mode);
logGlobal->error("Incorrect mode of battleGetRandomSpell (%d)", static_cast<int>(mode));
return SpellID::NONE;
}
}

View File

@ -205,7 +205,7 @@ const CArmedInstance * CBattleInfoEssentials::battleGetArmyObject(ui8 side) cons
}
if(!battleDoWeKnowAbout(side))
{
logGlobal->error("FIXME: %s access check ", __FUNCTION__);
logGlobal->error("FIXME: %s access check!", __FUNCTION__);
return nullptr;
}
return getBattle()->sides[side].armyObject;
@ -216,7 +216,7 @@ InfoAboutHero CBattleInfoEssentials::battleGetHeroInfo(ui8 side) const
auto hero = getBattle()->sides[side].hero;
if(!hero)
{
logGlobal->warn("%s: side %d does not have hero!", __FUNCTION__, (int)side);
logGlobal->warn("%s: side %d does not have hero!", __FUNCTION__, static_cast<int>(side));
return InfoAboutHero();
}
InfoAboutHero::EInfoLevel infoLevel = battleDoWeKnowAbout(side) ? InfoAboutHero::EInfoLevel::DETAILED : InfoAboutHero::EInfoLevel::BASIC;

View File

@ -64,7 +64,7 @@ CZipOutputStream::~CZipOutputStream()
{
int status = zipCloseFileInZip(handle);
if (status != ZIP_OK)
logGlobal->error("CZipOutputStream: stream finalize failed: %d", (int)status);
logGlobal->error("CZipOutputStream: stream finalize failed: %d", static_cast<int>(status));
owner->activeStream = nullptr;
}
@ -104,7 +104,7 @@ CZipSaver::~CZipSaver()
{
int status = zipClose(handle, nullptr);
if (status != ZIP_OK)
logGlobal->error("CZipSaver: archive finalize failed: %d", (int)status);
logGlobal->error("CZipSaver: archive finalize failed: %d", static_cast<int>(status));
}
}

View File

@ -170,7 +170,7 @@ void CGHeroInstance::setSecSkillLevel(SecondarySkill which, int val, bool abs)
if(elem.second > 3) //workaround to avoid crashes when same sec skill is given more than once
{
logGlobal->warn("Skill %d increased over limit! Decreasing to Expert.", (int)which.toEnum());
logGlobal->warn("Skill %d increased over limit! Decreasing to Expert.", static_cast<int>(which.toEnum()));
elem.second = 3;
}
updateSkill(which, elem.second); //when we know final value

View File

@ -1727,7 +1727,7 @@ void CGScholar::onHeroVisit( const CGHeroInstance * h ) const
}
break;
default:
logGlobal->error("Error: wrong bonus type (%d) for Scholar!\n", (int)type);
logGlobal->error("Error: wrong bonus type (%d) for Scholar!\n", static_cast<int>(type));
return;
}

View File

@ -219,7 +219,8 @@ const std::map<std::string, CRmgTemplate *> & CMapGenOptions::getAvailableTempla
void CMapGenOptions::finalize(CRandomGenerator & rand)
{
logGlobal->info("RMG settings: players %d, teams %d, computer players %d, computer teams %d, water %d, monsters %d",
(int)getPlayerCount(), (int)getTeamCount(), (int)getCompOnlyPlayerCount(), (int)getCompOnlyTeamCount(), (int)getWaterContent(), (int)getMonsterStrength());
static_cast<int>(getPlayerCount()), static_cast<int>(getTeamCount()), static_cast<int>(getCompOnlyPlayerCount()),
static_cast<int>(getCompOnlyTeamCount()), static_cast<int>(getWaterContent()), static_cast<int>(getMonsterStrength()));
if(!mapTemplate)
{