@@ -20437,35 +20437,37 @@ void sexp_string_set_substring(int node)
2043720437void sexp_debug(int node)
2043820438{
2043920439 int i;
20440- char *id;
20441- char temp_buf[MESSAGE_LENGTH] = {""};
20440+ SCP_string warning_message;
2044220441
2044320442 #ifdef NDEBUG
2044420443 int no_release_message;
2044520444 no_release_message = is_sexp_true(node);
2044620445 #endif
2044720446
2044820447 node = CDR(node);
20449- Assertion (node >= 0, "No message defined in debug SEXP");
20450- id = CTEXT(node);
20451- strcpy_s(temp_buf, id);
20448+ Assertion (node >= 0, "No message defined in debug SEXP");
2045220449
20450+ // we'll suppose it's the string for now
20451+ warning_message = CTEXT(node);
20452+
20453+ // but use an actual message if one exists
2045320454 for (i=0; i<Num_messages; i++) {
2045420455 // find the message
20455- if ( !stricmp(id, Messages[i].name) ) {
20456- //replace variables if necessary
20457- strcpy_s(temp_buf, Messages[i].message);
20458- sexp_replace_variable_names_with_values(temp_buf, MESSAGE_LENGTH);
20456+ if ( !stricmp(Messages[i].name, warning_message.c_str()) ) {
20457+ warning_message = Messages[i].message;
2045920458 break;
2046020459 }
2046120460 }
2046220461
20462+ // replace variables if necessary
20463+ sexp_replace_variable_names_with_values(warning_message);
20464+
2046320465 //send the message
2046420466 #ifndef NDEBUG
20465- Warning(LOCATION, "%s", temp_buf );
20467+ Warning(LOCATION, "%s", warning_message.c_str() );
2046620468 #else
2046720469 if (!no_release_message) {
20468- ReleaseWarning(LOCATION, "%s", temp_buf );
20470+ ReleaseWarning(LOCATION, "%s", warning_message.c_str() );
2046920471 }
2047020472 #endif
2047120473}
0 commit comments