public class Mortgage { static String[] names = new String[Monop.MAX_PRP() + 2]; static String[] morg_coms = { "quit", "print", "where", "own holdings", "holdings", "mortgage", "unmortgage", "buy", "sell", "card", "pay", "trade", "resign", "save game", "restore game", null}; static String square = new String(); static int num_good; static int got_houses; static { for (int i = 0;i < Monop.MAX_PRP() + 2;i++) { names[i] = new String(); } } public static void mortgage() { int prop = 0; while (true) { if (set_mlist() == 0) { if (got_houses != 0) { System.out.println("You can't mortgage property with houses on it."); } else { System.out.println("You don't have any un-mortgaged property."); } return; } if (num_good == 1) { System.out.println("Your only mortageable property is " + (names[0])); if (Misc.getyn("Do you want to mortgage it? ") == 0) { m(square.charAt(0)); } return; } prop = GetInput.getinp("Which property do you want to mortgage? ", names); if (prop == num_good) { return; } m(square.charAt(prop)); Misc.notify1(); } } static int set_mlist() { Own_st op = null; num_good = 0; for (op = Monop.cur_p.own_list;op != null;op = op.next) { if ( ! op.sqr.desc.morg) { if (op.sqr.type == Monop.PRPTY && op.sqr.desc.houses != 0) { got_houses++; } else { names[num_good] = op.sqr.name; square = CStringUtils.setCharAt(square, num_good++, Monop.sqnum(op.sqr)); } } } names[num_good++] = "done"; names[num_good--] = null; return num_good; } static void m(int prop) { int price = Monop.board[prop].cost / 2; Monop.board[prop].desc.morg = true; System.out.println("That got you $" + price); Monop.cur_p.money += price; } public static void unmortgage() { int prop = 0; while (true) { if (set_umlist() == 0) { System.out.println("You don't have any mortgaged property."); return; } if (num_good == 1) { System.out.println("Your only mortaged property is " + (names[0])); if (Misc.getyn("Do you want to unmortgage it? ") == 0) { unm(square.charAt(0)); } return; } prop = GetInput.getinp("Which property do you want to unmortgage? ", names); if (prop == num_good) { return; } unm(square.charAt(prop)); } } static int set_umlist() { Own_st op = null; num_good = 0; for (op = Monop.cur_p.own_list;op != null;op = op.next) { if (op.sqr.desc.morg) { names[num_good] = op.sqr.name; square = CStringUtils.setCharAt(square, num_good++, Monop.sqnum(op.sqr)); } } names[num_good++] = "done"; names[num_good--] = null; return num_good; } static void unm(int prop) { int price = Monop.board[prop].cost / 2; Monop.board[prop].desc.morg = false; price += price / 10; System.out.println("That cost you $" + price); Monop.cur_p.money -= price; set_umlist(); } static void force_morg() { Monop.fixing = true; Monop.told_em = Monop.fixing; while (Monop.cur_p.money <= 0) { fix_ex(GetInput.getinp("How are you going to fix it up? ", morg_coms)); } Monop.fixing = false; } static void fix_ex(int com_num) { Monop.told_em = false; Invoker.invoke(Monop.func[com_num]); Misc.notify1(); } }