Update to 12.0-beta1

This commit is contained in:
dP
2021-08-15 14:57:29 +03:00
parent ac7d3eba75
commit 9df4f2c4fc
666 changed files with 61302 additions and 20466 deletions

View File

@@ -13,9 +13,9 @@
#include "string_func.h"
#include "console_func.h"
#include "spritecache.h"
#include "walltime_func.h"
#include <chrono>
#include <time.h>
std::vector<NewGRFProfiler> _newgrf_profilers;
@@ -95,12 +95,12 @@ uint32 NewGRFProfiler::Finish()
if (!this->active) return 0;
if (this->calls.empty()) {
IConsolePrintF(CC_DEBUG, "Finished profile of NewGRF [%08X], no events collected, not writing a file", BSWAP32(this->grffile->grfid));
IConsolePrint(CC_DEBUG, "Finished profile of NewGRF [{:08X}], no events collected, not writing a file.", BSWAP32(this->grffile->grfid));
return 0;
}
std::string filename = this->GetOutputFilename();
IConsolePrintF(CC_DEBUG, "Finished profile of NewGRF [%08X], writing %u events to %s", BSWAP32(this->grffile->grfid), (uint)this->calls.size(), filename.c_str());
IConsolePrint(CC_DEBUG, "Finished profile of NewGRF [{:08X}], writing {} events to '{}'.", BSWAP32(this->grffile->grfid), this->calls.size(), filename);
FILE *f = FioFOpenFile(filename, "wt", Subdirectory::NO_DIRECTORY);
FileCloser fcloser(f);
@@ -130,10 +130,8 @@ void NewGRFProfiler::Abort()
*/
std::string NewGRFProfiler::GetOutputFilename() const
{
time_t write_time = time(nullptr);
char timestamp[16] = {};
strftime(timestamp, lengthof(timestamp), "%Y%m%d-%H%M", localtime(&write_time));
LocalTime::Format(timestamp, lastof(timestamp), "%Y%m%d-%H%M");
char filepath[MAX_PATH] = {};
seprintf(filepath, lastof(filepath), "%sgrfprofile-%s-%08X.csv", FiosGetScreenshotDir(), timestamp, BSWAP32(this->grffile->grfid));
@@ -153,7 +151,7 @@ uint32 NewGRFProfiler::FinishAll()
}
if (total_microseconds > 0 && max_ticks > 0) {
IConsolePrintF(CC_DEBUG, "Total NewGRF callback processing: %u microseconds over %d ticks", total_microseconds, max_ticks);
IConsolePrint(CC_DEBUG, "Total NewGRF callback processing: {} microseconds over {} ticks.", total_microseconds, max_ticks);
}
_newgrf_profile_end_date = MAX_DAY;