Skip to content

Commit

Permalink
SHERLOCK: Safer print()
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Feb 14, 2016
1 parent a12940c commit fde06e3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions engines/sherlock/scalpel/scalpel_user_interface.cpp
Expand Up @@ -501,7 +501,7 @@ void ScalpelUserInterface::toggleButton(uint16 num) {

void ScalpelUserInterface::clearInfo() {
if (_infoFlag) {
_vm->_screen->vgaBar(Common::Rect(IS_3DO ? 33 : 16, INFO_LINE,
_vm->_screen->vgaBar(Common::Rect(IS_3DO ? 33 : 16, INFO_LINE,
SHERLOCK_SCREEN_WIDTH - (IS_3DO ? 33 : 19), INFO_LINE + 10), INFO_BLACK);
_infoFlag = false;
_oldLook = -1;
Expand Down Expand Up @@ -654,16 +654,16 @@ void ScalpelUserInterface::lookScreen(const Common::Point &pt) {

int xStart = (SHERLOCK_SCREEN_WIDTH - x) / 2;
screen.print(Common::Point(xStart, INFO_LINE + 1),
INFO_FOREGROUND, useText1.c_str());
INFO_FOREGROUND, "%s", useText1.c_str());

if (_selector != -1) {
screen.print(Common::Point(xStart + width1, INFO_LINE + 1),
TALK_FOREGROUND, useText2.c_str());
TALK_FOREGROUND, "%s", useText2.c_str());
screen.print(Common::Point(xStart + width1 + width2, INFO_LINE + 1),
INFO_FOREGROUND, useText3.c_str());
INFO_FOREGROUND, "%s", useText3.c_str());
} else {
screen.print(Common::Point(xStart + width1, INFO_LINE + 1),
INFO_FOREGROUND, useText3.c_str());
INFO_FOREGROUND, "%s", useText3.c_str());
}
} else if (temp >= 0 && temp < 1000 && _selector != -1 &&
scene._bgShapes[temp]._aType == PERSON) {
Expand All @@ -686,11 +686,11 @@ void ScalpelUserInterface::lookScreen(const Common::Point &pt) {

int xStart = (SHERLOCK_SCREEN_WIDTH - x) / 2;
screen.print(Common::Point(xStart, INFO_LINE + 1),
INFO_FOREGROUND, giveText1.c_str());
INFO_FOREGROUND, "%s", giveText1.c_str());
screen.print(Common::Point(xStart + width1, INFO_LINE + 1),
TALK_FOREGROUND, giveText2.c_str());
TALK_FOREGROUND, "%s", giveText2.c_str());
screen.print(Common::Point(xStart + width1 + width2, INFO_LINE + 1),
INFO_FOREGROUND, giveText3.c_str());
INFO_FOREGROUND, "%s", giveText3.c_str());
}
} else {
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", tempStr.c_str());
Expand Down Expand Up @@ -927,7 +927,7 @@ void ScalpelUserInterface::doEnvControl() {
} while (saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) && moreKeys);
} else if ((found == 5 && events._released) || _key == saves._hotkeyQuit) {
clearWindow();
screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, saves._fixedTextQuitGameQuestion.c_str());
screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, "%s", saves._fixedTextQuitGameQuestion.c_str());
screen.vgaBar(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + 10), BORDER_COLOR);

screen.makeButton(Common::Rect(112, CONTROLS_Y, 160, CONTROLS_Y + 10), 136, saves._fixedTextQuitGameYes);
Expand Down Expand Up @@ -2252,7 +2252,7 @@ void ScalpelUserInterface::checkUseAction(const UseType *use, const Common::Stri
if (scene._goToScene != 1 && !printed && !talk._talkToAbort) {
_infoFlag = true;
clearInfo();
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, FIXED(UserInterface_Done));
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_Done));
_menuCounter = 25;
}
}
Expand All @@ -2262,9 +2262,9 @@ void ScalpelUserInterface::checkUseAction(const UseType *use, const Common::Stri
clearInfo();

if (giveMode) {
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, FIXED(UserInterface_NoThankYou));
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_NoThankYou));
} else if (fixedTextActionId == kFixedTextAction_Invalid) {
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, FIXED(UserInterface_YouCantDoThat));
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_YouCantDoThat));
} else {
Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, 0);
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", errorMessage.c_str());
Expand Down

0 comments on commit fde06e3

Please sign in to comment.