Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/rotp/model/colony/Colony.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import rotp.model.tech.TechMissileWeapon;
import rotp.model.tech.TechTree;
import rotp.ui.RotPUI;
import rotp.ui.main.TransportDeploymentPanel;
import rotp.ui.notifications.GNNNotification;
import rotp.ui.notifications.InvadersKilledAlert;
import rotp.ui.notifications.TransportsKilledAlert;
Expand Down Expand Up @@ -946,13 +947,15 @@ public void scheduleTransportsToSystem(StarSystem dest, int pop, float travelTim
}
}
public void scheduleTransportsToSystem(StarSystem dest, int pop) {
// adjust pop to max allowed

int xPop = min(pop, maxTransportsAllowed());
log("Scheduling " + xPop + " transports from: " + starSystem().name() + " to: " + dest.name());
// If pop is the entire current population then accept it if abandonment is
// permitted, otherwise adjust it to the max allowed.
if (pop < population() || !TransportDeploymentPanel.enableAbandon) {
pop = min(pop, maxTransportsAllowed());
}
log("Scheduling " + pop + " transports from: " + starSystem().name() + " to: " + dest.name());

// if zero or to this system, then clear
if ((dest == starSystem()) || (xPop == 0))
if ((dest == starSystem()) || (pop == 0))
clearTransport();
else {
transport().size(pop);
Expand Down
16 changes: 16 additions & 0 deletions src/rotp/ui/main/TransportDeploymentPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@

public class TransportDeploymentPanel extends SystemPanel {
private static final long serialVersionUID = 1L;
// NOTE: This use of a public static variable needs rework because it permits an in-game exploit:
// - Pick a system and abandon it to any valid target (own) system.
// - Select the same source system and click "Send Transports".
// - Choose any valid target system (which can include an enemy system).
// - Adjust the population to any value greater than half of but below the current full colony size.
// - Click the green "Send Transports" button to confirm.
// - Next turn the game ships the specified number of transports without abandoning the colony.
// This can be used to muster force against an enemy in excess of what should be possible, but
// it can also be used defensively or economically to rapidly populate one's own system(s) from
// back-line colonies.
// The essential nature of the issue is that committing the abandon action sets this global flag
// indefinitely until the regular transport action is invoked on some system. The most effective
// solution is to make the abandonment (intent) flag transient to the UI action and capture it
// elsewhere, perhaps in the transport object itself or in the colony object (latter would require
// differentiation from the "abandoned" flag that gets set when the population actually
// gets shipped).
public static boolean enableAbandon = false;
protected BasePanel topPane;
protected BasePanel detailPane;
Expand Down