From 699ef6fdbee977eb07bfc22248b1c554f0d59f2b Mon Sep 17 00:00:00 2001 From: Martin Natano Date: Tue, 31 May 2022 07:35:17 -0700 Subject: [PATCH] Fix incorrect formatting Gets rid of this warning: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int] --- src/GameCommand.cpp | 2 +- src/MenuTimer.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/GameCommand.cpp b/src/GameCommand.cpp index d737c86e5b..4ece4b90fd 100644 --- a/src/GameCommand.cpp +++ b/src/GameCommand.cpp @@ -738,7 +738,7 @@ void GameCommand::ApplySelf( const vector &vpns ) const } break; default: - LuaHelpers::ReportScriptError("Invalid StyleType: " + m_pStyle->m_StyleType); + LuaHelpers::ReportScriptErrorFmt("Invalid StyleType: %d", m_pStyle->m_StyleType); } } if( m_dc != Difficulty_Invalid ) diff --git a/src/MenuTimer.cpp b/src/MenuTimer.cpp index 4dd97774bc..83acbb3c24 100644 --- a/src/MenuTimer.cpp +++ b/src/MenuTimer.cpp @@ -183,9 +183,8 @@ void MenuTimer::SetText( float fSeconds ) LuaHelpers::Push( L, fSeconds ); // call function with 1 argument and 1 result - RString Error= "Error running Text" + (i+1); - Error+= "FormatFunction: "; - LuaHelpers::RunScriptOnStack(L, Error, 1, 1, true); + RString errorMessage = ssprintf("Error running Text%dFormatFunction: ", i+1); + LuaHelpers::RunScriptOnStack(L, errorMessage, 1, 1, true); RString sText; LuaHelpers::Pop( L, sText );