From cc69fa8297e157d96aaa53f79c48febd710fa2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Boutonn=C3=A9?= Date: Thu, 30 Sep 2010 22:22:05 +0000 Subject: [PATCH] HUGO: Improve message boxes - Use OK and YES/NO messages boxes when required - Empty messages are no longer displayed svn-id: r52960 --- engines/hugo/util.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp index 42ae9131d3b..0d439584dbb 100644 --- a/engines/hugo/util.cpp +++ b/engines/hugo/util.cpp @@ -100,12 +100,31 @@ char *Utils::Box(box_t dismiss, const char *s, ...) { vsprintf(buffer, s, marker); // Format string into buffer va_end(marker); - //Warn(false, "BOX: %s", buffer); - int boxTime = strlen(buffer) * 30; - GUI::TimedMessageDialog dialog(buffer, MAX(1500, boxTime)); - dialog.runModal(); + if (buffer[0] == '\0') + return(NULL); + switch(dismiss) { + case BOX_ANY: + case BOX_OK: { + GUI::MessageDialog dialog(buffer, "OK"); + dialog.runModal(); + break; + } + case BOX_YESNO: { + GUI::MessageDialog dialog(buffer, "YES", "NO"); + if (dialog.runModal() == GUI::kMessageOK) + return(buffer); + return 0; + break; + } + case BOX_PROMPT: + warning("Box: unhandled BOX_PROMPT"); + int boxTime = strlen(buffer) * 30; + GUI::TimedMessageDialog dialog(buffer, MAX(1500, boxTime)); + dialog.runModal(); // TODO: Some boxes (i.e. the combination code for the shed), needs to return an input. + } + return buffer; }