@@ -213,6 +213,9 @@ public GameUI(final ClientGameSession session) {
213213 _kbw = new ArgbSprite (READY_BUTTON .offsetX + 20 , READY_BUTTON .offsetY + 20 );
214214 this .gameSession = session ;
215215
216+ final int victoryPanelHeight = this .gameSession .gameState .victoryChecker .victoryPanelHeight ();
217+ final boolean hasVictoryPanel = victoryPanelHeight > 0 ;
218+
216219 final int readyButtonX = getReadyButtonX ();
217220 if (this .gameSession .localPlayer != null ) {
218221 this .endTurnButton = new Button <>(readyButtonX , 20 , READY_BUTTON .width , READY_BUTTON .height , READY_BUTTON , null , 0 , READY_BUTTON_DOWN , null , 0 );
@@ -222,7 +225,7 @@ public GameUI(final ClientGameSession session) {
222225
223226 final int hudIconWidth = HUD_ICON_1 .width ;
224227 final int victoryButtonX = readyButtonX - 6 - hudIconWidth ;
225- if (this . victoryPanel != null ) {
228+ if (hasVictoryPanel ) {
226229 this .victoryButton = new Button <>(victoryButtonX , 25 , HUD_ICON_5 .width , HUD_ICON_5 .height , HUD_ICON_5 , null , 0 , HUD_ICON_RED_5 , null , 0 );
227230 this .victoryButton .tooltip = StringConstants .TOOLTIP_VICTORY_BUTTON_SHOW ;
228231 this .addComponent (this .victoryButton );
@@ -257,8 +260,7 @@ public GameUI(final ClientGameSession session) {
257260 this .addComponent (this .diplomacyPanel );
258261 this .fleetInfoPanel = createFleetInfoPanel (this .gameSession .gameState .playerCount );
259262 this .addComponent (this .fleetInfoPanel );
260- final int victoryPanelHeight = this .gameSession .gameState .victoryChecker .victoryPanelHeight ();
261- if (victoryPanelHeight > 0 ) {
263+ if (hasVictoryPanel ) {
262264 this .victoryPanel = createVictoryPanel (victoryPanelHeight );
263265 this .addComponent (this .victoryPanel );
264266 }
0 commit comments