mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
corrected text in vcmibuilder, corrected errors and warnings from cppcheck
This commit is contained in:
parent
885b495cf4
commit
e73c60740c
@ -678,7 +678,7 @@ void CPlayerInterface::battleStacksHealedRes(const std::vector<std::pair<ui32, u
|
||||
|
||||
//print info about life drain
|
||||
char textBuf[1000];
|
||||
sprintf(textBuf, CGI->generaltexth->allTexts[361 + textOff].c_str(), attacker->getCreature()->nameSing.c_str(),
|
||||
snprintf(textBuf, 1000, CGI->generaltexth->allTexts[361 + textOff].c_str(), attacker->getCreature()->nameSing.c_str(),
|
||||
healedStacks[0].second, defender->getCreature()->namePl.c_str());
|
||||
battleInt->console->addText(textBuf);
|
||||
}
|
||||
|
@ -832,7 +832,7 @@ void CBattleInterface::bFleef()
|
||||
heroName = defendingHeroInstance->name;
|
||||
//calculating text
|
||||
char buffer[1000];
|
||||
sprintf(buffer, CGI->generaltexth->allTexts[340].c_str(), heroName.c_str()); //The Shackles of War are present. %s can not retreat!
|
||||
snprintf(buffer, 1000, CGI->generaltexth->allTexts[340].c_str(), heroName.c_str()); //The Shackles of War are present. %s can not retreat!
|
||||
|
||||
//printing message
|
||||
curInt->showInfoDialog(std::string(buffer), comps);
|
||||
@ -1523,7 +1523,7 @@ void CBattleInterface::battleStacksEffectsSet(const SetStackEffect & sse)
|
||||
BonusList defenseBonuses = *(stack->getBonuses(Selector::typeSubtype(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE)));
|
||||
defenseBonuses.remove_if(Selector::durationType(Bonus::STACK_GETS_TURN)); //remove bonuses gained from defensive stance
|
||||
int val = stack->Defense() - defenseBonuses.totalValue();
|
||||
sprintf(txt, CGI->generaltexth->allTexts[txtid].c_str(), (stack->count != 1) ? stack->getCreature()->namePl.c_str() : stack->getCreature()->nameSing.c_str(), val);
|
||||
sprintf(txt, 4000, CGI->generaltexth->allTexts[txtid].c_str(), (stack->count != 1) ? stack->getCreature()->namePl.c_str() : stack->getCreature()->nameSing.c_str(), val);
|
||||
console->addText(txt);
|
||||
}
|
||||
}
|
||||
@ -1797,19 +1797,19 @@ void CBattleInterface::printConsoleAttacked( const CStack * defender, int dmg, i
|
||||
int end = 0;
|
||||
if (attacker) //ignore if stacks were killed by spell
|
||||
{
|
||||
end = sprintf(tabh, CGI->generaltexth->allTexts[attacker->count > 1 ? 377 : 376].c_str(),
|
||||
end = snprintf(tabh, 200, CGI->generaltexth->allTexts[attacker->count > 1 ? 377 : 376].c_str(),
|
||||
(attacker->count > 1 ? attacker->getCreature()->namePl.c_str() : attacker->getCreature()->nameSing.c_str()), dmg);
|
||||
}
|
||||
if(killed > 0)
|
||||
{
|
||||
if(killed > 1)
|
||||
{
|
||||
sprintf(tabh + end, CGI->generaltexth->allTexts[379].c_str(), killed,
|
||||
snprintf(tabh + end, 400, CGI->generaltexth->allTexts[379].c_str(), killed,
|
||||
multiple ? CGI->generaltexth->allTexts[43].c_str() : defender->getCreature()->namePl.c_str()); // creatures perish
|
||||
}
|
||||
else //killed == 1
|
||||
{
|
||||
sprintf(tabh + end, CGI->generaltexth->allTexts[378].c_str(),
|
||||
snprintf(tabh + end, 400, CGI->generaltexth->allTexts[378].c_str(),
|
||||
multiple ? CGI->generaltexth->allTexts[42].c_str() : defender->getCreature()->nameSing.c_str()); // creature perishes
|
||||
}
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ void CClickableHex::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
||||
{
|
||||
char tabh[160];
|
||||
const std::string & attackedName = attackedStack->count == 1 ? attackedStack->getCreature()->nameSing : attackedStack->getCreature()->namePl;
|
||||
sprintf(tabh, CGI->generaltexth->allTexts[220].c_str(), attackedName.c_str());
|
||||
snprintf(tabh, 160, CGI->generaltexth->allTexts[220].c_str(), attackedName.c_str());
|
||||
myInterface->console->alterTxt = std::string(tabh);
|
||||
setAlterText = true;
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void MoraleLuckBox::set(const IBonusBearer *node)
|
||||
else
|
||||
{
|
||||
//it's a creature window
|
||||
if ((morale && node->hasBonusOfType(Bonus::UNDEAD)) ||
|
||||
if ((morale && node && node->hasBonusOfType(Bonus::UNDEAD)) ||
|
||||
node->hasBonusOfType(Bonus::BLOCK_MORALE) || node->hasBonusOfType(Bonus::NON_LIVING))
|
||||
{
|
||||
text += CGI->generaltexth->arraytxt[113]; //unaffected by morale
|
||||
|
@ -1378,11 +1378,11 @@ AttackableTiles CBattleInfoCallback::getPotentiallyAttackableHexes (const CStack
|
||||
case -WN: //-17 //left-up or right-up
|
||||
case WN + 1: //18 //right-down
|
||||
case -WN + 1: //-16 //right-up
|
||||
BattleHex::checkAndPush (destinationTile.hex + pseudoVector + ((hex/WN)%2 ? 1 : -1 ), hexes);
|
||||
BattleHex::checkAndPush (destinationTile.hex + pseudoVector + (((hex/WN)%2) ? 1 : -1 ), hexes);
|
||||
break;
|
||||
case WN-1: //16 //left-down
|
||||
case -WN-1: //-18 //left-up
|
||||
BattleHex::checkAndPush (destinationTile.hex + pseudoVector + ((hex/WN)%2 ? 1 : 0), hexes);
|
||||
BattleHex::checkAndPush (destinationTile.hex + pseudoVector + (((hex/WN)%2) ? 1 : 0), hexes);
|
||||
break;
|
||||
}
|
||||
for (BattleHex tile : hexes)
|
||||
@ -1819,7 +1819,6 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleCanCastThisSpell
|
||||
case CSpell::NEUTRAL:
|
||||
targetExists = true;
|
||||
break;
|
||||
break;
|
||||
case CSpell::NEGATIVE:
|
||||
if(!casterStack || !ti.smart)
|
||||
{
|
||||
|
@ -478,7 +478,7 @@ std::vector<CTypeList::TypeInfoPtr> CTypeList::castSequence(TypeInfoPtr from, Ty
|
||||
std::map<TypeInfoPtr, TypeInfoPtr> previous;
|
||||
std::queue<TypeInfoPtr> q;
|
||||
q.push(to);
|
||||
while(q.size())
|
||||
while(!q.empty())
|
||||
{
|
||||
auto typeNode = q.front();
|
||||
q.pop();
|
||||
|
@ -677,7 +677,7 @@ void CGBonusingObject::initObj()
|
||||
for (int i=0; i<6; i++)
|
||||
{
|
||||
info[i].limiter.dayOfWeek = i+1;
|
||||
configureBonus(info[i], i%2 ? Bonus::MORALE : Bonus::LUCK, 1, 68);
|
||||
configureBonus(info[i], (i%2) ? Bonus::MORALE : Bonus::LUCK, 1, 68);
|
||||
info[i].message.addTxt(MetaString::ADVOB_TXT, 62);
|
||||
soundID = soundBase::experience;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ void CRmgTemplateZone::fractalize(CMapGenerator* gen)
|
||||
}
|
||||
assert (clearedTiles.size()); //this should come from zone connections
|
||||
|
||||
while (possibleTiles.size())
|
||||
while (!possibleTiles.empty())
|
||||
{
|
||||
//link tiles in random order
|
||||
std::vector<int3> tilesToMakePath(possibleTiles.begin(), possibleTiles.end());
|
||||
@ -811,7 +811,7 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos, float
|
||||
}
|
||||
}
|
||||
|
||||
if (treasures.size())
|
||||
if (!treasures.empty())
|
||||
{
|
||||
//find object closest to zone center, then connect it to the middle of the zone
|
||||
int3 closestFreeTile (-1,-1,-1);
|
||||
@ -2000,7 +2000,7 @@ void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen)
|
||||
{
|
||||
creaturesAmount = boost::math::round(creaturesAmount / 5) * 5;
|
||||
}
|
||||
else if (creaturesAmount <= 12)
|
||||
else if (creaturesAmount <= 120)
|
||||
{
|
||||
creaturesAmount = boost::math::round(creaturesAmount / 10) * 10;
|
||||
}
|
||||
@ -2070,12 +2070,16 @@ void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen)
|
||||
{
|
||||
case 1:
|
||||
school = spell->air;
|
||||
break;
|
||||
case 2:
|
||||
school = spell->earth;
|
||||
break;
|
||||
case 3:
|
||||
school = spell->fire;
|
||||
break;
|
||||
case 4:
|
||||
school = spell->water;
|
||||
break;
|
||||
}
|
||||
if (school)
|
||||
spells.push_back(spell);
|
||||
|
@ -3389,7 +3389,7 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
break;
|
||||
}
|
||||
|
||||
if(destinationStack && stack->ID == destinationStack->ID) //we should just move, it will be handled by following check
|
||||
if(destinationStack && stack && stack->ID == destinationStack->ID) //we should just move, it will be handled by following check
|
||||
{
|
||||
destinationStack = nullptr;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ then
|
||||
# echo " --download " "Automatically download optional package using wget"
|
||||
# echo " " "Requires wget and Internet connection"
|
||||
# echo
|
||||
echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is ~/.vcmi"
|
||||
echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is ~/.local/share/vcmi"
|
||||
echo
|
||||
echo " --validate " "Run basic validness checks"
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user