summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 62c3ce1..1c2946b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,6 +4,7 @@
#include "game.h"
#include "net.h"
#include "player.h"
+#include "hand.h"
int main(int argc, char **argv)
{
@@ -23,6 +24,7 @@ int main(int argc, char **argv)
struct player_list players;
int opponents = 3;
const char* nickname = "deki";
+ const hand testhand = { 12, 23, 35, 42, 55, 57, 70, 81, 103, 0 };
servermode = true;
port = argv[1];
@@ -47,6 +49,10 @@ int main(int argc, char **argv)
// start game and send player list to clients
server_start_game(csocks, opponents, &players);
+ // send test hand
+ for(int i=0; i<opponents; i++)
+ server_deal_cards(csocks[i], testhand);
+
// cleanup
for(int i=0; i<players.count; i++)
free(players.names[i]);
@@ -58,6 +64,7 @@ int main(int argc, char **argv)
int sock;
struct player_list* players;
const char* nickname = "schnippi";
+ hand* testhand;
addr = argv[1];
port = argv[2];
@@ -72,15 +79,23 @@ int main(int argc, char **argv)
for(int i=0; i<players->count; i++)
printf("Player %d: %s\n", i, players->names[i]);
+ // receive test hand
+ testhand = client_recv(sock, msg_type_deal_cards);
+ printf("received cards: ");
+ for(int i=0; i<MAX_HAND_CARDS; i++)
+ printf("%d, ", *testhand[i]);
+ printf("\n");
+
// cleanup
for(int i=0; i<players->count; i++)
free(players->names[i]);
free(players);
+ free(testhand);
close(sock);
}
- ui_init();
- start_game(servermode, addr, port);
- ui_fini();
+ //ui_init();
+ //start_game(servermode, addr, port);
+ //ui_fini();
return EXIT_SUCCESS;
}