aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
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
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')
-rw-r--r--engines/wintermute/ad/ad_response_box.cpp8
-rw-r--r--engines/wintermute/ui/ui_object.cpp6
2 files changed, 7 insertions, 7 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");
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index e4bcb2aa6b..0824f1f9bd 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -657,14 +657,12 @@ int32 UIObject::getHeight() {
}
void UIObject::setWidth(int32 width) {
- // assert (width >= 0);
- // This would be ideal, but ATM must be failing pretty much everywhere.
+ assert (width >= 0);
_width = width;
}
void UIObject::setHeight(int32 height) {
- // assert (height >= 0);
- // This would be ideal, but ATM must be failing pretty much everywhere.
+ assert (height >= 0);
_height = height;
}