Skip to content

Commit

Permalink
Added a getter for the currentDay and updated the RPGame constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Li committed Mar 1, 2015
1 parent b2d7c5b commit f886381
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 11 additions & 4 deletions MerchantRPGCSE2102/src/controller/RPGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public class RPGame {
private ArrayList<String> merchantInventoryList3 = new ArrayList<String>(); // merchant 3's inventory list
private ArrayList<String> playerInventoryList = new ArrayList<String>(); // the player's inventory list
private Player _player;
private Merchant _merchant1;
private Merchant _merchant2;
private Merchant _merchant3;
private Merchant _merchant1, _merchant2, _merchant3;
private boolean _movement;
private int _currentDay;
private int _transactionLimit;
Expand All @@ -25,6 +23,7 @@ public class RPGame {
public RPGame() {
_currentDay = 1;
_transactionLimit = 3;
inventoryFromFile();
}

/**
Expand Down Expand Up @@ -235,6 +234,15 @@ else if(merchantNum == 2)
else
return _merchant3;
}

/**
* Getter for the current day number
* @return The day number
*/
public int getDay()
{
return _currentDay;
}

/**
* Main method used to test the GUI components since test classes do not maintain the GUI
Expand All @@ -243,7 +251,6 @@ else if(merchantNum == 2)
public static void main(String[] args)
{
RPGame _rpg = new RPGame();
_rpg.inventoryFromFile();
_rpg.buildMerchants();
ArrayList<String> playerInventory = _rpg.getMerchantInventoryList(1);
playerInventory.addAll(_rpg.getMerchantInventoryList(2));
Expand Down
3 changes: 1 addition & 2 deletions MerchantRPGCSE2102/src/tests/TestRPGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class TestRPGame extends TestCase
public void setup()
{
game = new RPGame();
game.inventoryFromFile();
game.buildMerchants();
ArrayList<String> playerInventory = game.getMerchantInventoryList(1);
playerInventory.addAll(game.getMerchantInventoryList(2));
Expand All @@ -37,6 +36,6 @@ public void testFile()
public void testDailyCycle()
{
setup();

assertEquals(1, game.getDay());
}
}

0 comments on commit f886381

Please sign in to comment.