summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorMario Kilies <MarioKilies@GMX.net>2011-01-16 07:57:28 +0100
committerMario Kilies <MarioKilies@GMX.net>2011-01-16 07:57:28 +0100
commitfac5e3de0929c3abb73da552efbda6d641136588 (patch)
tree2d1c20909525e657237389a9825e3c3a73dad726 /src/main.c
parent08a3c0b9979857e708865d2756ba057bb1c664ee (diff)
Simplified net_recv(). Refactored 'hand' from array definition to hand_t struct definition.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 6e68d35..9f0bb65 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,7 @@
#include <stdlib.h>
#include <curses.h>
+#include <string.h>
+#include <unistd.h>
#include "ui.h"
#include "game.h"
#include "net.h"
@@ -22,9 +24,9 @@ int main(int argc, char **argv)
int ssock;
int* csocks;
player_list players;
- int opponents = 3;
+ int opponents = 1;
const char* nickname = "deki";
- const hand testhand = { 12, 23, 35, 42, 55, 57, 70, 81, 103, 0 };
+ const hand_t testhand = { { 12, 23, 35, 42, 55, 57, 70, 81, 103, 0 } };
servermode = true;
port = argv[1];
@@ -51,7 +53,7 @@ int main(int argc, char **argv)
// send test hand
for(int i=0; i<opponents; i++)
- server_deal_cards(csocks[i], testhand);
+ server_deal_cards(csocks[i], &testhand);
// cleanup
for(int i=0; i<players.count; i++)
@@ -64,7 +66,7 @@ int main(int argc, char **argv)
int sock;
player_list* players;
const char* nickname = "schnippi";
- hand* testhand;
+ hand_t *testhand;
addr = argv[1];
port = argv[2];
@@ -83,7 +85,7 @@ int main(int argc, char **argv)
testhand = net_recv(sock, msg_type_deal_cards);
printf("received cards: ");
for(int i=0; i<MAX_HAND_CARDS; i++)
- printf("%d, ", *testhand[i]);
+ printf("%d, ", testhand->cards[i]);
printf("\n");
// cleanup