X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2FNeonFun.mod%2Fgame_4wins.c;h=7dd7ae886fb928a98b3340f6247d6c7202f556c5;hb=78e040af3fcc36ab684611c0f98b4381ff420878;hp=88503a184cec1bfcc15869a88eb10c66d075db3a;hpb=eb2aab55a1f97b329c0409d32d35d1f112facedb;p=NeonServV5.git diff --git a/src/modules/NeonFun.mod/game_4wins.c b/src/modules/NeonFun.mod/game_4wins.c index 88503a1..7dd7ae8 100644 --- a/src/modules/NeonFun.mod/game_4wins.c +++ b/src/modules/NeonFun.mod/game_4wins.c @@ -1,4 +1,4 @@ -/* game_4wins.c - NeonServ v5.4 +/* game_4wins.c - NeonServ v5.5 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -78,7 +78,7 @@ int fourwins_check_win(struct fourwins_game *game, int x, int y) { else break; } - for(ix = x, iy = y; ix >= 0 && iy >= 0; ix--, iy--) { + for(ix = x-1, iy = y-1; ix >= 0 && iy >= 0; ix--, iy--) { if(game->matrix[ix][iy].field == field) fc++; else @@ -96,7 +96,7 @@ int fourwins_check_win(struct fourwins_game *game, int x, int y) { else break; } - for(ix = x, iy = y; ix >= 0 && iy < FOURWINS_MATRIX_HEIGHT; ix--, iy++) { + for(ix = x-1, iy = y+1; ix >= 0 && iy < FOURWINS_MATRIX_HEIGHT; ix--, iy++) { if(game->matrix[ix][iy].field == field) fc++; else @@ -148,7 +148,8 @@ void fourwins_free_game(struct fourwins_game *game) { if(prev) prev->next = game->next; else - fourwins_active_games->next = game->next; + fourwins_active_games = game->next; + break; } else prev = cgame; } @@ -178,29 +179,6 @@ void fourwins_event_part(struct ChanUser *chanuser) { } } -void fourwins_event_quit(struct UserNode *user) { - struct fourwins_game *game; - for(game = fourwins_active_games; game; game = game->next) { - if(game->player[0]->user == user || game->player[1]->user == user) { - fourwins_reply(game, "NF_4WINS_GAME_CLOSED"); - fourwins_free_game(game); - return; - } - struct fourwins_guest *guest, *prev_guest = NULL; - for(guest = game->guests; guest; guest = guest->next) { - if(guest->chanuser->user == user) { - if(prev_guest) - prev_guest->next = guest->next; - else - game->guests = guest->next; - free(guest); - break; - } else - prev_guest = guest; - } - } -} - void fourwins_event_freechan(struct ChanNode *chan) { struct fourwins_game *game; for(game = fourwins_active_games; game; game = game->next) {