mirror of https://github.com/OpenTTD/OpenTTD
Codechange: add std::string accepting SetDParamStr to ErrorMessageData
parent
ca9c50607e
commit
e588923bff
|
@ -52,6 +52,7 @@ public:
|
|||
|
||||
void SetDParam(uint n, uint64 v);
|
||||
void SetDParamStr(uint n, const char *str);
|
||||
void SetDParamStr(uint n, const std::string &str);
|
||||
|
||||
void CopyOutDParams();
|
||||
};
|
||||
|
|
|
@ -164,6 +164,16 @@ void ErrorMessageData::SetDParamStr(uint n, const char *str)
|
|||
this->strings[n] = stredup(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a rawstring parameter.
|
||||
* @param n Parameter index
|
||||
* @param str Raw string
|
||||
*/
|
||||
void ErrorMessageData::SetDParamStr(uint n, const std::string &str)
|
||||
{
|
||||
this->SetDParamStr(n, str.c_str());
|
||||
}
|
||||
|
||||
/** Define a queue with errors. */
|
||||
typedef std::list<ErrorMessageData> ErrorList;
|
||||
/** The actual queue with errors. */
|
||||
|
|
|
@ -828,7 +828,7 @@ struct SpriteAlignerWindow : Window {
|
|||
switch (widget) {
|
||||
case WID_SA_CAPTION:
|
||||
SetDParam(0, this->current_sprite);
|
||||
SetDParamStr(1, GetOriginFile(this->current_sprite)->GetSimplifiedFilename().c_str());
|
||||
SetDParamStr(1, GetOriginFile(this->current_sprite)->GetSimplifiedFilename());
|
||||
break;
|
||||
|
||||
case WID_SA_OFFSETS_ABS:
|
||||
|
|
|
@ -707,7 +707,7 @@ int openttd_main(int argc, char *argv[])
|
|||
BaseGraphics::SetSet({});
|
||||
|
||||
ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND);
|
||||
msg.SetDParamStr(0, graphics_set.c_str());
|
||||
msg.SetDParamStr(0, graphics_set);
|
||||
ScheduleErrorMessage(msg);
|
||||
}
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ int openttd_main(int argc, char *argv[])
|
|||
usererror("Failed to find a sounds set. Please acquire a sounds set for OpenTTD. See section 1.4 of README.md.");
|
||||
} else {
|
||||
ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND);
|
||||
msg.SetDParamStr(0, sounds_set.c_str());
|
||||
msg.SetDParamStr(0, sounds_set);
|
||||
ScheduleErrorMessage(msg);
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ int openttd_main(int argc, char *argv[])
|
|||
usererror("Failed to find a music set. Please acquire a music set for OpenTTD. See section 1.4 of README.md.");
|
||||
} else {
|
||||
ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND);
|
||||
msg.SetDParamStr(0, music_set.c_str());
|
||||
msg.SetDParamStr(0, music_set);
|
||||
ScheduleErrorMessage(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ static bool WarnCorruptSprite(const SpriteFile &file, size_t file_pos, int line)
|
|||
{
|
||||
static byte warning_level = 0;
|
||||
if (warning_level == 0) {
|
||||
SetDParamStr(0, file.GetSimplifiedFilename().c_str());
|
||||
SetDParamStr(0, file.GetSimplifiedFilename());
|
||||
ShowErrorMessage(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, WL_ERROR);
|
||||
}
|
||||
DEBUG(sprite, warning_level, "[%i] Loading corrupted sprite from %s at position %i", line, file.GetSimplifiedFilename().c_str(), (int)file_pos);
|
||||
|
|
Loading…
Reference in New Issue