diff options
| author | Mario Kilies <MarioKilies@GMX.net> | 2011-01-15 02:47:42 +0100 |
|---|---|---|
| committer | Mario Kilies <MarioKilies@GMX.net> | 2011-01-15 02:47:42 +0100 |
| commit | 9e189799f8b32c2e151ddac8aeefda5be13a9231 (patch) | |
| tree | 3152c7f14fdbd46d32a6790b365fcf4f5e30c4cc /src/main.c | |
| parent | 9563ca807cacff851a06861a6a4cff8a37043b0e (diff) | |
Command line parameters hacked in. Moved display stuff in the game loop.
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 51 |
1 files changed, 20 insertions, 31 deletions
@@ -1,43 +1,32 @@ #include <stdlib.h> #include <curses.h> #include "ui.h" +#include "game.h" int main(int argc, char **argv) { - // Example data set for table cards window - const tablestacks ts = {{1, 2, 3, 4, 101}, {6, 7, 53, 0, 0}, {11, 55, 0, 0, 0}, {17, 29, 36, 42, 0}}; + uint16_t port = 0; + char *addr; + bool servermode = false; - // The stack points window uses ts, too, so there is no separate data set - - // Example data set for current state window - pnoc_t pnoc[10] = { - {"$you", 10}, - {"1234567890", 23}, - {"baz", 38}, - {"foo_bar", 14}, - {"lolcat", 60}, - {"blablub123", 15}, - {"abcdefg", 103}, - {"hello", 98}, - {"hornoxe", 33}, - {"1337nick", 74} - }; - pnoc_sort(pnoc, 10); - const uint8_t num_players = 10; - const uint32_t score = 10; - - // Example data set for hand cards window - hand h = {22, 0, 12, 85, 27, 69, 78, 0, 77, 0}; - hand_sort(h); + if (argc < 2) + { + printf("usage: '%s address port' for client mode, or '%s port' for server mode\n", argv[0], argv[0]); + return EXIT_SUCCESS; + } + else if (argc == 2) // Server mode + { + servermode = true; + port = atoi(argv[1]); + } + else if (argc == 3) // Client mode + { + addr = argv[1]; + port = atoi(argv[2]); + } ui_init(); - ui_display_wnd_table_cards(ts, false, 0); - ui_display_wnd_stack_points(ts, false, 0); - ui_display_wnd_current_state(pnoc, num_players, 2, score); - ui_display_wnd_hand_cards(h, false, 0); - - ui_choose_card(h); + start_game(servermode, addr, port); ui_fini(); - return EXIT_SUCCESS; } |
