mirror of https://github.com/OpenTTD/OpenTTD
Fix: Make GrfMsg() behave like Debug() when not loading NewGRFs. (#13991)
GrfMsg() outputs the currently loading NewGRF and current line/sprite number. This is invalid when not NewGRFs are not actually being loaded.pull/13992/head
parent
1744156149
commit
34b1f7a992
|
@ -87,7 +87,11 @@ ReferenceThroughBaseContainer<std::vector<GRFTempEngineData>> _gted; ///< Tempo
|
||||||
*/
|
*/
|
||||||
void GrfMsgI(int severity, const std::string &msg)
|
void GrfMsgI(int severity, const std::string &msg)
|
||||||
{
|
{
|
||||||
|
if (_cur_gps.grfconfig == nullptr) {
|
||||||
|
Debug(grf, severity, "{}", msg);
|
||||||
|
} else {
|
||||||
Debug(grf, severity, "[{}:{}] {}", _cur_gps.grfconfig->filename, _cur_gps.nfo_line, msg);
|
Debug(grf, severity, "[{}:{}] {}", _cur_gps.grfconfig->filename, _cur_gps.nfo_line, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,6 +375,7 @@ void GRFUnsafe(ByteReader &)
|
||||||
/** Reset and clear all NewGRFs */
|
/** Reset and clear all NewGRFs */
|
||||||
static void ResetNewGRF()
|
static void ResetNewGRF()
|
||||||
{
|
{
|
||||||
|
_cur_gps.grfconfig = nullptr;
|
||||||
_cur_gps.grffile = nullptr;
|
_cur_gps.grffile = nullptr;
|
||||||
_grf_files.clear();
|
_grf_files.clear();
|
||||||
|
|
||||||
|
@ -1823,6 +1828,10 @@ void LoadNewGRF(SpriteID load_index, uint num_baseset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We've finished reading files. */
|
||||||
|
_cur_gps.grfconfig = nullptr;
|
||||||
|
_cur_gps.grffile = nullptr;
|
||||||
|
|
||||||
/* Pseudo sprite processing is finished; free temporary stuff */
|
/* Pseudo sprite processing is finished; free temporary stuff */
|
||||||
_cur_gps.ClearDataForNextFile();
|
_cur_gps.ClearDataForNextFile();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue