Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
ml->SetTimer()

 
Post new topic   Reply to topic Printable version
 View previous topic  SSC biller and asss Post :: Post MaxFreq setting  View next topic  
Author Message
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri Mar 10, 2006 3:25 pm    Post subject: ml->SetTimer() Reply to topic Reply with quote

The design of this interface...

Code: Show/Hide
void (*SetTimer)(TimerFunc func, int initialdelay, int interval, void *param, void *key);


assumes that the CALLED function wants control of repetition. The return value is used to indicate what to do. In general, I have found that the CALLING function knows more about what it wants. Therefore I propose the following change:

If the interval is set to 0 (zero), then the timer only triggers once. This only requires a change of one line of code in mainloop.c:

Code: Show/Hide
from:

if (td->killme || !ret)

to:

if (td->killme || !td->interval || !ret)


I suppose this could conflict with those who expect a 0 (zero) interval to repeat as fast as the main loop is able. In that case, it would be possible to define something like:

Code: Show/Hide
#define NOREPEAT -1


and use it as an interval value.
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Fri Mar 10, 2006 7:04 pm    Post subject: Reply to topic Reply with quote

I agree that it's a little strange, but I've never had a big problem with it. That's mostly because thus far my timer functions have been very closely tied to the calling function, meaning it doesn't matter who controls the rescheduling.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Tue Mar 14, 2006 2:42 am    Post subject: Reply to topic Reply with quote

I've also never wanted this functionality. Generally the calling and called functions are very closely coupled. But since it only adds functionality and doesn't break anything existing, I'll add it.

If you want to be called for each main loop iteration, register a CB_MAINLOOP callback, don't use a timer.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 63 page(s) served in previous 5 minutes.

phpBB Created this page in 0.502536 seconds : 27 queries executed (95.3%): GZIP compression disabled