From ac4f9117d831b3cfe9e51dc461bd4f8dacb5e77f Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sat, 15 Nov 2008 22:15:39 +0000 Subject: [PATCH] clean up votes when player is disconnected git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3529 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 6 ++++++ source/src/entity.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index d96faa7b..5f828f3d 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -994,6 +994,12 @@ void clearvote() { DELETEP(curvote); DELETEP(calledvote); } COMMANDN(callvote, scallvote, ARG_3STR); //fixme,ah COMMAND(vote, ARG_1INT); +void cleanplayervotes(playerent *p) +{ + if(calledvote && calledvote->owner==p) calledvote->owner = NULL; + if(curvote && curvote->owner==p) curvote->owner = NULL; +} + void whois(int cn) { addmsg(SV_WHOIS, "ri", cn); diff --git a/source/src/entity.h b/source/src/entity.h index aa3ad325..61d614ae 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -380,12 +380,14 @@ struct playerent : dynent, playerstate extern void detachsounds(playerent *owner); extern void removedynlights(physent *owner); extern void zapplayerflags(playerent *owner); + extern void cleanplayervotes(playerent *owner); extern physent *camera1; extern void togglespect(); removebounceents(this); detachsounds(this); removedynlights(this); zapplayerflags(this); + cleanplayervotes(this); if(this==camera1) togglespect(); }