Cant remove more than player has of resource



  • I use resources as display counters in US: A, as a visual indicator about the number of rounds the Invaders have left to deploy their reinforcements. Every thing runs ok until they invaders run out of reinforcements to use. then I receive the follow error:
    0_1519042692127_2018-02-19 (4).png
    The error was caused by the Western Invader. Screen shot show Southern Invader. Notice the Invader Resource Bar clearly show 3 RAs, while the Economy Tab shows 1.
    When I save the game and reload it. The Economy Tab will show 3 and the error will not happen. So a save file at this point will not work.
    Error Text:

    Loading map: invasion_usa, from: C:\Users\WC_Su\triplea\downloadedMaps\invasion_usa-master.zip
    Loading resources from the following paths: [C:\Users\WC_Su\triplea\downloadedMaps\invasion_usa-master.zip, C:\Program Files\TripleA\assets]
    Loading map: invasion_usa, from: C:\Users\WC_Su\triplea\downloadedMaps\invasion_usa-master.zip
    Loading resources from the following paths: [C:\Users\WC_Su\triplea\downloadedMaps\invasion_usa-master.zip, C:\Program Files\TripleA\assets]
    Error: Cant remove more than player has of resource: RAs. current:0 toRemove: 1
    java.lang.IllegalArgumentException: Cant remove more than player has of resource: RAs. current:0 toRemove: 1
    	at games.strategy.engine.data.ResourceCollection.removeResource(ResourceCollection.java:58)
    	at games.strategy.engine.data.changefactory.ChangeResourceChange.perform(ChangeResourceChange.java:42)
    	at games.strategy.engine.data.CompositeChange.perform(CompositeChange.java:49)
    	at games.strategy.engine.data.GameData.performChange(GameData.java:518)
    	at games.strategy.engine.history.History.gotoNode(History.java:116)
    	at games.strategy.triplea.ui.history.HistoryPanel.gotoNode(HistoryPanel.java:261)
    	at games.strategy.triplea.ui.history.HistoryPanel.goToEnd(HistoryPanel.java:370)
    	at games.strategy.engine.history.History.goToEnd(History.java:58)
    	at games.strategy.engine.history.HistoryWriter.addToCurrent(HistoryWriter.java:104)
    	at games.strategy.engine.history.HistoryWriter.addToAndSetCurrent(HistoryWriter.java:93)
    	at games.strategy.engine.history.HistoryWriter.startEvent(HistoryWriter.java:117)
    	at games.strategy.engine.framework.HistorySynchronizer$1.lambda$startHistoryEvent$1(HistorySynchronizer.java:64)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$500(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    

    Hope some of this makes since. I think that some place in memory the resource is being deducted twice. I have check and rechecked the xml.

    Cheers...


  • Admin

    @wc_sumpton Can you reproduce the error consistently? If so, then please upload a save game.



  • @redrum Thank you for taking the time to look into this. Save game shows end of Americans turn 5. RAs for all Invaders are at 5 both in the Economy Tab and Resource bar.

    You can press done and let the AI preform Western's turn 6 move. After this the Western Player's RAs will say 3 not 4, after the next round it will drop to 1 not 3. The game history say's it should be 3 the Resource bar show 3. At the end of turn 8 the error message will show. If you stop, save and reload the new save. The Economy will correct itself to 3.
    0_1519060727589_US_Aturn5American.tsvg
    Thanks again.

    Cheers...


  • Admin

    @wc_sumpton I'm not seeing the issue. After letting the AI play Western, I see 4 RAs in both the history and economy tab.



  • @redrum LOL was just doing the same. As I bounced between the Economic Tab, and other tabs, the Economics tab fixed it self. Been doing a lot of debug testing and was leaving the Economic tab open for reference while watching the Resource Bar, when I noticed the first discrepancy. Basically watching the number as the AI played. But once you change tab back and forth the number reset themselves. Hard to explain, bad eyesight, hard headed, old age, take you pick... I got it.

    Thanks...

    Cheers...


  • Admin

    @wc_sumpton Guessing it might have to do with when the economy tab is refreshed/updated. That hasn't changed at all with the recent resource bar addition.



  • @redrum That all I do is guess. With the resource bar enhancement, I was just checking one against the other to ensure thing updated as planned. Thanks again for your time.

    'If you throw it against the wall and it sticks. Somethings wrong take it down an try again!'

    Cheers...