Skip to content

Commit

Permalink
[BUGFIX] Fixing issue (dirty fix) for the negative counters. Closes #376
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvlk committed Jun 18, 2017
1 parent 28503fd commit cb44dab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyplanet/apps/contrib/mapinfo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. deprecated:: 0.4.0
Use ``pyplanet.apps.contrib.info`` instead!
"""
# TODO: Remove in 0.6.0.
# TODO: Remove in 0.7.0.

import logging
import asyncio
Expand All @@ -27,7 +27,7 @@ async def output_deprecated(self):
msg = [
'$f00$o\uf0a1 $z$s$f00$o$wDEPRECATION:$z$s$f55$o Please change your settings! $z$f55$s(\uf121 apps.py)',
'$f55Replace \'pyplanet.apps.contrib.mapinfo\' by \'pyplanet.apps.contrib.info\'.',
'$f55MapInfo will be removed in $o0.6.0$o and will break your installation!'
'$f55MapInfo will be removed in $o0.7.0$o and will break your installation!'
]
for m in msg:
logging.error(style.style_strip(m))
Expand Down
8 changes: 8 additions & 0 deletions pyplanet/contrib/player/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ async def handle_info_change(self, player, is_spectator, is_temp_spectator, is_p
player=player,
), raw=True)

# This is in case of desync happens. Not nice to fix, but currently one of the only options.
if self._players_count < 0:
self._players_count = 0
if self._spectators_count < 0:
self._spectators_count = 0
if self._total_count < 0:
self._total_count = 0

player.flow.is_spectator = is_spectator
player.flow.is_temp_spectator = is_temp_spectator
player.flow.is_pure_spectator = is_pure_spectator
Expand Down

0 comments on commit cb44dab

Please sign in to comment.