From fcb3404ca7af554e49a00f39d0a2f471378abbc2 Mon Sep 17 00:00:00 2001 From: ac_stef Date: Wed, 15 Apr 2009 15:14:14 +0000 Subject: [PATCH] echo a reminder of your picked vote git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4338 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/resetbinds.cfg | 4 ++-- source/src/clientgame.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config/resetbinds.cfg b/config/resetbinds.cfg index a07d9ac1..7280aa5d 100644 --- a/config/resetbinds.cfg +++ b/config/resetbinds.cfg @@ -105,8 +105,8 @@ bind HOME "edittex 1 1" bind END "edittex 1 -1" bind PAGEUP "edittex 2 1" bind PAGEDOWN "edittex 2 -1" -bind F1 "vote 1" -bind F2 "vote 2" +bind "F1" [ && (vote 1) [ echo "you voted yes"] ] +bind "F2" [ && (vote 2) [ echo "you voted no" ] ] bind F3 "" bind F4 "" bind F5 "if $editing [ toggleocull ]" diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index d8c8cc87..383affe2 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -962,10 +962,10 @@ void scallvote(char *type, char *arg1, char *arg2) } } -void vote(int v) +int vote(int v) { - if(!curvote || v < 0 || v >= VOTE_NUM) return; - if(curvote->localplayervoted) { conoutf("\f3you voted already"); return; } + if(!curvote || v < 0 || v >= VOTE_NUM) return 0; + if(curvote->localplayervoted) { conoutf("\f3you voted already"); return 0; } ENetPacket *packet = enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE); ucharbuf p(packet->data, packet->dataLength); putint(p, SV_VOTE); @@ -973,9 +973,10 @@ void vote(int v) enet_packet_resize(packet, p.length()); sendpackettoserv(1, packet); // flowtron : 2008 11 06 : I don't think the following comments are still current - if(!curvote) { /*printf(":: curvote vanished!\n");*/ return; } // flowtron - happens when I call "/stopdemo"! .. seems the map-load happens in-between + if(!curvote) { /*printf(":: curvote vanished!\n");*/ return 0; } // flowtron - happens when I call "/stopdemo"! .. seems the map-load happens in-between curvote->stats[v]++; curvote->localplayervoted = true; + return 1; } void displayvote(votedisplayinfo *v) @@ -1018,7 +1019,7 @@ void voteresult(int v) void clearvote() { DELETEP(curvote); DELETEP(calledvote); } COMMANDN(callvote, scallvote, ARG_3STR); //fixme,ah -COMMAND(vote, ARG_1INT); +COMMAND(vote, ARG_1EXP); void cleanplayervotes(playerent *p) {