WIP: update to include sectors!
[browser-rts.git] / src / tasks / fight.ts
index ceeb676f95e44276ff7d7cd533401191d6bf45ab..7be73a6031d50f9562f7230a363b2b542b3f5e8f 100644 (file)
@@ -1,6 +1,6 @@
 import { ArmyQueue } from "../repository/army"
 import { Task } from "./task";
-import { CityRepository, City } from "../repository/city";
+import { CityRepository, CityWithLocation } from "../repository/city";
 import { MailRepository } from "../repository/mail";
 
 const cityRepo = new CityRepository();
@@ -17,9 +17,9 @@ export const fight = new Task<ArmyQueue>('fights', async (task, job) => {
     }
 
     // lets get the two cities!
-    const [attacker, attacked] = await Promise.all<City>([
-        cityRepo.FindOne({id: army.your_city}),
-        cityRepo.FindOne({id: army.attacked_city})
+    const [attacker, attacked] = await Promise.all<CityWithLocation>([
+        cityRepo.findById(army.your_city),
+        cityRepo.findById(army.attacked_city)
     ]);
 
     if(!attacker) {