Skip to content

Commit c1890b3

Browse files
committed
Fix: sort tech upgrades in their own list.
1 parent c17cf4f commit c1890b3

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
- Auto increase decimalPlaces for small number.
1010

1111
### Changed
12-
- Change: Rollback the algorithm about deltaTime
13-
- Improve: tweak layout of buildings
12+
- Change: Rollback the algorithm about deltaTime.
13+
- Improve: tweak layout of buildings.
14+
15+
### Fixed
16+
- Fix: sort tech upgrades in their own list.
1417

1518
## [2042.11] - 2021-09-19
1619
### Added

main.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,16 @@ let BestDealHelper = {
378378
let current_upgrades_order = [...document.querySelector("#upgrades").children].map(e => e.id);
379379
// Only sort when the order is different
380380
if (!upgrades_order.every((value, index) => value === current_upgrades_order[index])) {
381-
let store = document.querySelector("#upgrades");
382-
for (let i = 0; i < upgrades.length; ++i) {
383-
if (["toggle", "tech"].includes(upgrades[i].pool)) continue;
384-
store.appendChild(upgrades[i].l);
385-
}
381+
let buildUpgrades = document.querySelector("#upgrades");
382+
let techUpgrades = document.querySelector("#techUpgrades");
383+
upgrades.forEach(function (upgrade) {
384+
if (upgrade.pool === "toggle") {
385+
} else if (upgrade.pool === "tech") {
386+
techUpgrades.appendChild(upgrade.l);
387+
} else {
388+
buildUpgrades.appendChild(upgrade.l);
389+
}
390+
});
386391
}
387392

388393
let buildings_order = buildings.map(e => e.id);

0 commit comments

Comments
 (0)