Skip to content

Commit 03af890

Browse files
committed
fix: More precise intermediate travel steps
1 parent 7b567e5 commit 03af890

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/job/job.service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export class JobService extends MongooseRepository<Job> {
188188
const fleet = await this.fleetService.find(job.fleet);
189189
const ships = await this.shipService.findAll({fleet: new Types.ObjectId(job.fleet)});
190190
const systems = await this.systemService.findAll({_id: {$in: job.path}});
191-
if (!fleet || !ships) {
191+
if (!fleet || !ships.length) {
192192
continue;
193193
}
194194
const slowestShipSpeed = this.systemLogicService.getSlowestShipSpeed(fleet, ships, empire);
@@ -197,11 +197,11 @@ export class JobService extends MongooseRepository<Job> {
197197
for (let i = 1; i < job.path.length; i++) {
198198
const fromSystem = systems.find(system => system._id.equals(job.path![i - 1]));
199199
const toSystem = systems.find(system => system._id.equals(job.path![i]));
200-
201200
if (!fromSystem || !toSystem) {
202201
continue;
203202
}
204-
linkTimeSum += Math.round(this.systemLogicService.getLinkTime(fromSystem, toSystem, slowestShipSpeed)!);
203+
204+
linkTimeSum += this.systemLogicService.getLinkTime(fromSystem, toSystem, slowestShipSpeed)!;
205205

206206
if (job.progress + 1 >= linkTimeSum) {
207207
fleet.location = toSystem._id;

0 commit comments

Comments
 (0)