Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge maintenance branch into the master branch #170

Draft
wants to merge 59 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
57a5da1
Creating Maven Setup POM.XML
neutronc Oct 6, 2018
be81e2f
Fixes the problem that a upon creation of the CGR, if that is opened
neutronc Oct 7, 2018
856dec9
Fixes the problem that a upon creation of the CGR, if that is opened
neutronc Oct 7, 2018
fad9cc3
Fixing the Game Tests.- Adding the 1856 Game from BGG for teh test of 10
neutronc Oct 21, 2018
4106b40
Fixing failed Test Games for CI Test.
neutronc Oct 21, 2018
6ab4d68
Merge pull request #66 from neutronc/rails_2_maintenance
neutronc Oct 21, 2018
ef0fd8c
Changing Version Identifier
neutronc Oct 21, 2018
1b740d9
Fix Gradle build errors (#67)
LarryNorth Oct 25, 2018
d5b8ec8
Merge pull request #68 from neutronc/rails_2_maintenance
neutronc Oct 28, 2018
f431a77
Merge pull request #1 from Rails-18xx/rails_2_maintenance
neutronc Oct 28, 2018
9f57573
Rails was not recognising a connection between an investor and the major
neutronc Nov 10, 2018
f668850
Implementing the Swap of a Private for a Share in the Operating Round.
neutronc Nov 10, 2018
fb9d4d0
Merge pull request #69 from neutronc/rails_2_maintenance
neutronc Nov 11, 2018
900370f
Startround Switch to next round was not triggered.
neutronc Nov 17, 2018
d18f91e
excludes local eclipse settings
neutronc Dec 3, 2018
c8f2041
Replacing obsolete Code in 1837
neutronc Nov 11, 2018
b99cfc6
Remving old Code - Fixing Startround Behaviour of KuK Startround
neutronc Dec 8, 2018
9b1ceeb
Fixes typo in 1870 Description
neutronc Dec 22, 2018
09f3da3
Fixes typo in 1870 Description
neutronc Dec 22, 2018
cfd97af
implementing Romoth Variant
neutronc Dec 22, 2018
a1b7357
Implement Romoth Variant
neutronc Dec 22, 2018
62fd011
Adding missing Text Locales
neutronc Dec 24, 2018
1504344
Preparation and implementation of Actions for introducing the Special
neutronc Dec 25, 2018
d60f21a
Preparation and implementation of Actions for introducing the Special
neutronc Dec 25, 2018
4947db9
Fix error in Saving and loading the SetDividend Action for the new
neutronc Dec 25, 2018
6ae0cd0
Fix error in Saving and loading the SetDividend Action for the new
neutronc Dec 25, 2018
a33ff38
Updating Gamestatus Class to show direct Income
neutronc Dec 26, 2018
aaa2ee0
preparing 1837 2nd Edition Setup Variant
neutronc Jan 1, 2019
7b6515f
Setup 1837 2nd Edition further changes.
Jan 3, 2019
54bfe9b
Fixing Südbahn Floating Problem
neutronc Jan 4, 2019
931e862
Merge branch 'rails_2_maintenance' of
neutronc Jan 4, 2019
1fe9bfc
Fixed a mistake with the variant introduced 2nd-ED Startround causing
neutronc Jan 6, 2019
c1818c0
Work on the Major Coal Exchange Mechanismn
neutronc Feb 10, 2019
1daa1bb
Redoing the reservedHex Model for PublicCompanies
neutronc May 11, 2019
159021d
Revert "Redoing the reservedHex Model for PublicCompanies"
neutronc May 20, 2019
7daf6ff
Fixing the problem with reserved hexes not being able to be upgraded if
neutronc May 28, 2019
59fdde4
Merge pull request #74 from neutronc/rails_2_maintenance
neutronc May 28, 2019
9c890b0
Working on Coal Exchange Round for 1837
neutronc May 28, 2019
ba81c85
Working on 1837 Coal Round Mechanismn
neutronc Jun 14, 2019
12b1b55
1837-Working on Minor Coal Exchange
neutronc Jun 23, 2019
5a1947b
Fixed a Bug in regard to shareselling while dumping the presidency.
neutronc Jan 3, 2020
3016fb5
Merge branch 'rails_2_maintenance' of https://github.com/neutronc/Rai…
neutronc Jan 3, 2020
b392b6d
Working on multiple share selling problems in 1835. Its not allowed to
neutronc Mar 2, 2020
32eeea8
Revert "Working on multiple share selling problems in 1835. Its not a…
neutronc Mar 2, 2020
0d3e5dc
Working on multiple share selling problems in 1835. Its not allowed to
neutronc Mar 2, 2020
1910d68
Fixing the SellShares problem stemming from the newly introduced
neutronc Mar 4, 2020
1017cde
Fixing Share selling problematic arising from 1835 share problem of not
neutronc Mar 7, 2020
2f60f23
Savegames adjusted for various problems including missing coal rights...
neutronc Mar 7, 2020
ef5c1bf
Fixing the shareselling mechanismn in 1835 and adding a specific
neutronc Mar 9, 2020
8e5a0ea
test case for shareselling corrected
neutronc Mar 13, 2020
64e4368
Merge pull request #79 from neutronc/rails_2_maintenance
neutronc Mar 13, 2020
4b1b1c7
Fixing Bug reported by Peter De Boer: Player cant sell any shares in
neutronc Mar 13, 2020
8698f48
1837 relict in maintenance code
neutronc Mar 14, 2020
60ab708
Merge pull request #86 from neutronc/rails_2_maintenance
neutronc Mar 16, 2020
dfb54ba
Merge pull request #87 from neutronc/rails_2_maintenance
neutronc Mar 16, 2020
3464de4
Fix for Issue #90
neutronc Mar 18, 2020
ebf5ed6
Recreated Test game reports, all games pass
neutronc Mar 18, 2020
7d27d3a
Merge pull request #91 from neutronc/rails_2_maintenance
neutronc Mar 18, 2020
ba99362
Merge remote-tracking branch 'upstream/rails_2_maintenance' into enha…
madoar Apr 18, 2020
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
38 changes: 0 additions & 38 deletions .classpath

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/java/net/sf/rails/algorithms/NetworkVertex.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ public boolean isMajor(){
public boolean isMinor(){
return (stationType != null && stationType == StationType.MINOR);
}

public boolean isMine( ) {
return (stationType != null && stationType == StationType.COALMINE);
}

public boolean isMine( ) {
return (stationType != null && stationType == StationType.COALMINE);
Expand Down
84 changes: 83 additions & 1 deletion src/main/java/net/sf/rails/game/OperatingRound.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ public boolean process(PossibleAction action) {
&& ((UseSpecialProperty) selectedAction).getSpecialProperty() instanceof SpecialRight) {

result = buyRight((UseSpecialProperty) selectedAction);

} else if (selectedAction instanceof UseSpecialProperty
&& ((UseSpecialProperty) selectedAction).getSpecialProperty() instanceof ExchangeForShare) {

useSpecialProperty((UseSpecialProperty)selectedAction);


} else if (selectedAction instanceof UseSpecialProperty
&& ((UseSpecialProperty) selectedAction).getSpecialProperty() instanceof ExchangeForShare) {
Expand Down Expand Up @@ -332,6 +338,82 @@ public boolean process(PossibleAction action) {

return result;
}

public boolean useSpecialProperty(UseSpecialProperty action) {

SpecialProperty sp = action.getSpecialProperty();

if (sp instanceof ExchangeForShare) {

return executeExchangeForShare(action, (ExchangeForShare) sp);

} else {
return false;
}
}

public boolean executeExchangeForShare (UseSpecialProperty action, ExchangeForShare sp) {

PublicCompany publicCompany =
companyManager.getPublicCompany(sp.getPublicCompanyName());
PrivateCompany privateCompany = (PrivateCompany)sp.getOriginalCompany();
Owner owner= privateCompany.getOwner();
Player player = null;
String errMsg = null;
boolean ipoHasShare = ipo.getShare(publicCompany) >= sp.getShare();
boolean poolHasShare = pool.getShare(publicCompany) >= sp.getShare();

while (true) {

/* Check if the private is owned by a player */
if (!(owner instanceof Player)) {
errMsg =
LocalText.getText("PrivateIsNotOwnedByAPlayer",
privateCompany.getId());
break;
}

player = (Player) owner;

/* Check if a share is available */
if (!ipoHasShare && !poolHasShare) {
errMsg =
LocalText.getText("NoSharesAvailable",
publicCompany.getId());
break;
}

break;
}
if (errMsg != null) {
DisplayBuffer.add(this, LocalText.getText(
"CannotSwapPrivateForCertificate",
player.getId(),
privateCompany.getId(),
sp.getShare(),
publicCompany.getId(),
errMsg ));
return false;
}



Certificate cert =
ipoHasShare ? ipo.findCertificate(publicCompany,
false) : pool.findCertificate(publicCompany,
false);
cert.moveTo(player);
ReportBuffer.add(this, LocalText.getText("SwapsPrivateForCertificate",
player.getId(),
privateCompany.getId(),
sp.getShare(),
publicCompany.getId()));
sp.setExercised();
privateCompany.setClosed();

return true;
}


public boolean useSpecialProperty(UseSpecialProperty action) {

Expand Down Expand Up @@ -2533,7 +2615,7 @@ public void payout(int amount) {
recipient.getId(), partText, shares,
operatingCompany.value().getShareUnit()));
}

// Move the token
operatingCompany.value().payout(amount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class NationalFormationRound extends StockRound {

public NationalFormationRound(GameManager parent, String id) {
super(parent, id);
// TODO Auto-generated constructor stub
}


Expand Down Expand Up @@ -488,7 +487,7 @@ protected void finishRound() {

@Override
public String toString() {
return "1837 KuKFormationRound";
return "1837 NationalFormationRound";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ private static SortedSet<Integer> presidentSellMultiple(PublicCompany company, P
int potentialShareNumber = potential.getPortfolioModel().getShare(company);
int shareNumberDumpDifference = presidentShareNumber - potentialShareNumber;
boolean presidentShareOnly = false;

if (presidentCert.getShare() == presidentShareNumber) { // Only President Share to be sold...
presidentShareOnly = true;
}

// ... if this is less than what the pool allows => goes back to non-president selling
int poolAllows = poolAllowsShareNumbers(company);
if ((shareNumberDumpDifference <= poolAllows) && (!presidentShareOnly)) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/sf/rails/game/financial/StockRound.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ public void setSellableShares() {
continue;
}

//For a president certificate only the number is 2.. but it may also be 2 if the player has more than just the president certificate..
for (int i = 1; i <= number; i++) {
if (checkIfSplitSaleOfPresidentAllowed()) {
// check if selling would dump the company
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ImmutableMultimap<String, PublicCertificate> getCertificatesByType(PublicCompany
SortedMultiset<Integer> getCertificateTypeCounts(PublicCompany company) {
ImmutableSortedMultiset.Builder<Integer> certCount = ImmutableSortedMultiset.naturalOrder();
for (PublicCertificate cert : getCertificates(company)) {
if (!cert.isPresidentShare()) {
if (!cert.isPresidentShare()) {
certCount.add(cert.getShares());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected int getBuyPrice (BuyCertificate action, StockSpace currentSpace) {
}

// The sell-in-same-turn-at-decreasing-price option does not apply here

// change: check exactly how it differs here
// requires: do a parameterization
@Override
Expand Down Expand Up @@ -246,11 +246,11 @@ public boolean done(NullAction action, String playerName,

/* (non-Javadoc)
* @see net.sf.rails.game.StockRound#mayPlayerSellShareOfCompany(net.sf.rails.game.PublicCompany)
*/
*/
@Override
public boolean mayPlayerSellShareOfCompany(PublicCompany company) {
if (!super.mayPlayerSellShareOfCompany(company) )
{
if (!super.mayPlayerSellShareOfCompany(company) )
{
return false;
}
else {
Expand All @@ -259,13 +259,13 @@ public boolean mayPlayerSellShareOfCompany(PublicCompany company) {
* But if he has sold a share in this round he is allowed to sell dump the presidency...
*
* */
if (company.getPresident() == currentPlayer) {
if (company.getPresident() == currentPlayer) {
if (PlayerShareUtils.poolAllowsShareNumbers(company) >1) return true;
}
}
return true;
}

@Override
protected boolean checkIfSplitSaleOfPresidentAllowed() {
// in 1835 its not allowed to Split the President Certificate on sale
Expand All @@ -278,5 +278,5 @@ protected void setPriority(String string) {
super.setPriority(string);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@

import net.sf.rails.common.GuiDef;
import net.sf.rails.game.GameManager;
import net.sf.rails.game.NationalFormationRound;
import net.sf.rails.game.OperatingRound;
import net.sf.rails.game.Phase;
import net.sf.rails.game.Player;
import net.sf.rails.game.RailsRoot;
import net.sf.rails.game.Round;
import net.sf.rails.game.StartPacket;
import net.sf.rails.game.StartRound;
import net.sf.rails.game.OperatingRound;
import net.sf.rails.game.financial.NationalFormationRound;
import net.sf.rails.game.specific._1837.OperatingRound_1837;
import net.sf.rails.game.specific._18EU.FinalMinorExchangeRound;
import net.sf.rails.game.state.BooleanState;
import net.sf.rails.game.state.GenericState;
import net.sf.rails.game.state.IntegerState;
import net.sf.rails.game.state.BooleanState;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.slf4j.LoggerFactory;

import net.sf.rails.common.DisplayBuffer;
import net.sf.rails.common.GameOption;
import net.sf.rails.common.LocalText;
import net.sf.rails.common.ReportBuffer;
import net.sf.rails.game.GameDef;
Expand All @@ -27,6 +28,7 @@
import net.sf.rails.game.financial.NationalFormationRound;
import net.sf.rails.game.special.ExchangeForShare;
import net.sf.rails.game.special.SpecialProperty;
import net.sf.rails.game.specific._18EU.GameManager_18EU;
import net.sf.rails.game.state.BooleanState;
import net.sf.rails.game.state.Currency;
import net.sf.rails.game.state.MoneyOwner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import net.sf.rails.game.state.Owner;

public class PublicCompany_1837 extends PublicCompany {

public PublicCompany_1837(RailsItem parent, String id) {
super(parent, id);
}
Expand Down Expand Up @@ -68,6 +68,6 @@ public boolean isSoldOut() {
/**
* @param coalMineTreasuryBonus the coalMineTreasuryBonus to set
*/


}
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,9 @@ private void setNextSelectingPlayer() {
playerManager.setCurrentToNextPlayerAfter(selectingPlayer.value());
}

@Override
public String getHelp() {
return "1837 Start Round help text";
}

}
1 change: 0 additions & 1 deletion src/main/java/net/sf/rails/ui/swing/GameStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ protected void initFields() {
wideGapPosition, true);
}


addField(new Caption(LocalText.getText("WORTH")), 0,
playerWorthYOffset, 1, 1, 0, true);
for (int i = 0; i < np; i++) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/sf/rails/ui/swing/GameUIManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ public void updateUI() {
log.debug("Correction overrides active window: status window active");
}


// Active window settings are handled last.
// Side effects: the active window is made visible and put on top.
if (uiHints.getActivePanel() == GuiDef.Panel.START_ROUND) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.sf.rails.sound.SoundManager;
import net.sf.rails.ui.swing.ORPanel;
import net.sf.rails.ui.swing.ORUIManager;
import net.sf.rails.ui.swing.ORWindow;
import net.sf.rails.ui.swing.gamespecific._1880.StartRoundWindow_1880;
import rails.game.action.SetDividend;

Expand Down
Loading