X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2FNeonFun.mod%2Fgame_4wins.c;h=3b55d146ae024704461bc9d1e16af960ae5ef6d0;hb=c8e7ce1c57afaebf3996a6712c45f4c89c34ba44;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..3b55d14 100644 --- a/src/modules/NeonFun.mod/game_4wins.c +++ b/src/modules/NeonFun.mod/game_4wins.c @@ -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) {