diff options
| author | D G Turner | 2019-09-15 18:15:19 +0100 |
|---|---|---|
| committer | D G Turner | 2019-09-15 18:15:19 +0100 |
| commit | 28fe02eb305d3de8e3e2da5791b0f7c74d68c255 (patch) | |
| tree | 2d6b5dc929b3bb0d4faec67fd4ced43bdae2324a /engines/toon/character.cpp | |
| parent | 04242ce829bd55f03e084b85a23055b23e598fb6 (diff) | |
| download | scummvm-rg350-28fe02eb305d3de8e3e2da5791b0f7c74d68c255.tar.gz scummvm-rg350-28fe02eb305d3de8e3e2da5791b0f7c74d68c255.tar.bz2 scummvm-rg350-28fe02eb305d3de8e3e2da5791b0f7c74d68c255.zip | |
TOON: Replace Various String Functions with Common String Usage
This removes the dependency on the unsafe strcpy and strcat string
functions with usage of Common::String instead.
Diffstat (limited to 'engines/toon/character.cpp')
| -rw-r--r-- | engines/toon/character.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 3d7beeeafe..84b67cc52e 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -1020,8 +1020,7 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { // get the anim to load const SpecialCharacterAnimation *anim = getSpecialAnimation(_id, animId); - char animName[20]; - strcpy(animName, anim->_filename); + Common::String animNameStr = anim->_filename; int32 facing = _facing; if (_id == 1) { @@ -1029,9 +1028,8 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { facing = CharacterFlux::fixFacingForAnimation(facing, animId); } - if (strchr(animName, '?')) - *strchr(animName, '?') = '0' + facing; - strcat(animName, ".CAF"); + Common::replace(animNameStr, Common::String('?'), Common::String('0' + facing)); + animNameStr += ".CAF"; if (_animScriptId != -1 && (flags & 8) == 0) _vm->getSceneAnimationScript(_animScriptId)->_frozenForConversation = true; @@ -1046,7 +1044,7 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { _flags |= 1; // old special anim was talking anim ? in this case we don't wait for the character to be ready - bool wasTalkAnim = _specialAnim && strstr(_specialAnim->_name, "TLK"); + bool wasTalkAnim = _specialAnim && Common::String(_specialAnim->_name).contains("TLK"); // wait for the character to be ready while (_animScriptId != -1 && _animationInstance && _animationInstance->getFrame() > 0 && !wasTalkAnim && (_specialAnim && _animationInstance->getAnimation() != _specialAnim)) { @@ -1061,7 +1059,7 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { delete _specialAnim; _specialAnim = new Animation(_vm); - _specialAnim->loadAnimation(animName); + _specialAnim->loadAnimation(animNameStr.c_str()); _animSpecialId = animId; |
