Small optimization when creating temp array for sorting buildings
This commit is contained in:
2
dist/CookieMonsterDev.js
vendored
2
dist/CookieMonsterDev.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonsterDev.js.map
vendored
2
dist/CookieMonsterDev.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -69,17 +69,19 @@ export default function UpdateBuildings() {
|
|||||||
if (Game.buyMode === 1 && CMOptions.SortBuildings) {
|
if (Game.buyMode === 1 && CMOptions.SortBuildings) {
|
||||||
let arr;
|
let arr;
|
||||||
if (CMOptions.SortBuildings === 1) {
|
if (CMOptions.SortBuildings === 1) {
|
||||||
arr = Object.keys(CacheObjects1).map((k) => {
|
arr = Object.keys(CacheObjects1).map(k => {
|
||||||
const o = CacheObjects1[k];
|
const o = {};
|
||||||
o.name = k;
|
o.name = k;
|
||||||
o.id = Game.Objects[k].id;
|
o.pp = CacheObjects1[k].pp;
|
||||||
|
o.color = CacheObjects1[k].color;
|
||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
} else if (CMOptions.SortBuildings === 2) {
|
} else if (CMOptions.SortBuildings === 2) {
|
||||||
arr = Object.keys(target).map((k) => {
|
arr = Object.keys(target).map(k => {
|
||||||
const o = target[k];
|
const o = {};
|
||||||
o.name = k;
|
o.name = k;
|
||||||
o.id = Game.Objects[k].id;
|
o.pp = target[k].pp;
|
||||||
|
o.color = target[k].color;
|
||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -93,8 +95,8 @@ export default function UpdateBuildings() {
|
|||||||
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const arr = Object.keys(CacheObjects1).map((k) => {
|
const arr = Object.keys(CacheObjects1).map(k => {
|
||||||
const o = CacheObjects1[k];
|
const o = {};
|
||||||
o.name = k;
|
o.name = k;
|
||||||
o.id = Game.Objects[k].id;
|
o.id = Game.Objects[k].id;
|
||||||
return o;
|
return o;
|
||||||
|
|||||||
Reference in New Issue
Block a user