- bugfix for team switching vote calculation

This commit is contained in:
Mark Vejvoda 2011-09-23 19:31:47 +00:00
parent 37fd0d6c71
commit 4d31968966

View File

@ -778,7 +778,8 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
}
// If > 50% of team vote yes, switch th eplayers team
if(newTeamVotedYes / newTeamTotalMemberCount > 0.5) {
if(newTeamTotalMemberCount > 0 && newTeamVotedYes > 0 &&
newTeamVotedYes / newTeamTotalMemberCount > 0.5) {
Faction *faction = world->getFaction(factionIndex);
int oldTeam = faction->getTeam();
faction->setTeam(vote->newTeam);