aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/ad/ad_response_box.cpp
diff options
context:
space:
mode:
authorTobia Tesan2013-09-20 14:04:20 +0200
committerTobia Tesan2013-09-21 23:22:27 +0200
commit1361fcde7c0cf0cecb6896288465551d1eb195f9 (patch)
treedfdce0469741b3443ea92e57adf73046d92fce1b /engines/wintermute/ad/ad_response_box.cpp
parent91ebad46d3adc4cf48a14f0f1bbfa9e41e28ecad (diff)
downloadscummvm-rg350-1361fcde7c0cf0cecb6896288465551d1eb195f9.tar.gz
scummvm-rg350-1361fcde7c0cf0cecb6896288465551d1eb195f9.tar.bz2
scummvm-rg350-1361fcde7c0cf0cecb6896288465551d1eb195f9.zip
WINTERMUTE: Avoid feeding setWidth negative values
Diffstat (limited to 'engines/wintermute/ad/ad_response_box.cpp')
-rw-r--r--engines/wintermute/ad/ad_response_box.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 6d513eb851..f9680e99df 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -182,10 +182,12 @@ bool AdResponseBox::createButtons() {
btn->putFont(_responses[i]->getFont());
}
- btn->setWidth(_responseArea.right - _responseArea.left);
- if (btn->getWidth() <= 0) {
- // TODO: This is not very pretty. Should do it at setWidth level, heh?
+ int width = _responseArea.right - _responseArea.left;
+
+ if (width <= 0) {
btn->setWidth(_gameRef->_renderer->getWidth());
+ } else {
+ btn->setWidth(width);
}
}
btn->setName("response");