diff --git a/src/client/graphics/layers/Leaderboard.ts b/src/client/graphics/layers/Leaderboard.ts index 0749a90aa..1d9dbb35d 100644 --- a/src/client/graphics/layers/Leaderboard.ts +++ b/src/client/graphics/layers/Leaderboard.ts @@ -89,7 +89,9 @@ export class Leaderboard extends LitElement implements Layer { switch (this._sortKey) { case "gold": - sorted = sorted.sort((a, b) => compare(a.gold(), b.gold())); + sorted = sorted.sort((a, b) => + compare(Number(a.gold()), Number(b.gold())), + ); break; case "troops": sorted = sorted.sort((a, b) => compare(a.troops(), b.troops())); diff --git a/src/core/execution/DonateTroopExecution.ts b/src/core/execution/DonateTroopExecution.ts index 3e362f611..3e5ac43da 100644 --- a/src/core/execution/DonateTroopExecution.ts +++ b/src/core/execution/DonateTroopExecution.ts @@ -31,8 +31,7 @@ export class DonateTroopsExecution implements Execution { this.troops = mg.config().defaultDonationAmount(this.sender); } const maxDonation = - mg.config().maxPopulation(this.recipient) - - this.recipient.totalPopulation(); + mg.config().maxPopulation(this.recipient) - this.recipient.population(); this.troops = Math.min(this.troops, maxDonation); }