Skip to content

Commit ec879c4

Browse files
committed
Make it easier to set stored limit
1 parent ee3b257 commit ec879c4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

js/screepsstats.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ var ScreepsStats = function () {
99
this.clean()
1010
}
1111

12+
ScreepsStats.prototype.limit = 10
13+
1214
ScreepsStats.prototype.clean = function () {
1315
var recorded = Object.keys(Memory.___screeps_stats)
14-
if(recorded.length > 20) {
16+
if (recorded.length > this.limit) {
1517
recorded.sort()
16-
var limit = recorded.length - 20
17-
for(var i = 0; i < limit; i++) {
18+
var limit = recorded.length - this.limit
19+
for (var i = 0; i < limit; i++) {
1820
this.removeTick(recorded[i])
1921
}
2022
}

0 commit comments

Comments
 (0)