aboutsummaryrefslogtreecommitdiff
path: root/player_turn.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-02-21 18:06:11 -0500
committerNathan Vance <nathav63@gmail.com>2015-02-21 18:06:11 -0500
commite723087996663d5a1461297533e57bd2d8174585 (patch)
treedfd2584267d434c97dd543e8dc0d354a2060f75b /player_turn.c
parentAdded view for all wonders (diff)
download7w-e723087996663d5a1461297533e57bd2d8174585.tar.gz
7w-e723087996663d5a1461297533e57bd2d8174585.tar.bz2
7w-e723087996663d5a1461297533e57bd2d8174585.zip
Major view improvements
Diffstat (limited to 'player_turn.c')
-rw-r--r--player_turn.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/player_turn.c b/player_turn.c
index 8c0f889..203f430 100644
--- a/player_turn.c
+++ b/player_turn.c
@@ -6,8 +6,10 @@ void io_printhand(int x, int y, int player, int cursor);
void io_printcard(int x, int y, int era, int card);
int io_getkey();
void data_passturn();
-void io_clearscreen();
void data_nextera();
+int data_numplayers();
+void view_refresh(int focus, int cursor, int player);
+int wonder_numstages(int player);
void player_turn(int player)
{
@@ -15,10 +17,9 @@ void player_turn(int player)
int numcards;
for(numcards = 0; numcards < 7 && hand[numcards] > -1; numcards++);
int cursor = 0;
+ int focus = data_numplayers();
while(1) {
- io_clearscreen();
- io_printhand(0, 0, player, cursor);
- io_printcard(0, 8, data_getera(), hand[cursor]);
+ view_refresh(focus, cursor, player);
switch(io_getkey()) {
case UP: cursor--;
break;
@@ -26,11 +27,21 @@ void player_turn(int player)
break;
case RIGHT: data_passturn();
break;
+ case LEFT: player = (player+1)%data_numplayers();
+ break;
case ENTER: data_nextera();
break;
+ case '\t': focus = (focus+1)%(data_numplayers()+1);
+ break;
default: break;
}
- if(cursor < 0) cursor = numcards-1;
- if(cursor >= numcards) cursor = 0;
+ if(focus == data_numplayers()) {
+ if(cursor < 0) cursor = numcards-1;
+ if(cursor >= numcards) cursor = 0;
+ }
+ else {
+ if(cursor < 0) cursor = wonder_numstages((player+focus)%data_numplayers())-1;
+ cursor = cursor % wonder_numstages((player+focus)%data_numplayers());
+ }
}
}
bgstack15