aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-08-16 17:35:59 +0000
committerJohannes Schickel2009-08-16 17:35:59 +0000
commit418fb485c96141c1533b3e0d62fc6836ecf771ec (patch)
treeade680c709e3395e96c3ce59af8bf6f470b1de78
parentce30a513acdaab2ca5eacd136cc80ade1beabb3a (diff)
downloadscummvm-rg350-418fb485c96141c1533b3e0d62fc6836ecf771ec.tar.gz
scummvm-rg350-418fb485c96141c1533b3e0d62fc6836ecf771ec.tar.bz2
scummvm-rg350-418fb485c96141c1533b3e0d62fc6836ecf771ec.zip
Fix format arugments in LoL code. (triggered via -Wformat-security)
svn-id: r43444
-rw-r--r--engines/kyra/gui_lol.cpp42
-rw-r--r--engines/kyra/lol.cpp18
-rw-r--r--engines/kyra/saveload_lol.cpp2
-rw-r--r--engines/kyra/scene_lol.cpp2
-rw-r--r--engines/kyra/sequences_lol.cpp44
-rw-r--r--engines/kyra/sprites_lol.cpp2
6 files changed, 55 insertions, 55 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 5e03f3d9bb..b583db04df 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -127,7 +127,7 @@ void LoLEngine::gui_drawScroll() {
if (_availableSpells[i] == -1)
continue;
uint8 col = (i == _selectedSpell) ? 132 : 1;
- _screen->fprintString(getLangString(_spellProperties[_availableSpells[i]].spellNameCode), 24, y, col, 0, 0);
+ _screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode));
y += 9;
}
}
@@ -138,7 +138,7 @@ void LoLEngine::gui_highlightSelectedSpell(bool mode) {
if (_availableSpells[i] == -1)
continue;
uint8 col = (mode && (i == _selectedSpell)) ? 132 : 1;
- _screen->fprintString(getLangString(_spellProperties[_availableSpells[i]].spellNameCode), 24, y, col, 0, 0);
+ _screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode));
y += 9;
}
}
@@ -165,14 +165,14 @@ void LoLEngine::gui_displayCharInventory(int charNum) {
_screen->copyRegion(80, 143, 80, 143, 232, 35, 0, 2);
gui_drawAllCharPortraitsWithStats();
- _screen->fprintString(l->name, 157, 9, 254, 0, 5);
+ _screen->fprintString("%s", 157, 9, 254, 0, 5, l->name);
gui_printCharInventoryStats(charNum);
for (int i = 0; i < 11; i++)
gui_drawCharInventoryItem(i);
- _screen->fprintString(getLangString(0x4033), 182, 103, 172, 0, 5);
+ _screen->fprintString("%s", 182, 103, 172, 0, 5, getLangString(0x4033));
static const uint16 statusFlags[] = { 0x0080, 0x0000, 0x1000, 0x0002, 0x100, 0x0001, 0x0000, 0x0000 };
@@ -232,14 +232,14 @@ void LoLEngine::gui_printCharacterStats(int index, int redraw, int value) {
y = index * 10 + 22;
col = 158;
if (redraw)
- _screen->fprintString(getLangString(0x4014 + index), offs + 108, y, col, 0, 4);
+ _screen->fprintString("%s", offs + 108, y, col, 0, 4, getLangString(0x4014 + index));
} else {
//skills
int s = index - 2;
y = s * 10 + 62;
col = _characters[_selectedCharacter].flags & (0x200 << s) ? 254 : 180;
if (redraw)
- _screen->fprintString(getLangString(0x4014 + index), offs + 108, y, col, 0, 4);
+ _screen->fprintString("%s", offs + 108, y, col, 0, 4, getLangString(0x4014 + index));
}
if (offs)
@@ -1215,7 +1215,7 @@ int LoLEngine::clickedPortraitEtcRight(Button *button) {
return 1;
}
- _txt->printMessage(2, getLangString((flg & 8) ? 0x4029 : ((flg & 0x10) ? 0x402a : 0x402b)));
+ _txt->printMessage(2, "%s", getLangString((flg & 8) ? 0x4029 : ((flg & 0x10) ? 0x402a : 0x402b)));
return 1;
}
@@ -1235,13 +1235,13 @@ int LoLEngine::clickedCharInventorySlot(Button *button) {
}
if (!f)
- _txt->printMessage(_itemsInPlay[_itemInHand].itemPropertyIndex == 231 ? 2 : 0, getLangString(0x418C));
+ _txt->printMessage(_itemsInPlay[_itemInHand].itemPropertyIndex == 231 ? 2 : 0, "%s", getLangString(0x418C));
return 1;
}
} else {
if (!_characters[_selectedCharacter].items[button->arg]) {
- _txt->printMessage(0, getLangString(_inventorySlotDesc[button->arg] + 8));
+ _txt->printMessage(0, "%s", getLangString(_inventorySlotDesc[button->arg] + 8));
return 1;
}
}
@@ -1506,7 +1506,7 @@ int LoLEngine::clickedSpellTargetCharacter(Button *button) {
int LoLEngine::clickedSpellTargetScene(Button *button) {
LoLCharacter *c = &_characters[_activeSpell.charNum];
- _txt->printMessage(0, getLangString(0x4041));
+ _txt->printMessage(0, "%s", getLangString(0x4041));
c->magicPointsCur += _activeSpell.p->mpRequired[_activeSpell.level];
if (c->magicPointsCur > c->magicPointsMax)
@@ -1633,7 +1633,7 @@ int LoLEngine::clickedRestParty(Button *button) {
_screen->fillRect(112, 0, 288, 120, 1);
gui_drawAllCharPortraitsWithStats();
- _txt->printMessage(0x8000, getLangString(0x4057));
+ _txt->printMessage(0x8000, "%s", getLangString(0x4057));
gui_toggleButtonDisplayMode(77, 0);
int h = 600 / tHp;
@@ -1761,7 +1761,7 @@ int LoLEngine::clickedRestParty(Button *button) {
_partyAwake = true;
updateDrawPage2();
gui_drawScene(0);
- _txt->printMessage(0x8000, getLangString(0x4059));
+ _txt->printMessage(0x8000, "%s", getLangString(0x4059));
_screen->fadeToPalette1(40);
} else {
@@ -1774,12 +1774,12 @@ int LoLEngine::clickedRestParty(Button *button) {
if (needPoisoningFlags & (1 << i))
setTemporaryFaceFrame(i, 3, 8, 0);
}
- _txt->printMessage(0x8000, getLangString(0x405a));
+ _txt->printMessage(0x8000, "%s", getLangString(0x405a));
gui_drawAllCharPortraitsWithStats();
} else {
setTemporaryFaceFrameForAllCharacters(2, 4, 1);
- _txt->printMessage(0x8000, getLangString(0x4058));
+ _txt->printMessage(0x8000, "%s", getLangString(0x4058));
}
gui_toggleButtonDisplayMode(77, 0);
}
@@ -1798,9 +1798,9 @@ int LoLEngine::clickedCompass(Button *button) {
if (_compassBroken) {
if (characterSays(0x425b, -1, true))
- _txt->printMessage(4, getLangString(0x425b));
+ _txt->printMessage(4, "%s", getLangString(0x425b));
} else {
- _txt->printMessage(0, getLangString(0x402f + _currentDirection));
+ _txt->printMessage(0, "%s", getLangString(0x402f + _currentDirection));
}
return 1;
@@ -1824,11 +1824,11 @@ int LoLEngine::clickedLamp(Button *button) {
if (_itemsInPlay[_itemInHand].itemPropertyIndex == 248) {
if (_lampOilStatus >= 100) {
- _txt->printMessage(0, getLangString(0x4061));
+ _txt->printMessage(0, "%s", getLangString(0x4061));
return 1;
}
- _txt->printMessage(0, getLangString(0x4062));
+ _txt->printMessage(0, "%s", getLangString(0x4062));
deleteItem(_itemInHand);
snd_playSoundEffect(181, -1);
@@ -1860,7 +1860,7 @@ int LoLEngine::clickedStatusIcon(Button *button) {
if (str == 0 || str > 3)
return 1;
- _txt->printMessage(0x8002, getLangString(str == 1 ? 0x424c : (str == 2 ? 0x424e : 0x424d)));
+ _txt->printMessage(0x8002, "%s", getLangString(str == 1 ? 0x424c : (str == 2 ? 0x424e : 0x424d)));
return 1;
}
@@ -2386,7 +2386,7 @@ int GUI_LoL::runMenu(Menu &menu) {
fC = _screen->getTextWidth(_saveDescription);
}
- _screen->fprintString(_saveDescription, (d->sx << 3), d->sy + 2, d->unk8, d->unkA, 0);
+ _screen->fprintString("%s", (d->sx << 3), d->sy + 2, d->unk8, d->unkA, 0, _saveDescription);
_screen->fillRect((d->sx << 3) + fC, d->sy, (d->sx << 3) + fC + wW, d->sy + d->h - 1, d->unk8, 0);
_screen->setCurPage(pg);
}
@@ -2485,7 +2485,7 @@ void GUI_LoL::setupSavegameNames(Menu &menu, int num) {
}
void GUI_LoL::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags, Screen::FontId font) {
- _screen->fprintString(str, x, y, c0, c1, flags);
+ _screen->fprintString("%s", x, y, c0, c1, flags, str);
}
int GUI_LoL::getMenuCenterStringX(const char *str, int x1, int x2) {
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index e3d28163a8..816e244531 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1900,7 +1900,7 @@ int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) {
_activeSpell.level = ABS(spellLevel);
if ((_spellProperties[spellType].flags & 0x100) && testWallFlag(calcNewBlockPosition(_currentBlock, _currentDirection), _currentDirection, 1)) {
- _txt->printMessage(2, getLangString(0x4257));
+ _txt->printMessage(2, "%s", getLangString(0x4257));
return 0;
}
@@ -2062,7 +2062,7 @@ int LoLEngine::processMagicSpark(int charNum, int spellLevel) {
}
int LoLEngine::processMagicHealSelectTarget() {
- _txt->printMessage(0, getLangString(0x4040));
+ _txt->printMessage(0, "%s", getLangString(0x4040));
gui_resetButtonList();
gui_setFaceFramesControlButtons(81, 0);
gui_initButtonsFromList(_buttonList8);
@@ -2929,7 +2929,7 @@ void LoLEngine::addSpellToScroll(int spell, int charNum) {
}
if (_availableSpells[i] == spell) {
- _txt->printMessage(2, getLangString(0x42d0));
+ _txt->printMessage(2, "%s", getLangString(0x42d0));
return;
}
}
@@ -2965,7 +2965,7 @@ void LoLEngine::transferSpellToScollAnimation(int charNum, int spell, int slot)
if (_availableSpells[ii] == -1)
continue;
uint8 col = (ii == _selectedSpell) ? 132 : 1;
- _screen->fprintString(getLangString(_spellProperties[_availableSpells[ii]].spellNameCode), 24, y, col, 0, 0);
+ _screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[ii]].spellNameCode));
y += 9;
}
@@ -3459,7 +3459,7 @@ void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, in
if (t) {
giveItemToMonster(monster, t);
if (characterSays(0x4019, _characters[target].id, true))
- _txt->printMessage(6, getLangString(0x4019));
+ _txt->printMessage(6, "%s", getLangString(0x4019));
}
break;
@@ -3473,7 +3473,7 @@ void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, in
if (t) {
deleteItem(t);
if (characterSays(0x401b, _characters[target].id, true))
- _txt->printMessage(6, getLangString(0x401b));
+ _txt->printMessage(6, "%s", getLangString(0x401b));
}
break;
@@ -3541,12 +3541,12 @@ void LoLEngine::applyMonsterDefenseSkill(MonsterInPlay *monster, int16 attacker,
if (monster->properties->defenseSkillType == 1) {
giveItemToMonster(monster, itm);
if (characterSays(0x401c, _characters[attacker].id, true))
- _txt->printMessage(6, getLangString(0x401c));
+ _txt->printMessage(6, "%s", getLangString(0x401c));
} else {
deleteItem(itm);
if (characterSays(0x401d, _characters[attacker].id, true))
- _txt->printMessage(6, getLangString(0x401d));
+ _txt->printMessage(6, "%s", getLangString(0x401d));
}
}
break;
@@ -4315,7 +4315,7 @@ void LoLEngine::printMapText(uint16 stringId, int x, int y) {
void LoLEngine::printMapExitButtonText() {
int cp = _screen->setCurPage(2);
- _screen->fprintString(getLangString(0x4033), 295, 182, 172, 0, 5);
+ _screen->fprintString("%s", 295, 182, 172, 0, 5, getLangString(0x4033));
_screen->setCurPage(cp);
}
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index c72e2c46c0..30fc055a60 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -43,7 +43,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
SaveHeader header;
Common::InSaveFile *saveFile = openSaveForReading(fileName, header);
if (!saveFile) {
- _txt->printMessage(2, getLangString(0x425d));
+ _txt->printMessage(2, "%s", getLangString(0x425d));
return Common::kNoError;
}
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 32ee7a4d77..4a07072270 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -762,7 +762,7 @@ void LoLEngine::notifyBlockNotPassable(int scrollFlag) {
movePartySmoothScrollBlocked(2);
snd_stopSpeech(true);
- _txt->printMessage(0x8002, getLangString(0x403f));
+ _txt->printMessage(0x8002, "%s", getLangString(0x403f));
snd_playSoundEffect(19, -1);
}
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index ae23d130ef..c1ceba34e9 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -290,7 +290,7 @@ int LoLEngine::chooseCharacter() {
_screen->_curPage = 2;
for (int i = 0; i < 4; ++i)
- _screen->fprintStringIntro(_charPreviews[i].name, _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120);
+ _screen->fprintStringIntro("%s", _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120, _charPreviews[i].name);
for (int i = 0; i < 4; ++i) {
_screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 48, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[0]);
@@ -298,9 +298,9 @@ int LoLEngine::chooseCharacter() {
_screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 64, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[2]);
}
- _screen->fprintStringIntro(_tim->getCTableEntry(51), 36, 173, 0x98, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(53), 36, 181, 0x98, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(55), 36, 189, 0x98, 0x00, 0x9C, 0x20);
+ _screen->fprintStringIntro("%s", 36, 173, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(51));
+ _screen->fprintStringIntro("%s", 36, 181, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(53));
+ _screen->fprintStringIntro("%s", 36, 189, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(55));
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
_screen->_curPage = 0;
@@ -363,11 +363,11 @@ void LoLEngine::kingSelectionIntro() {
_screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK);
int y = 38;
- _screen->fprintStringIntro(_tim->getCTableEntry(57), 8, y, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(58), 8, y + 10, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(59), 8, y + 20, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(60), 8, y + 30, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(61), 8, y + 40, 0x32, 0x00, 0x9C, 0x20);
+ _screen->fprintStringIntro("%s", 8, y, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(57));
+ _screen->fprintStringIntro("%s", 8, y + 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(58));
+ _screen->fprintStringIntro("%s", 8, y + 20, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(59));
+ _screen->fprintStringIntro("%s", 8, y + 30, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(60));
+ _screen->fprintStringIntro("%s", 8, y + 40, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(61));
_sound->voicePlay("KING01", &_speechHandle);
@@ -405,8 +405,8 @@ void LoLEngine::kingSelectionReminder() {
_screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK);
int y = 48;
- _screen->fprintStringIntro(_tim->getCTableEntry(62), 8, y, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(63), 8, y + 10, 0x32, 0x00, 0x9C, 0x20);
+ _screen->fprintStringIntro("%s", 8, y, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(62));
+ _screen->fprintStringIntro("%s", 8, y + 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(63));
_sound->voicePlay("KING02", &_speechHandle);
@@ -540,13 +540,13 @@ int LoLEngine::selectionCharInfo(int character) {
static const uint8 charSelectInfoIdx[] = { 0x1D, 0x22, 0x27, 0x2C };
const int idx = charSelectInfoIdx[character];
- _screen->fprintStringIntro(_tim->getCTableEntry(idx+0), 50, 127, 0x53, 0x00, 0xCF, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(idx+1), 50, 137, 0x53, 0x00, 0xCF, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(idx+2), 50, 147, 0x53, 0x00, 0xCF, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(idx+3), 50, 157, 0x53, 0x00, 0xCF, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(idx+4), 50, 167, 0x53, 0x00, 0xCF, 0x20);
+ _screen->fprintStringIntro("%s", 50, 127, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+0));
+ _screen->fprintStringIntro("%s", 50, 137, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+1));
+ _screen->fprintStringIntro("%s", 50, 147, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+2));
+ _screen->fprintStringIntro("%s", 50, 157, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+3));
+ _screen->fprintStringIntro("%s", 50, 167, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+4));
- _screen->fprintStringIntro(_tim->getCTableEntry(69), 100, 168, 0x32, 0x00, 0xCF, 0x20);
+ _screen->fprintStringIntro("%s", 100, 168, 0x32, 0x00, 0xCF, 0x20, _tim->getCTableEntry(69));
selectionCharInfoIntro(vocFilename);
if (_charSelectionInfoResult == -1) {
@@ -568,11 +568,11 @@ int LoLEngine::selectionCharInfo(int character) {
_screen->copyRegion(48, 127, 48, 160, 272, 35, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->fprintStringIntro(_tim->getCTableEntry(64), 3, 28, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(65), 3, 38, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(66), 3, 48, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(67), 3, 58, 0x32, 0x00, 0x9C, 0x20);
- _screen->fprintStringIntro(_tim->getCTableEntry(68), 3, 68, 0x32, 0x00, 0x9C, 0x20);
+ _screen->fprintStringIntro("%s", 3, 28, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(64));
+ _screen->fprintStringIntro("%s", 3, 38, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(65));
+ _screen->fprintStringIntro("%s", 3, 48, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(66));
+ _screen->fprintStringIntro("%s", 3, 58, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(67));
+ _screen->fprintStringIntro("%s", 3, 68, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(68));
resetSkipFlag();
kingSelectionOutro();
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 9877ceebc4..c88286bdc6 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -1307,7 +1307,7 @@ bool LoLEngine::chasePartyWithDistanceAttacks(MonsterInPlay *monster) {
if (getMonsterDistance(monster->block, _monsters[i].block) < 7)
setMonsterMode(monster, 7);
}
- _txt->printMessage(2, getLangString(0x401a));
+ _txt->printMessage(2, "%s", getLangString(0x401a));
} else if (flyingObject == 4) {
launchMagicViper();