diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-15 18:44:52 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-15 18:44:52 +0100 |
| commit | 8d1391507cbb943ecf17a8e4097f524da2505e32 (patch) | |
| tree | fa23300471c8359fed3e6bce8279f1b3830200f1 /src/main.c | |
| parent | d9b86b44ff96e7ca87af4c5dee7a61f61b55f603 (diff) | |
1. network fix: send also packet length in every packet after packet type
to be able to determine exact amount to recv
2. implement functions for sending/receiving dealt hands
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -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; } |
