aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-03-12 22:23:08 -0400
committerNathan Vance <nathav63@gmail.com>2015-03-12 22:23:08 -0400
commit9dd5bd8c4f57143c365088ba2e964f339189f781 (patch)
tree1678c5bf126cb7ecaf35a6c4a9fdcc32dd745663
parentNow cannot buy two of the same card (diff)
download7w-9dd5bd8c4f57143c365088ba2e964f339189f781.tar.gz
7w-9dd5bd8c4f57143c365088ba2e964f339189f781.tar.bz2
7w-9dd5bd8c4f57143c365088ba2e964f339189f781.zip
Fixed bug causing trade to print incorrectly
-rw-r--r--io.c9
-rw-r--r--messenger.c6
-rw-r--r--player_turn.c8
-rw-r--r--trade.c2
4 files changed, 10 insertions, 15 deletions
diff --git a/io.c b/io.c
index bec7045..c0d6358 100644
--- a/io.c
+++ b/io.c
@@ -193,22 +193,19 @@ int io_printhand(int x, int y, int player, int cursor)
{
int *hand = data_gethand(player);
int i;
- int cursed = 0;
io_printborder(x, y++, 28);
y = io_printtext(x, y, 28, " Hand");
for(i = 0; hand[i] != -1 && i < 7; i++) {
io_printname(x, y++, data_getera(), hand[i]);
if(i == cursor) {
mvprintw(y-1, x+25, "*");
- cursed = 1;
}
}
y = io_printtext(x, y, 28, " Trade...");
- if(i == cursor) {
+ if(i == cursor)
mvprintw(y-1, x+25, "*");
- //trade_print(x, y, player, -1, -1);
- }
- else if(cursed) io_printcard(x, y, data_getera(), hand[cursor], player);
+ else if(cursor >= 0 && cursor < 7 && hand[cursor] != -1)
+ y = io_printcard(x, y, data_getera(), hand[cursor], player);
else io_printborder(x, y++, 28);
return y;
}
diff --git a/messenger.c b/messenger.c
index 8881c9b..ba49785 100644
--- a/messenger.c
+++ b/messenger.c
@@ -33,14 +33,14 @@ void posthelp()
int postoptions(int x, int y)
{
- int width = 26;
+ int width = 28;
int yorig = y;
int cursor = 0;
- char* a = "Buy Sell Wonder Cancel";
+ char* a = "Buy Sell Wonder Cancel";
char* b = " *";
char* c = " *";
char* d = " *";
- char* e = " *";
+ char* e = " *";
while(1) {
y = yorig;
io_printborder(x, y++, width);
diff --git a/player_turn.c b/player_turn.c
index 891c565..ba35953 100644
--- a/player_turn.c
+++ b/player_turn.c
@@ -25,12 +25,12 @@ int postoptions(int x, int y);
int trade_routine(int x, int y, int player);
void trade_commit(int player);
-int player_build(int focus, int cursor, int player)
+int player_build(int focus, int cursor, int player, int y)
{
int *hand = data_gethand(player);
if(focus == data_numplayers()) {
if(hand[cursor] == -1) return 0;
- int choice = postoptions(62, 20);
+ int choice = postoptions(61, y);
if(choice == 0) {
if(data_hasbuiltname(player, data_getera(), hand[cursor])) {
postmessage("Cannot have two of the same card!");
@@ -75,7 +75,7 @@ void player_turn(int player)
case LEFT: focus--;
break;
case ENTER:
- if(player_build(focus, cursor, player)) {
+ if(player_build(focus, cursor, player, tradey)) {
trade_commit(player);
clearmessage();
return;
@@ -92,7 +92,7 @@ void player_turn(int player)
if(focus == data_numplayers()) {
if(cursor < 0) cursor = numcards-2;
if(cursor >= numcards-1) {
- if(trade_routine(61, tradey, player)) cursor = 0;
+ if(trade_routine(61, view_refresh(focus, cursor, player), player)) cursor = 0;
else cursor = numcards-2;
}
}
diff --git a/trade.c b/trade.c
index f5d8d60..4bfb625 100644
--- a/trade.c
+++ b/trade.c
@@ -16,7 +16,6 @@ int io_printtext(int xorigin, int y, int width, char* text);
void io_printplain(int x, int y, char *s);
void io_printcolor(int x, int y, int color, char *s);
char* getname(int res);
-int view_refresh(int focus, int cursor, int player);
char* itoa(int i);
static int tradebuffer[3][GOLD+1];
@@ -85,7 +84,6 @@ int* trade_gettradables(int player, int direction)
void trade_print(int x, int y, int player, int cursorx, int cursory)
{
- view_refresh(data_numplayers(), data_numcards(player), player);
char s[40];
int *east = trade_gettradables(player, 0);
int *west = trade_gettradables(player, 1);
bgstack15