Line data Source code
1 : function RandomMapLogger()
2 : {
3 9 : this.taskStarted = false;
4 9 : this.startTime = Engine.GetMicroseconds ? Engine.GetMicroseconds() : 0;
5 9 : this.prefix = ""; // seems noisy
6 :
7 : // Don't print in test cases
8 9 : if (g_MapSettings.Name)
9 0 : this.printDirectly(
10 : this.prefix +
11 : "Generating " + g_MapSettings.Name +
12 : " of size " + g_MapSettings.Size +
13 : " and " + (g_MapSettings.PlayerData.length - 1) + " players.\n");
14 : }
15 :
16 7 : RandomMapLogger.prototype.printDirectly = function(string)
17 : {
18 0 : log(string);
19 0 : print(string);
20 : };
21 :
22 7 : RandomMapLogger.prototype.print = function(string)
23 : {
24 0 : if (this.taskStarted)
25 0 : Engine.ProfileStop();
26 :
27 0 : const text = this.prefix + string;
28 0 : this.printDirectly(text + "...\n");
29 0 : Engine.ProfileStart(text);
30 0 : this.taskStarted = true;
31 : };
32 :
33 7 : RandomMapLogger.prototype.close = function()
34 : {
35 1 : if (this.taskStarted)
36 0 : Engine.ProfileStop();
37 1 : this.printDirectly(this.prefix + "Map generation finished.\n");
38 : };
|