From 27a638fa824b624f425c3f548255b0736ddd9f6d Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Sat, 26 Sep 2009 13:47:32 +0000 Subject: 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 --- engines/draci/surface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines/draci') 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; } -- cgit v1.2.3