Skip to content

Improve HighSeas validation and fix HighScore duplicate‑UUID logic - #148

Open
JaskRendix wants to merge 3 commits into
FreeCol:sf-auto-mergefrom
JaskRendix:HighSeasTest
Open

Improve HighSeas validation and fix HighScore duplicate‑UUID logic#148
JaskRendix wants to merge 3 commits into
FreeCol:sf-auto-mergefrom
JaskRendix:HighSeasTest

Conversation

@JaskRendix

@JaskRendix JaskRendix commented Jan 13, 2026

Copy link
Copy Markdown

HighScore

  • fixed checkHighScore to correctly detect duplicate game UUIDs and update an existing entry only when the new score is higher
  • corrected an indexing bug caused by reverse iteration, ensuring the method returns the proper replacement index
  • fixed tidyScores sorting and truncation bug by ensuring scores are explicitly sorted in descending order before applying .subList(NUMBER_OF_HIGH_SCORES, scores.size()).clear(), resolving issues where excess scores bypassed retention limits

Test Coverage Improvements

  • Expanded and strengthened test coverage for: HighSeasTest, HighScoreTest, EuropeTest
  • Added a new test suite: ServerEuropeTest

Next Steps / Post-Merge Todo:
Once this PR is merged, open a follow-up PR to clean up src/net/sf/freecol/server/control/InGameController.java by replacing this manual loop check:

            boolean hasMap = false;
            for (Location dest : destinations) {
                if (dest instanceof Map) {
                    hasMap = true;
                    break;
                }
            }
            if (!hasMap) {
                Map map = getGame().getMap();
                destinations.add(map);
            }

with the new helper method:

            highSeas.ensureMapDestination();

@JaskRendix JaskRendix changed the title Add unit tests for HighSeas behavior and serialization Improve HighSeas validation and fix HighScore duplicate‑UUID logic Jan 15, 2026
@JaskRendix
JaskRendix force-pushed the HighSeasTest branch 7 times, most recently from 0077250 to ebf301e Compare January 16, 2026 16:31
@JaskRendix
JaskRendix force-pushed the HighSeasTest branch 2 times, most recently from 90bc476 to dd0d05b Compare January 24, 2026 08:39
@JaskRendix JaskRendix closed this Feb 1, 2026
Comment thread src/net/sf/freecol/common/model/HighScore.java
Comment thread src/net/sf/freecol/server/control/InGameController.java Outdated
Comment thread src/net/sf/freecol/common/model/HighSeas.java
Comment thread src/net/sf/freecol/common/model/HighScore.java
Comment thread test/src/net/sf/freecol/common/model/EuropeTest.java Outdated
Comment thread test/src/net/sf/freecol/common/model/EuropeTest.java Outdated
Comment thread test/src/net/sf/freecol/common/model/EuropeTest.java
Comment thread test/src/net/sf/freecol/common/model/EuropeTest.java
Comment thread test/src/net/sf/freecol/common/model/HighScoreTest.java
Comment thread test/src/net/sf/freecol/common/model/HighScoreTest.java
@JaskRendix JaskRendix reopened this Aug 23, 2026
@JaskRendix
JaskRendix force-pushed the HighSeasTest branch 5 times, most recently from 50984f7 to 0179f89 Compare August 23, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants