diff options
author | Denis Kasak | 2009-09-26 13:47:32 +0000 |
---|---|---|
committer | Denis Kasak | 2009-09-26 13:47:32 +0000 |
commit | 27a638fa824b624f425c3f548255b0736ddd9f6d (patch) | |
tree | 5146553e8ee7a39926a5c11f14bcfda8368480a4 /engines/draci | |
parent | 84accad507657e636789d23fe457dca6f3447c23 (diff) | |
download | scummvm-rg350-27a638fa824b624f425c3f548255b0736ddd9f6d.tar.gz scummvm-rg350-27a638fa824b624f425c3f548255b0736ddd9f6d.tar.bz2 scummvm-rg350-27a638fa824b624f425c3f548255b0736ddd9f6d.zip |
draci: Fixed bug in Surface::centerOn{X,Y}() which made it return a negative coordinate for strings that are too long. Resolves the crash caused by the English data files containing strings which are improperly line-breaked. Ideally, the engine should do the line-breaking itself when the string does not fit.
svn-id: r44376
Diffstat (limited to 'engines/draci')
-rw-r--r-- | engines/draci/surface.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp index 12fabd2ec3..4f97ee75c8 100644 --- a/engines/draci/surface.cpp +++ b/engines/draci/surface.cpp @@ -144,6 +144,9 @@ uint Surface::centerOnX(uint x, uint width) const { if (newX + width >= (uint)w - 1) newX = (w - 1) - width; + if (newX < 0) + newX = 0; + return newX; } @@ -165,6 +168,9 @@ uint Surface::centerOnY(uint y, uint height) const { if (newY + height >= (uint)h - 1) newY = (h - 1) - height; + if (newY < 0) + newY = 0; + return newY; } |