new building: homes
[browser-rts.git] / src / render / kingdom-overview.ts
index c035f7cbcec60921063e74f6d41c164402965f9d..2712e7643ae4cbdab9545df22863adf16e0d469e 100644 (file)
@@ -1,5 +1,5 @@
 import { Account } from "../repository/accounts";
-import { CityWithLocation } from "../repository/city";
+import { CityWithLocation, CityRepository } from "../repository/city";
 import * as _ from 'lodash';
 
 type Usage = {
@@ -9,6 +9,8 @@ type Usage = {
   energyProductionPerTick: number;
 }
 
+const cityRepo = new CityRepository();
+
 export function renderKingomOverview(city: CityWithLocation & Usage, account: Account): string {
   const foodRateOfChange = city.foodProductionPerTick - city.foodUsagePerTick;
   const energyRateOfChange = city.energyProductionPerTick - city.energyUsagePerTick;
@@ -20,7 +22,7 @@ export function renderKingomOverview(city: CityWithLocation & Usage, account: Ac
                <th>Captain</th>
                <td>${account.username}</td>
                <th>Population</th>
-               <td>${city.population.toLocaleString()}/${_.max([city.farms * 70, city.population])}</td>
+               <td>${city.population.toLocaleString()}/${cityRepo.maxPopulation(city)}</td>
        </tr>
        <tr>
                <th>Space</th>