Page 1 of 1

Bug Report: TickRepeat's reduce() function stops the repeat when it shouldn't

Posted: Sun Feb 15, 2015 3:52 pm
by Mahi
Hey, there's a small bug in TickRepeat's reduce() method

Code: Select all

../listeners/tick/repeat.py
line 224-225:

Syntax: Select all

if (self.remaining and self._limit and
self.status is TickRepeatStatus.RUNNING):
I think it should say something like

Syntax: Select all

if (self.remaining <= 0 and self._limit and
self.status is TickRepeatStatus.RUNNING):

Since it's currently stopping the repeat if there are still loops remaining, which is the exact opposite of what we want.

Posted: Sun Feb 15, 2015 4:17 pm
by satoon101

Posted: Sun Feb 15, 2015 11:19 pm
by Mahi
You also seem to have removed the self._limit check.
I'm not 100% sure about this so correct me if I got it wrong, but wasn't that still required?
I figured that limit being zero probably means that the loop should run forever until manually stopped, so removing the check for limit makes it so the repeat always gets stopped regardless of its status, since self.remaining is always zero when the limit is zero.
Not sure though...

Posted: Sun Feb 15, 2015 11:24 pm
by satoon101
I actually moved that check as a different message should be sent if there is no limit.
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/packages/source-python/listeners/tick/repeat.py#L225

Though, I guess I should also add the same check in the extend method. *Edit: done.

Posted: Sun Feb 15, 2015 11:27 pm
by Mahi
Oh right, should've read all the changes, my bad there :) Well, thanks for the quick response!