mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 15:17:36 +00:00
Merge pull request #258 from a-sync/hotfix/patch-1
bugfix for Players/Results
This commit is contained in:
commit
c46e8efb0d
1 changed files with 13 additions and 5 deletions
|
|
@ -19,7 +19,7 @@ class Players extends Array {
|
|||
// run out of ram allocating these objects.
|
||||
num = Math.min(num, 10000);
|
||||
|
||||
while(this.players.length < num) {
|
||||
while(this.length < num) {
|
||||
this.push({});
|
||||
}
|
||||
}
|
||||
|
|
@ -40,11 +40,19 @@ class Results {
|
|||
players = new Players();
|
||||
bots = new Players();
|
||||
|
||||
set players(num) {
|
||||
this.players.setNum(num);
|
||||
set players(val) {
|
||||
if (typeof val === 'number') {
|
||||
this.players.setNum(val);
|
||||
} else if (Array.isArray(val)) {
|
||||
this.players = val;
|
||||
}
|
||||
}
|
||||
set bots(num) {
|
||||
this.bots.setNum(num);
|
||||
set bots(val) {
|
||||
if (typeof val === 'number') {
|
||||
this.bots.setNum(val);
|
||||
} else if (Array.isArray(val)) {
|
||||
this.bots = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue