From: pk910 Date: Thu, 22 Mar 2012 19:29:54 +0000 (+0100) Subject: fixed 4wins game counter and prevent players playing against their selves... X-Git-Tag: v5.4~29 X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=f3648263f6b776e2785e13fe96c73c379abdba9a fixed 4wins game counter and prevent players playing against their selves... --- diff --git a/src/modules/NeonFun.mod/cmd_neonfun.c b/src/modules/NeonFun.mod/cmd_neonfun.c index 1957498..031b705 100644 --- a/src/modules/NeonFun.mod/cmd_neonfun.c +++ b/src/modules/NeonFun.mod/cmd_neonfun.c @@ -52,6 +52,7 @@ static const struct default_language_entry msgtab[] = { {"NF_UNO_NAME", "Name"}, {"NF_UNO_WON_GAMES", "Won Games"}, {"NF_UNO_TOTAL_WON_GAMES", "Total won Games"}, + {"NF_UNO_LESS_PLAYERS", "There are not enough players to start the game."}, {"NF_4WINS_NOT_YOUR_TURN", "Wait your turn!"}, {"NF_4WINS_INVALID_COLUMN", "invalid column!"}, @@ -70,6 +71,7 @@ static const struct default_language_entry msgtab[] = { {"NF_4WINS_VIEWING_GAME", "You are now viewing the game."}, {"NF_4WINS_GAME_CLOSED", "Game aborted."}, {"NF_4WINS_TIMEOUT", "Game aborted (timeout)."}, + {"NF_4WINS_SELF", "You may not play against yourself."}, {NULL, NULL} }; diff --git a/src/modules/NeonFun.mod/cmd_neonfun_4wins.c b/src/modules/NeonFun.mod/cmd_neonfun_4wins.c index a282a14..2aafcb6 100644 --- a/src/modules/NeonFun.mod/cmd_neonfun_4wins.c +++ b/src/modules/NeonFun.mod/cmd_neonfun_4wins.c @@ -36,6 +36,11 @@ CMD_BIND(neonfun_cmd_4wins) { timeq_del(game->timer); game->timer = NULL; game->state = FOURWINS_STATE_RUNNING; + if((game->player[0]->user->flags & USERFLAG_ISAUTHED) && (game->player[1]->user->flags & USERFLAG_ISAUTHED) && !stricmp(game->player[0]->user->auth, game->player[1]->user->auth)) { + fourwins_reply(game, "NF_4WINS_SELF"); + fourwins_free_game(game); + return; + } fourwins_reply(game, "NF_4WINS_START", user->nick); if((game->player[0]->user->flags & USERFLAG_ISAUTHED)) { char *tmp; @@ -74,6 +79,10 @@ CMD_BIND(neonfun_cmd_4wins) { reply(getTextBot(), user, "NS_USER_UNKNOWN", argv[0]); return; } + if(opp_user == user) { + reply(getTextBot(), user, "NF_4WINS_SELF"); + return; + } struct ChanUser *opponent = getChanUser(opp_user, chan); if(!opponent) { reply(getTextBot(), user, "NF_4WINS_OPPONENT_NOT_IN_CHAN", opp_user->nick); diff --git a/src/modules/NeonFun.mod/game_uno.c b/src/modules/NeonFun.mod/game_uno.c index 4f17aeb..1500c24 100644 --- a/src/modules/NeonFun.mod/game_uno.c +++ b/src/modules/NeonFun.mod/game_uno.c @@ -276,7 +276,7 @@ TIMEQ_CALLBACK(uno_game_wait_timeout) { struct uno_game *game = data; game->timer = NULL; if(game->players == 1) { - //TEXT: too less users + uno_reply(game, NULL, "NF_UNO_LESS_PLAYERS"); uno_free_game(game); return; }