fixed UNO game
authorpk910 <philipp@zoelle1.de>
Tue, 27 Mar 2012 03:12:22 +0000 (05:12 +0200)
committerpk910 <philipp@zoelle1.de>
Tue, 27 Mar 2012 03:22:08 +0000 (05:22 +0200)
src/modules/NeonFun.mod/cmd_neonfun_uno.c
src/modules/NeonFun.mod/game_uno.c

index 47df483cabcf043a431dbb1eeaf70de1a7888a5f..b2ba1e6d103580235b525f1d541583f8389e12a3 100644 (file)
@@ -47,6 +47,7 @@ CMD_BIND(neonfun_cmd_uno) {
         player->chanuser = chanuser;
         player->count = 0;
         player->cards = NULL;
+        player->timeout = 0;
         player->prev = last_player;
         player->next = NULL;
         last_player->next = player;
index 0fc95026f7a8a0f578e9fa32b30ad7027d1cc68e..0e2c0280a86131d73c5aea42e661297187395cfa 100644 (file)
@@ -479,7 +479,7 @@ struct uno_card *uno_parse_card(struct uno_game *game, struct uno_player *player
 int uno_check_card_valid(struct uno_game *game, struct uno_card *card) {
     if(game->take_cards_pending && card->card != game->top_card->card)
         return 1;
-    if(card->color == UNO_COLOR_BLACK)
+    if(card->color == UNO_COLOR_BLACK || game->top_card->color == UNO_COLOR_BLACK)
         return 0;
     if(card->color != game->top_card->color && card->card != game->top_card->card)
         return 1;
@@ -510,6 +510,8 @@ void uno_play_card(struct uno_game *game, struct uno_player *player, struct uno_
         uno_reply(game, NULL, "NF_UNO_USER_WIN", game->active_player->chanuser->user->nick);
         if(player->prev)
             player->prev->next = player->next;
+        else
+            game->player = player->next;
         if(player->next)
             player->next->prev = player->prev;
         player->next = NULL;