From 90b6cdfbdff3e75a034c748d6d8784a0df7f5db4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 7 Nov 2010 01:03:03 +0000 Subject: LURE: Remove all uses of (f)printf; cleanup svn-id: r54106 --- engines/lure/res_struct.cpp | 65 +++++++++++---------------------------------- 1 file changed, 15 insertions(+), 50 deletions(-) (limited to 'engines/lure/res_struct.cpp') diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 9ef595b30f..f6a2092ddc 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -1439,77 +1439,42 @@ CurrentActionEntry *CurrentActionEntry::loadFromStream(Common::ReadStream *strea return result; } -void CurrentActionStack::list(char *buffer) { - ActionsList::iterator i; +Common::String CurrentActionStack::getDebugInfo() const { + Common::String buffer; + ActionsList::const_iterator i; - if (buffer) { - sprintf(buffer, "CurrentActionStack::list num_actions=%d\n", size()); - buffer += strlen(buffer); - } - else - printf("CurrentActionStack::list num_actions=%d\n", size()); + buffer += Common::String::format("CurrentActionStack::list num_actions=%d\n", size()); for (i = _actions.begin(); i != _actions.end(); ++i) { CurrentActionEntry *entry = (*i).get(); - if (buffer) { - sprintf(buffer, "style=%d room#=%d", entry->action(), entry->roomNumber()); - buffer += strlen(buffer); - } - else - printf("style=%d room#=%d", entry->action(), entry->roomNumber()); + buffer += Common::String::format("style=%d room#=%d", entry->action(), entry->roomNumber()); if (entry->hasSupportData()) { CharacterScheduleEntry &rec = entry->supportData(); - if (buffer) { - sprintf(buffer, ", action=%d params=", rec.action()); - buffer += strlen(buffer); - } - else - printf(", action=%d params=", rec.action()); + buffer += Common::String::format(", action=%d params=", rec.action()); if (rec.numParams() == 0) - if (buffer) { - strcat(buffer, "none"); - buffer += strlen(buffer); - } - else - printf("none"); + buffer += "none"; else { - for (int ctr = 0; ctr < rec.numParams(); ++ctr) { - if (ctr != 0) { - if (buffer) { - strcpy(buffer, ", "); - buffer += strlen(buffer); - } - else - printf(", "); - } - - if (buffer) { - sprintf(buffer, "%d", rec.param(ctr)); - buffer += strlen(buffer); - } else - printf("%d", rec.param(ctr)); + buffer += Common::String::format("%d", rec.param(0)); + for (int ctr = 1; ctr < rec.numParams(); ++ctr) { + buffer += Common::String::format(", %d", rec.param(ctr)); } } } - if (buffer) { - sprintf(buffer, "\n"); - buffer += strlen(buffer); - } - else - printf("\n"); + buffer += "\n"; } + + return buffer; } void CurrentActionStack::saveToStream(Common::WriteStream *stream) { ActionsList::iterator i; debugC(ERROR_DETAILED, kLureDebugAnimations, "Saving hotspot action stack"); - char buffer[MAX_DESC_SIZE]; - list(buffer); - debugC(ERROR_DETAILED, kLureDebugAnimations, "%s", buffer); + Common::String buffer = getDebugInfo(); + debugC(ERROR_DETAILED, kLureDebugAnimations, "%s", buffer.c_str()); for (i = _actions.begin(); i != _actions.end(); ++i) { CurrentActionEntry *rec = (*i).get(); -- cgit v1.2.3