aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2006-06-16 19:34:16 +0000
committerEugene Sandulenko2006-06-16 19:34:16 +0000
commitf1831b8b5ded1830a8947de280daa4c7d995cde1 (patch)
treeaebc79a8361ff007ec49d4ef014e14baa55d509d
parent9e21960e934fc434b4cb83dd27af285508982cf8 (diff)
downloadscummvm-rg350-f1831b8b5ded1830a8947de280daa4c7d995cde1.tar.gz
scummvm-rg350-f1831b8b5ded1830a8947de280daa4c7d995cde1.tar.bz2
scummvm-rg350-f1831b8b5ded1830a8947de280daa4c7d995cde1.zip
Fix gcc warning.
svn-id: r23149
-rw-r--r--engines/saga/actor.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp
index 2785acaee0..8128d70307 100644
--- a/engines/saga/actor.cpp
+++ b/engines/saga/actor.cpp
@@ -1797,14 +1797,13 @@ void Actor::drawSpeech(void) {
char *outputString;
backBuffer = _vm->_gfx->getBackBuffer();
+ stringLength = strlen(_activeSpeech.strings[0]);
+ outputString = (char*)calloc(stringLength + 1, 1);
- if (_activeSpeech.speechFlags & kSpeakSlow) {
- stringLength = strlen(_activeSpeech.strings[0]);
- outputString = (char*)calloc(stringLength + 1, 1);
+ if (_activeSpeech.speechFlags & kSpeakSlow)
strncpy(outputString, _activeSpeech.strings[0], _activeSpeech.slowModeCharIndex + 1);
- } else {
- outputString = (char*)_activeSpeech.strings[0];
- }
+ else
+ strncpy(outputString, _activeSpeech.strings[0], stringLength);
if (_activeSpeech.actorsCount > 1) {
height = _vm->_font->getHeight(kKnownFontScript);
@@ -1824,9 +1823,8 @@ void Actor::drawSpeech(void) {
_vm->_font->textDrawRect(kKnownFontScript, backBuffer, outputString, _activeSpeech.drawRect, _activeSpeech.speechColor[0],
_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
}
- if (_activeSpeech.speechFlags & kSpeakSlow) {
- free(outputString);
- }
+
+ free(outputString);
}
bool Actor::followProtagonist(ActorData *actor) {