From 0df333e7233527372979e5157494fce3fab7f69a Mon Sep 17 00:00:00 2001 From: Matti Bragge <1806447+merfolk@users.noreply.github.com> Date: Wed, 15 Apr 2020 20:50:28 +0300 Subject: [PATCH] Simplify comparisons inside if These were suggested by PyCharm. --- sharpy/plans/acts/defensive_building.py | 6 ++---- sharpy/plans/acts/position_building.py | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sharpy/plans/acts/defensive_building.py b/sharpy/plans/acts/defensive_building.py index 36b4bf4c..453932c7 100644 --- a/sharpy/plans/acts/defensive_building.py +++ b/sharpy/plans/acts/defensive_building.py @@ -63,10 +63,8 @@ async def execute(self) -> bool: for y in range(-2, 2): pos = int_pos + Point2((x, y)) if ( - pos.x > 0 - and pos.x < self.ai.state.creep.width - and pos.y > 0 - and pos.y < self.ai.state.creep.height + 0 < pos.x < self.ai.state.creep.width + and 0 < pos.y < self.ai.state.creep.height and self.ai.state.creep.is_set(pos) ): can_build = True diff --git a/sharpy/plans/acts/position_building.py b/sharpy/plans/acts/position_building.py index d24df031..78c19f5e 100644 --- a/sharpy/plans/acts/position_building.py +++ b/sharpy/plans/acts/position_building.py @@ -48,10 +48,8 @@ async def actually_build(self, ai, count): for y in range(-2, 2): pos = int_pos + Point2((x, y)) if ( - pos.x > 0 - and pos.x < self.ai.state.creep.width - and pos.y > 0 - and pos.y < self.ai.state.creep.height + 0 < pos.x < self.ai.state.creep.width + and 0 < pos.y < self.ai.state.creep.height and self.ai.state.creep.is_set(pos) ): can_build = True