2018-01-29 16:11:11 -08:00
|
|
|
function RandomMapLogger()
|
|
|
|
|
{
|
2026-07-24 07:15:22 -07:00
|
|
|
this.taskStarted = false;
|
2020-01-28 16:30:07 -08:00
|
|
|
this.startTime = Engine.GetMicroseconds ? Engine.GetMicroseconds() : 0;
|
2018-01-29 16:11:11 -08:00
|
|
|
this.prefix = ""; // seems noisy
|
|
|
|
|
|
2020-01-28 16:30:07 -08:00
|
|
|
// Don't print in test cases
|
|
|
|
|
if (g_MapSettings.Name)
|
|
|
|
|
this.printDirectly(
|
|
|
|
|
this.prefix +
|
|
|
|
|
"Generating " + g_MapSettings.Name +
|
|
|
|
|
" of size " + g_MapSettings.Size +
|
|
|
|
|
" and " + (g_MapSettings.PlayerData.length - 1) + " players.\n");
|
2018-01-29 16:11:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RandomMapLogger.prototype.printDirectly = function(string)
|
|
|
|
|
{
|
|
|
|
|
log(string);
|
|
|
|
|
print(string);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
RandomMapLogger.prototype.print = function(string)
|
|
|
|
|
{
|
2026-07-24 07:15:22 -07:00
|
|
|
if (this.taskStarted)
|
|
|
|
|
Engine.ProfileStop();
|
2018-01-29 16:11:11 -08:00
|
|
|
|
2026-07-24 07:15:22 -07:00
|
|
|
const text = this.prefix + string;
|
|
|
|
|
this.printDirectly(text + "...\n");
|
|
|
|
|
Engine.ProfileStart(text);
|
|
|
|
|
this.taskStarted = true;
|
2018-01-29 16:11:11 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
RandomMapLogger.prototype.close = function()
|
|
|
|
|
{
|
2026-07-24 07:15:22 -07:00
|
|
|
if (this.taskStarted)
|
|
|
|
|
Engine.ProfileStop();
|
|
|
|
|
this.printDirectly(this.prefix + "Map generation finished.\n");
|
2018-01-29 16:11:11 -08:00
|
|
|
};
|