From 445c9c0180e41a2e6780923a49deaef8561eaab2 Mon Sep 17 00:00:00 2001 From: iMoHax Date: Wed, 1 Feb 2017 14:21:52 +0300 Subject: [PATCH] - print income for contested systems - don't add to max profit result excluded systems - don't check to intersect checked system with self --- .../ru/trader/controllers/PowerPlayController.java | 3 ++- .../main/resources/lang/locale_en_US.properties | 14 +++++++------- .../main/resources/lang/locale_ru_RU.properties | 4 ++-- .../ru/trader/analysis/PowerPlayAnalyzator.java | 1 + 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/client/src/main/java/ru/trader/controllers/PowerPlayController.java b/client/src/main/java/ru/trader/controllers/PowerPlayController.java index 5472118..ef8c02e 100644 --- a/client/src/main/java/ru/trader/controllers/PowerPlayController.java +++ b/client/src/main/java/ru/trader/controllers/PowerPlayController.java @@ -217,6 +217,7 @@ public class PowerPlayController { private void getIntersects(){ Place starSystem = getCheckedSystem(); Collection controlls = getControlSystems(); + controlls.remove(starSystem); result.clear(); if (starSystem != null && !controlls.isEmpty()){ Collection intersects = analyzator.getIntersects(starSystem, controlls); @@ -348,7 +349,7 @@ public class PowerPlayController { Place place = systemsStatEntry.getKey(); if (place.getPower() == power) { PowerPlayAnalyzator.StarSystemsStat systemStat = systemsStatEntry.getValue(); - builder.append(String.format(Localization.getString("powerplay.text.contest.systems"), place.getName(), systemStat.getExploited(), systemStat.getIntersect(), systemStat.getContest())); + builder.append(String.format(Localization.getString("powerplay.text.contest.systems"), place.getName(), systemStat.getExploited(), place.getIncome(), systemStat.getIntersect(), systemStat.getContest())); builder.append("\n"); } } diff --git a/client/src/main/resources/lang/locale_en_US.properties b/client/src/main/resources/lang/locale_en_US.properties index c021e45..3ba7a90 100644 --- a/client/src/main/resources/lang/locale_en_US.properties +++ b/client/src/main/resources/lang/locale_en_US.properties @@ -291,16 +291,16 @@ powerplay.label.power.state=State: powerplay.label.populationSumm=Summ populations: powerplay.text.line=------------------------------------------- powerplay.text.detail=Current stat:\n\ - Income: %4d \u041A\u041A Upkeep: %4.0f \u041A\u041A Contested: %4d \u041A\u041A\n\ - Our exploited: %4d \u041A\u041A Others exploited: %4d \u041A\u041A\n\ - Our blocked: %4d \u041A\u041A Others blocked: %4d \u041A\u041A Total: %4.0f \u041A\u041A + Income: %4d CC Upkeep: %4.0f CC Contested: %4d CC\n\ + Our exploited: %4d CC Others exploited: %4d CC\n\ + Our blocked: %4d CC Others blocked: %4d CC Total: %4.0f CC powerplay.text.summary.title=After expansion complete: powerplay.text.summary=\ - Income: %4d \u041A\u041A Upkeep: %4.0f \u041A\u041A Expansion cost: %4.0f \u041A\u041A\n\ - Contested: %4d \u041A\u041A Our exploited: %4d \u041A\u041A Total: %4.0f \u041A\u041A + Income: %4d CC Upkeep: %4.0f CC Expansion cost: %4.0f CC\n\ + Contested: %4d CC Our exploited: %4d CC Total: %4.0f CC powerplay.text.contest.title=Contested: -powerplay.text.contest.powers=%-20s - %4d \u041A\u041A, Intersected: %4d \u041A\u041A, Contested: %4d \u041A\u041A -powerplay.text.contest.systems=\ %19s - %4d \u041A\u041A, Intersected: %4d \u041A\u041A, Contested: %4d \u041A\u041A +powerplay.text.contest.powers=%-20s - %4d CC, Intersected: %4d CC, Contested: %4d CC +powerplay.text.contest.systems=\ %19s - %4d CC, Income: %4d CC, Intersected: %4d CC, Contested: %4d CC powerplay.result.title=Analyze result powerplay.column.intersecting=Intersect powerplay.column.intersectCount=Intersect count diff --git a/client/src/main/resources/lang/locale_ru_RU.properties b/client/src/main/resources/lang/locale_ru_RU.properties index ae41da3..84fee7d 100644 --- a/client/src/main/resources/lang/locale_ru_RU.properties +++ b/client/src/main/resources/lang/locale_ru_RU.properties @@ -294,8 +294,8 @@ powerplay.text.detail=\u041D\u0430 \u0434\u0430\u043D\u043D\u044B\u0439 \u043C\u powerplay.text.summary.title=\u041F\u043E\u0441\u043B\u0435 \u0432\u0437\u044F\u0442\u0438\u044F: powerplay.text.summary=\u0414\u043E\u0445\u043E\u0434: %4d \u041A\u041A \u0421\u043E\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u0435: %4.0f \u041A\u041A \u0421\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C \u044D\u043A\u0441\u043F\u0430\u043D\u0441\u0438\u0438: %4.0f \u041A\u041A\n\u041E\u0441\u043F\u0430\u0440\u0438\u0432\u0430\u0435\u043C\u044B\u0445: %4d \u041A\u041A \u042D\u043A\u0441\u043B\u0443\u0430\u0442\u0438\u0440\u0443\u0435\u043C\u044B\u0445 \u043D\u0430\u043C\u0438: %4d \u041A\u041A \u0418\u0442\u043E\u0433\u043E: %4.0f \u041A\u041A powerplay.text.contest.title=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u043F\u043E \u043E\u0441\u043F\u0430\u0440\u0438\u0432\u0430\u0435\u043C\u044B\u043C: -powerplay.text.contest.powers=%-20s - %4d \u041A\u041A, \u041F\u0435\u0440\u0435\u0441\u0435\u043A\u0430\u044E\u0449\u0438\u0445\u0441\u044F: %4d \u041A\u041A, \u041E\u0441\u043F\u0430\u0440\u0438\u0432\u0430\u0435\u043C\u044B\u0445: %4d \u041A\u041A -powerplay.text.contest.systems=\ %19s - %4d \u041A\u041A, \u041F\u0435\u0440\u0435\u0441\u0435\u043A\u0430\u044E\u0449\u0438\u0445\u0441\u044F: %4d \u041A\u041A, \u041E\u0441\u043F\u0430\u0440\u0438\u0432\u0430\u0435\u043C\u044B\u0445: %4d \u041A\u041A +powerplay.text.contest.powers=%-20s - %4d \u041A\u041A, \u041F\u0435\u0440\u0435\u0441\u0435\u043A\u0430\u044E\u0449\u0438\u0445\u0441\u044F: %4d \u041A\u041A, \u041E\u0441\u043F\u0430\u0440\u0438\u0432\u0430\u0435\u043C\u044B\u0445: %4d \u041A\u041A +powerplay.text.contest.systems=\ %19s - %4d \u041A\u041A, \u0414\u043E\u0445\u043E\u0434: %4d \u041A\u041A, \u041F\u0435\u0440\u0435\u0441\u0435\u043A\u0430\u044E\u0449\u0438\u0445\u0441\u044F: %4d \u041A\u041A, \u041E\u0441\u043F\u0430\u0440\u0438\u0432\u0430\u0435\u043C\u044B\u0445: %4d \u041A\u041A powerplay.result.title=\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0430\u043D\u0430\u043B\u0438\u0437\u0430 powerplay.column.intersecting=\u041F\u0435\u0440\u0435\u0441\u0435\u043A\u0430\u0435\u0442\u0441\u044F \u0441 powerplay.column.intersectCount=\u041F\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043D\u0438\u0439 diff --git a/core/src/main/java/ru/trader/analysis/PowerPlayAnalyzator.java b/core/src/main/java/ru/trader/analysis/PowerPlayAnalyzator.java index c199103..6ccb965 100644 --- a/core/src/main/java/ru/trader/analysis/PowerPlayAnalyzator.java +++ b/core/src/main/java/ru/trader/analysis/PowerPlayAnalyzator.java @@ -143,6 +143,7 @@ public class PowerPlayAnalyzator { public static Stream getMaxProfit(Stream starSystems, Place headquarter, Collection centers, double radius, double maxDistance){ Collection candidates = new ArrayList<>(); starSystems.filter(p ->p.getPowerState() == POWER_STATE.NONE && p.getDistance(headquarter) <= maxDistance) + .filter(p -> !centers.contains(p)) .forEach(candidates::add); IntersectsMapper candidatesMapper = new IntersectsMapper(candidates, radius, false, true); IntersectsMapper centersMapper = new IntersectsMapper(centers, radius*2, false, true);