aboutsummaryrefslogtreecommitdiff
path: root/engines/hugo/util.cpp
diff options
context:
space:
mode:
authorMax Horn2011-03-21 13:07:23 +0100
committerMax Horn2011-03-21 13:16:35 +0100
commitdd88f39bc7078f96fd06170260bf2ff332b4ca82 (patch)
tree70a275709fb034bd9efba96bbd1a5dffcc5d4c8e /engines/hugo/util.cpp
parent458ebbafd25d729da88eced603a88af9a05b79b3 (diff)
downloadscummvm-rg350-dd88f39bc7078f96fd06170260bf2ff332b4ca82.tar.gz
scummvm-rg350-dd88f39bc7078f96fd06170260bf2ff332b4ca82.tar.bz2
scummvm-rg350-dd88f39bc7078f96fd06170260bf2ff332b4ca82.zip
HUGO: Replace Utils::Box by Utils::notifyBox + Common::String::format
Diffstat (limited to 'engines/hugo/util.cpp')
-rw-r--r--engines/hugo/util.cpp51
1 files changed, 9 insertions, 42 deletions
diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp
index 88a3be8a75..044b58e986 100644
--- a/engines/hugo/util.cpp
+++ b/engines/hugo/util.cpp
@@ -43,11 +43,6 @@ namespace Hugo {
namespace Utils {
-enum {
- kMaxStrLength = 1024
-};
-
-
/**
* Returns index (0 to 7) of first 1 in supplied byte, or 8 if not found
*/
@@ -96,52 +91,24 @@ void reverseByte(byte *data) {
*data = result;
}
-void Box(box_t dismiss, const char *s, ...) {
- static char buffer[kMaxStrLength + 1]; // Format text into this
-
- if (!s)
- return; // NULL strings catered for
-
- if (s[0] == '\0')
+void notifyBox(const Common::String &msg) {
+ if (msg.empty())
return;
- if (strlen(s) > kMaxStrLength - 100) { // Test length
- warning("String too long: '%s'", s);
- return;
- }
-
- va_list marker;
- va_start(marker, s);
- vsprintf(buffer, s, marker); // Format string into buffer
- va_end(marker);
-
- if (buffer[0] == '\0')
- return;
-
- switch(dismiss) {
- case kBoxAny:
- case kBoxOk: {
- GUI::MessageDialog dialog(buffer, "OK");
- dialog.runModal();
- break;
- }
- default:
- error("Unknown BOX Type %d", dismiss);
- }
-
- return;
+ GUI::MessageDialog dialog(msg, "OK");
+ dialog.runModal();
}
-Common::String promptBox(const char *msg) {
- if (!msg || !*msg)
- return 0;
+Common::String promptBox(const Common::String &msg) {
+ if (msg.empty())
+ return Common::String();
EntryDialog dialog(msg, "OK", "");
return dialog.getEditString();
}
-bool yesNoBox(const char *msg) {
- if (!msg || !*msg)
+bool yesNoBox(const Common::String &msg) {
+ if (msg.empty())
return 0;
GUI::MessageDialog dialog(msg, "YES", "NO");