return sample.sector_id;
}
- async save(city: City) {
+ async save(city: Partial<City>) {
+ if(!city.id) {
+ throw new Error('Unknown city to save');
+ }
const fieldsToSave = [
'totalSpace', 'usedSpace', 'credits', 'alloys', 'energy', 'food',
'poulation', 'soldiers', 'attackers', 'defenders', 'sp_attackers', 'sp_defenders',
// validate that they have enough empty construction queues
const concurrentConstruction = await this.buildQueue.list(city.owner);
if(concurrentConstruction.length >= city.max_construction_queue) {
- throw new InsufficientResourceError('Training queues', concurrentConstruction.length + 1, city.max_construction_queue);
+ throw new InsufficientResourceError('Construction queues', concurrentConstruction.length + 1, city.max_construction_queue);
}
city.usedSpace += (building.land * amount);