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

All other Source.Python topics and issues.
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

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

Postby Mahi » Sun Feb 15, 2015 3:52 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Feb 15, 2015 4:17 pm

Image
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Sun Feb 15, 2015 11:19 pm

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...
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Feb 15, 2015 11:24 pm

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.
Image
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Sun Feb 15, 2015 11:27 pm

Oh right, should've read all the changes, my bad there :) Well, thanks for the quick response!

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 9 guests