Skip to content

Commit

Permalink
#2217 Fix initial size of player overview table columns (#2236)
Browse files Browse the repository at this point in the history
* #2217 Fix initial size of player overview table columns

* #2217 Fix some docs

* #2237 Fix counter attack rating coefficient
  • Loading branch information
wsbrenk authored Jan 27, 2025
1 parent 5903802 commit 7e9aaa5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/main/java/core/gui/model/PlayerOverviewTableModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class PlayerOverviewTableModel(id: ColumnModelId, name: String) : HOTableModel(i
}

fun getPlayerAtRow(tableRow: Int): Player? {
if (players != null && tableRow > -1) {
if (players != null && tableRow > -1 && tableRow < players!!.size) {
val modelIndex = table!!.convertRowIndexToModel(tableRow)
if (modelIndex < players!!.size) {
return players!![modelIndex]
Expand Down
24 changes: 13 additions & 11 deletions src/main/java/core/gui/model/PlayerPositionColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import core.gui.comp.entry.DoubleLabelEntries;
import core.gui.comp.entry.IHOTableEntry;
import core.model.HOVerwaltung;
import core.model.UserParameter;
import core.model.player.IMatchRoleID;
import core.model.player.Player;
import core.util.Helper;
Expand All @@ -31,31 +32,32 @@ public class PlayerPositionColumn extends PlayerColumn {
/**
* constructor
*
* @param id
* @param name
* @param tooltip
* @param position
* @param id User column identifier
* @param name Column header string
* @param tooltip Column tool tip
* @param position Lineup position code
*/
protected PlayerPositionColumn(int id, String name, String tooltip, byte position) {
super(id, name, tooltip);
this.position = position;
this.preferredWidth = UserParameter.instance().fontSize * 5;
}

/**
* returns TableEntry
* will not be overwrite
* will not be overridden
*/
@Override
public IHOTableEntry getTableEntry(Player player, Player comparePlayer) {
return new DoubleLabelEntries(getEntryValue(player), getCompareValue(player, comparePlayer));
}

/**
* returns player value
* Returns player value
* overwritten by created columns
*
* @param player
* @return
* @param player Player
* @return ColorLabelEntry
*/
public ColorLabelEntry getEntryValue(Player player) {
var ratingPredictionModel = HOVerwaltung.instance().getModel().getRatingPredictionModel();
Expand All @@ -73,10 +75,10 @@ public ColorLabelEntry getEntryValue(Player player) {
}

/**
* return a value if comparePlayer is not null
* Return a value if comparePlayer is not null
*
* @param player
* @param comparePlayer
* @param player Player
* @param comparePlayer Player to compare with
* @return ColorLabelEntry
*/
public ColorLabelEntry getCompareValue(Player player, Player comparePlayer) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/core/gui/model/PlayerSkillColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import core.gui.comp.entry.DoubleLabelEntries;
import core.gui.comp.entry.IHOTableEntry;
import core.gui.comp.entry.SkillEntry;
import core.model.UserParameter;
import core.model.player.Player;
import core.util.Helper;

Expand Down Expand Up @@ -38,6 +39,7 @@ public class PlayerSkillColumn extends PlayerColumn {
protected PlayerSkillColumn(int id,String name, String tooltip,PlayerSkill skill){
super(id,name,tooltip);
this.skill = skill;
this.preferredWidth = UserParameter.instance().fontSize * 5;
background = (skill == PlayerSkill.EXPERIENCE
|| skill == PlayerSkill.FORM
|| skill == PlayerSkill.LEADERSHIP
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/rating/RatingPredictionModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1748,6 +1748,6 @@ protected double calcCounterAttack(@NotNull Lineup lineup, int minute) {
}
a *= f / n;
// 0,017272a + 1,042313
return 0.01727 * a + 1.042313;
return 0.017272 * a + 1.042313;
}
}
1 change: 1 addition & 0 deletions src/main/resources/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Fix display of best position rating (#2166)
* Display coach conversion costs (#2204)
* New column "trainer notes" (#2229)
* Fix initial size of skill and position columns (#2217)
* Fix long shot rating calculation (#2237)

### Team Analyzer
Expand Down

0 comments on commit 7e9aaa5

Please sign in to comment.