Comments (8)
As I'm interested in a fix for this too, I thought I'd add this info about the bug.
It affects the history as well with the added caveat that when clicking on territories in the history mode, the engine assumes it is France's turn--regardless of where you select in the history--and only will fill the battle calculator with French units (if there are any, or Axis units since they are the enemy)
I verified that this bug exists in 2.6 release 14247 (could be earlier as I had not checked them) and the latest release 14394.
The battle calculator works as desired (clicking on any territory in current game or history would populate the battle calculator) in the release version 2.5-22294.
from triplea.
This regressed from #9602.
That PR uses the following order for choosing defenders, which seems to prioritize players with no units in such cases:
1. enemy on the same territory
2. any enemy
3. neutral on the same territory
4. any neutral
5. any player
So we end up picking an enemy with no units via 2.
A simple fix could be to change the above to:
1. enemy on the same territory
2. neutral on the same territory
3. player on the same territory
4. any player
The above results in the US being selected as the defender (while attacker is still active player, but with no units, so doesn't matter much).
from triplea.
As an aside, the issue with history is interesting, since I think #10759 was supposed to fix the logic for choosing the active player.
from triplea.
Example repro:
- Napoleonic Empires, France (first turn)
- Do a battle calc on a Spanish territory (whose an ally)
In 2.5, Spanish units appear as defenders. UK is selected as an attacker (even if there's no units attackers).
In 2.6, France is selected as an attacker (with no units) and UK is selected as a defender (with no units).
Pretty clear that the 2.6 behavior is not what people would want here.
from triplea.
Another example if WW2 Global 2nd ed, bringing up the battle calc on UK should show both UK and French units.
from triplea.
So before #9602, the logic was:
- Take the player list, ordered by number of units, except putting the current player first in the list if they have units there
- If not water, set location owner as defender and choose first player in list that the defender is at war with
I'll have to read the details of that PR to understand what it was trying to achieve to understand why there was a logic change in the first place.
from triplea.
@DanVanAtta wondering if you agree that given the above, we shouldn't actually do "the attacker is always the current player" logic, given you're the one who suggested that on the above PR.
from triplea.
Ok, so let me try to document some cases that I think don't work as they should in 2.6:
WW2 Global 1940 2nd Ed:
a. Germany's turn, open battle calc on Northern Italy (ally)
Expected: Battle calc prepopulated with defending units of Italy
b. Germany's turn, open battle calc on sea zone with Italian ships (ally)
Expected: Battle calc prepopulated with defending units of Italy
c. Germany's turn, open battle calc on a Russian territory (currently Neutral)
Expected: Battle calc prepopulated with defending units of Russia
Let me see if I can set these up as test cases when working on a fix.
from triplea.
Related Issues (20)
- 2.5.22294: XmlGameElementMapper - Could not find delegate 'games.strategy.triplea.delegate.GivePUsDelegate'. This can be a map config...
- 2.5.22294: UnifiedInvocationHandler#invoke:58 - java.lang.IllegalStateException
- 2.5.22294: UiContext#getDefaultMapDir:263 - java.lang.ClassCastException
- 2.5.22294: ContentDownloader#downloadWithSingleRetryOnError:81 - java.net.SocketTimeoutException
- 2.5.22294: SimpleUnitPanel - missing unit icon (won't be displayed): bomberBritish, UnitImageFactory.ImageKey(player=PlayerId named:B...
- BattleDelegate#setupTerritoriesAbandonedToTheEnemy:671 - java.lang.IllegalStateException HOT 5
- 2.5.22294: CasualtyOrderOfLosses#sortUnitsForCasualtiesWithSupport:241 - java.lang.OutOfMemoryError HOT 3
- 2.5.22294: UnitsDrawer - MISSING UNIT IMAGE (won't be displayed): gas, UnitImageFactory.ImageKey(player=PlayerId named:Arabia, type=U... HOT 1
- 2.5.22294: UnitsDrawer - MISSING UNIT IMAGE (won't be displayed): gas, UnitImageFactory.ImageKey(player=PlayerId named:Arabia, type=U... HOT 1
- 2.5.22294: UnitsDrawer - MISSING UNIT IMAGE (won't be displayed): gas, UnitImageFactory.ImageKey(player=PlayerId named:Arabia, type=U... HOT 1
- 2.5.22294: UnitsDrawer - MISSING UNIT IMAGE (won't be displayed): gas, UnitImageFactory.ImageKey(player=PlayerId named:Arabia, type=U... HOT 1
- 2.5.22294: SimpleUnitPanel - missing unit icon (won't be displayed): ruralproductionJapanese, UnitImageFactory.ImageKey(player=Player...
- ResourceCollection#removeResource:54 - java.lang.IllegalArgumentException HOT 8
- Lobby Message
- RemoteMethodCall#writeExternal:121 - java.io.NotSerializableException
- 2.5.22294: TripleAFrame - Failed to set round icon for PlayerId named:French
- 2.5.22294: DefaultNamed#readObject:53 - java.lang.StackOverflowError
- 2.5.22294: UnitsDrawer - MISSING UNIT IMAGE (won't be displayed): carrier_hull, UnitImageFactory.ImageKey(player=PlayerId named:Ameri... HOT 1
- HistorySynchronizer#lambda$startHistoryEvent$1:48 - java.util.ConcurrentModificationException HOT 1
- FileUtils#find:103 - java.lang.IllegalArgumentException HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from triplea.