Codechange: use GetString + StrMakeValid to pass string without colours/font sizes to Debug

This commit is contained in:
Rubidium 2023-05-19 14:35:10 +02:00 committed by rubidium42
parent 00695c29de
commit 1a179cb297
2 changed files with 5 additions and 12 deletions

View File

@ -27,6 +27,7 @@
#include "company_base.h" #include "company_base.h"
#include "error.h" #include "error.h"
#include "strings_func.h" #include "strings_func.h"
#include "string_func.h"
#include "table/strings.h" #include "table/strings.h"
@ -508,16 +509,12 @@ void ErrorUnknownCallbackResult(uint32 grfid, uint16 cbid, uint16 cb_res)
} }
/* debug output */ /* debug output */
char buffer[512];
SetDParamStr(0, grfconfig->GetName()); SetDParamStr(0, grfconfig->GetName());
GetString(buffer, STR_NEWGRF_BUGGY, lastof(buffer)); Debug(grf, 0, "{}", StrMakeValid(GetString(STR_NEWGRF_BUGGY)));
Debug(grf, 0, "{}", buffer + 3);
SetDParam(1, cbid); SetDParam(1, cbid);
SetDParam(2, cb_res); SetDParam(2, cb_res);
GetString(buffer, STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT, lastof(buffer)); Debug(grf, 0, "{}", StrMakeValid(GetString(STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT)));
Debug(grf, 0, "{}", buffer + 3);
} }
/** /**

View File

@ -315,15 +315,11 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF
} }
/* debug output */ /* debug output */
char buffer[512];
SetDParamStr(0, grfconfig->GetName()); SetDParamStr(0, grfconfig->GetName());
GetString(buffer, part1, lastof(buffer)); Debug(grf, 0, "{}", StrMakeValid(GetString(part1)));
Debug(grf, 0, "{}", buffer + 3);
SetDParam(1, engine); SetDParam(1, engine);
GetString(buffer, part2, lastof(buffer)); Debug(grf, 0, "{}", StrMakeValid(GetString(part2)));
Debug(grf, 0, "{}", buffer + 3);
} }
/** /**