Skip to content

Commit

Permalink
Merge pull request #689 from BottledByte/feature/buildings-in-json
Browse files Browse the repository at this point in the history
Dehardcode Buildings to JSON
  • Loading branch information
tuomount committed Dec 16, 2023
2 parents 6c82c70 + d33eb44 commit 1a65df8
Show file tree
Hide file tree
Showing 30 changed files with 1,022 additions and 1,700 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.openRealmOfStars.player.tech.Tech;
import org.openRealmOfStars.player.tech.TechType;
import org.openRealmOfStars.starMap.StarMap;
import org.openRealmOfStars.starMap.planet.BuildingFactory;
import org.openRealmOfStars.starMap.planet.construction.Building;
import org.openRealmOfStars.starMap.planet.construction.BuildingFactory;
import org.openRealmOfStars.utilities.DiceGenerator;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/openRealmOfStars/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@
import org.openRealmOfStars.starMap.newsCorp.NewsCorpData;
import org.openRealmOfStars.starMap.newsCorp.NewsData;
import org.openRealmOfStars.starMap.newsCorp.NewsFactory;
import org.openRealmOfStars.starMap.planet.BuildingFactory;
import org.openRealmOfStars.starMap.planet.Planet;
import org.openRealmOfStars.starMap.planet.construction.Building;
import org.openRealmOfStars.starMap.planet.construction.BuildingFactory;
import org.openRealmOfStars.starMap.vote.Vote;
import org.openRealmOfStars.starMap.vote.VotingType;
import org.openRealmOfStars.utilities.DiceGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ public EspionageMissionView(final Planet planet, final PlayerInfo player,
"No building project selected.");
constructionLabel.setToolTipText("Production currently underconstruction");
constructionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
if (planet.getUnderConstruction() != null) {
constructionLabel.setText(planet.getUnderConstruction().getName());
constructionLabel.setLeftIcon(planet.getUnderConstruction().getIcon());
final var underConstruction = planet.getUnderConstruction();
if (underConstruction != null) {
constructionLabel.setText(underConstruction.getName());
final var icon = Icons.getIconByName(underConstruction.getIconId());
constructionLabel.setLeftIcon(icon);
}
panel.add(constructionLabel);
panel.add(Box.createRigidArea(new Dimension(60, 5)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.swing.JList;
import javax.swing.ListCellRenderer;

import org.openRealmOfStars.gui.icons.Icons;
import org.openRealmOfStars.gui.util.GuiStatics;
import org.openRealmOfStars.starMap.planet.construction.Construction;

Expand All @@ -47,7 +48,7 @@ public Component getListCellRendererComponent(
JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(
list, value, index, isSelected, cellHasFocus);
renderer.setFont(GuiStatics.getFontCubellan());
renderer.setIcon(value.getIcon().getAsIcon());
renderer.setIcon(Icons.getIconByName(value.getIconId()).getAsIcon());
if (isSelected) {
renderer.setForeground(GuiStatics.getCoolSpaceColor());
renderer.setBackground(GuiStatics.getDeepSpaceColor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import org.openRealmOfStars.player.fleet.Fleet;
import org.openRealmOfStars.player.race.SpaceRace;
import org.openRealmOfStars.player.tech.Tech;
import org.openRealmOfStars.starMap.planet.BuildingFactory;
import org.openRealmOfStars.starMap.planet.Planet;
import org.openRealmOfStars.starMap.planet.construction.Building;
import org.openRealmOfStars.starMap.planet.construction.BuildingFactory;

/**
*
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/openRealmOfStars/player/ship/Ship.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public class Ship extends Construction {
* @param design from where actual ship is created
*/
public Ship(final ShipDesign design) {
super(design.getName(), Icons.getIconByName(Icons.ICON_HULL_TECH));
super(design.getName(), Icons.ICON_HULL_TECH);
setProdCost(design.getCost());
setMetalCost(design.getMetalCost());
hull = design.getHull();
Expand Down Expand Up @@ -199,7 +199,7 @@ public Ship(final ShipDesign design) {
* @throws IOException if there is any problem with DataInputStream
*/
public Ship(final DataInputStream dis) throws IOException {
super("SHIP", Icons.getIconByName(Icons.ICON_HULL_TECH));
super("SHIP", Icons.ICON_HULL_TECH);
String tmpStr = IOUtilities.readString(dis);
setName(tmpStr);
setProdCost(dis.readInt());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/openRealmOfStars/player/tech/Tech.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.openRealmOfStars.player.ship.ShipComponentFactory;
import org.openRealmOfStars.player.ship.ShipHull;
import org.openRealmOfStars.player.ship.ShipHullFactory;
import org.openRealmOfStars.starMap.planet.BuildingFactory;
import org.openRealmOfStars.starMap.planet.construction.Building;
import org.openRealmOfStars.starMap.planet.construction.BuildingFactory;

/**
* Class for Single tech aka researched technology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import org.openRealmOfStars.player.ship.ShipComponent;
import org.openRealmOfStars.player.ship.ShipComponentFactory;
import org.openRealmOfStars.player.ship.ShipComponentType;
import org.openRealmOfStars.starMap.planet.BuildingFactory;
import org.openRealmOfStars.starMap.planet.construction.Building;
import org.openRealmOfStars.starMap.planet.construction.BuildingFactory;
import org.openRealmOfStars.utilities.DiceGenerator;
import org.openRealmOfStars.utilities.ErrorLogger;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/openRealmOfStars/starMap/StarMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
import org.openRealmOfStars.starMap.newsCorp.NewsCorpData;
import org.openRealmOfStars.starMap.newsCorp.NewsData;
import org.openRealmOfStars.starMap.newsCorp.NewsFactory;
import org.openRealmOfStars.starMap.planet.BuildingFactory;
import org.openRealmOfStars.starMap.planet.GameLengthState;
import org.openRealmOfStars.starMap.planet.Planet;
import org.openRealmOfStars.starMap.planet.PlanetTypes;
import org.openRealmOfStars.starMap.planet.PlanetaryEvent;
import org.openRealmOfStars.starMap.planet.construction.BuildingFactory;
import org.openRealmOfStars.starMap.planet.construction.ConstructionFactory;
import org.openRealmOfStars.starMap.vote.Vote;
import org.openRealmOfStars.starMap.vote.Votes;
Expand Down
Loading

0 comments on commit 1a65df8

Please sign in to comment.